diff options
author | Robbie Harwood <rharwood@redhat.com> | 2020-02-05 12:56:00 -0500 |
---|---|---|
committer | Greg Hudson <ghudson@mit.edu> | 2020-02-10 14:34:27 -0500 |
commit | 1a8e94f85b5177187a6ca953225d491257a1835d (patch) | |
tree | a29cafdf5a3ebc532b61dc4dd5e840e03d94031b | |
parent | 813ef2b92dbabff0e998436eaf6e75bdc92a245a (diff) | |
download | krb5-1a8e94f85b5177187a6ca953225d491257a1835d.tar.gz |
Don't assume OpenSSL failures are memory errors
More recent versions of OpenSSL can fail for other reasons. Indicate
a crypto-related error occurred rather than a memory error to aid
debugging.
(cherry picked from commit bf9b2134ceddd6c727362be894b1c95c297a0f17)
ticket: 8873
version_fixed: 1.17.2
-rw-r--r-- | src/lib/crypto/openssl/hash_provider/hash_evp.c | 2 | ||||
-rw-r--r-- | src/lib/crypto/openssl/sha256.c | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/src/lib/crypto/openssl/hash_provider/hash_evp.c b/src/lib/crypto/openssl/hash_provider/hash_evp.c index 957ed8d9c..1e0fb8fc3 100644 --- a/src/lib/crypto/openssl/hash_provider/hash_evp.c +++ b/src/lib/crypto/openssl/hash_provider/hash_evp.c @@ -58,7 +58,7 @@ hash_evp(const EVP_MD *type, const krb5_crypto_iov *data, size_t num_data, } ok = ok && EVP_DigestFinal_ex(ctx, (uint8_t *)output->data, NULL); EVP_MD_CTX_free(ctx); - return ok ? 0 : ENOMEM; + return ok ? 0 : KRB5_CRYPTO_INTERNAL; } static krb5_error_code diff --git a/src/lib/crypto/openssl/sha256.c b/src/lib/crypto/openssl/sha256.c index 0edd8b7ba..f9dfc8539 100644 --- a/src/lib/crypto/openssl/sha256.c +++ b/src/lib/crypto/openssl/sha256.c @@ -48,5 +48,5 @@ k5_sha256(const krb5_data *in, size_t n, uint8_t out[K5_SHA256_HASHLEN]) ok = ok && EVP_DigestUpdate(ctx, in[i].data, in[i].length); ok = ok && EVP_DigestFinal_ex(ctx, out, NULL); EVP_MD_CTX_free(ctx); - return ok ? 0 : ENOMEM; + return ok ? 0 : KRB5_CRYPTO_INTERNAL; } |