diff options
author | Johannes Bauer <joe@johannes-bauer.com> | 2017-08-01 18:32:45 +0200 |
---|---|---|
committer | Dr. Stephen Henson <steve@openssl.org> | 2017-08-03 02:07:52 +0200 |
commit | 5b277519236c17a9968623b1f038fe6b34e89899 (patch) | |
tree | a26658d0b4036d8cecca37b357cb6c3fa83b80b7 /crypto/kdf | |
parent | Changed use of EVP_PKEY_CTX_md() and more specific error codes (diff) | |
download | openssl-5b277519236c17a9968623b1f038fe6b34e89899.tar.xz openssl-5b277519236c17a9968623b1f038fe6b34e89899.zip |
Added differentiation between missing secret and missing seed
This was previously mistakenly handled as a single error code.
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Stephen Henson <steve@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3989)
Diffstat (limited to 'crypto/kdf')
-rw-r--r-- | crypto/kdf/kdf_err.c | 1 | ||||
-rw-r--r-- | crypto/kdf/tls1_prf.c | 6 |
2 files changed, 6 insertions, 1 deletions
diff --git a/crypto/kdf/kdf_err.c b/crypto/kdf/kdf_err.c index 3b185c8ee5..8d2727217d 100644 --- a/crypto/kdf/kdf_err.c +++ b/crypto/kdf/kdf_err.c @@ -29,6 +29,7 @@ static const ERR_STRING_DATA KDF_str_reasons[] = { {ERR_PACK(ERR_LIB_KDF, 0, KDF_R_MISSING_MESSAGE_DIGEST), "missing message digest"}, {ERR_PACK(ERR_LIB_KDF, 0, KDF_R_MISSING_PARAMETER), "missing parameter"}, + {ERR_PACK(ERR_LIB_KDF, 0, KDF_R_MISSING_SECRET), "missing secret"}, {ERR_PACK(ERR_LIB_KDF, 0, KDF_R_MISSING_SEED), "missing seed"}, {ERR_PACK(ERR_LIB_KDF, 0, KDF_R_UNKNOWN_PARAMETER_TYPE), "unknown parameter type"}, diff --git a/crypto/kdf/tls1_prf.c b/crypto/kdf/tls1_prf.c index f5e1063461..063ea0390a 100644 --- a/crypto/kdf/tls1_prf.c +++ b/crypto/kdf/tls1_prf.c @@ -128,7 +128,11 @@ static int pkey_tls1_prf_derive(EVP_PKEY_CTX *ctx, unsigned char *key, KDFerr(KDF_F_PKEY_TLS1_PRF_DERIVE, KDF_R_MISSING_MESSAGE_DIGEST); return 0; } - if (kctx->sec == NULL || kctx->seedlen == 0) { + if (kctx->sec == NULL) { + KDFerr(KDF_F_PKEY_TLS1_PRF_DERIVE, KDF_R_MISSING_SECRET); + return 0; + } + if (kctx->seedlen == 0) { KDFerr(KDF_F_PKEY_TLS1_PRF_DERIVE, KDF_R_MISSING_SEED); return 0; } |