diff options
author | Dr. David von Oheimb <David.von.Oheimb@siemens.com> | 2021-06-21 08:55:50 +0200 |
---|---|---|
committer | Dr. David von Oheimb <David.von.Oheimb@siemens.com> | 2021-11-17 15:48:34 +0100 |
commit | 2ff286c26c29b69b02ca99656d26d2f8cfd54682 (patch) | |
tree | 71a01c51c47d0dd9528ff14357615d71420ba5a1 /crypto/params_from_text.c | |
parent | a6838c8d52087f2b0494bbab8486e10944aff7f7 (diff) | |
download | openssl-new-2ff286c26c29b69b02ca99656d26d2f8cfd54682.tar.gz |
Add and use HAS_PREFIX() and CHECK_AND_SKIP_PREFIX() for checking if string has literal prefix
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/15847)
Diffstat (limited to 'crypto/params_from_text.c')
-rw-r--r-- | crypto/params_from_text.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/crypto/params_from_text.c b/crypto/params_from_text.c index 50f48fdb7e..889b654db9 100644 --- a/crypto/params_from_text.c +++ b/crypto/params_from_text.c @@ -8,7 +8,7 @@ * https://www.openssl.org/source/license.html */ -#include <string.h> +#include "internal/cryptlib.h" /* for HAS_PREFIX */ #include <openssl/ebcdic.h> #include <openssl/err.h> #include <openssl/params.h> @@ -35,10 +35,7 @@ static int prepare_from_text(const OSSL_PARAM *paramdefs, const char *key, * ishex is used to translate legacy style string controls in hex format * to octet string parameters. */ - *ishex = strncmp(key, "hex", 3) == 0; - - if (*ishex) - key += 3; + *ishex = CHECK_AND_SKIP_PREFIX(key, "hex"); p = *paramdef = OSSL_PARAM_locate_const(paramdefs, key); if (found != NULL) |