diff options
author | Shane Lontis <shane.lontis@oracle.com> | 2021-03-05 01:22:56 +0300 |
---|---|---|
committer | Tomas Mraz <tomas@openssl.org> | 2021-03-22 17:40:04 +0300 |
commit | e72dbd8e13cbf5a16faaa6c911af5507593dd836 (patch) | |
tree | ec450d9fef6ba2223cfc36ee1865512254f9dd23 /crypto/x509/x509_cmp.c | |
parent | c781eb1c63c243cb64dbe3066a43dc172aaab3b8 (diff) |
Fix usages of const EVP_MD.
Partially fixes #13837
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/14474)
Diffstat (limited to 'crypto/x509/x509_cmp.c')
-rw-r--r-- | crypto/x509/x509_cmp.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/crypto/x509/x509_cmp.c b/crypto/x509/x509_cmp.c index 3ced70b21f..51dc24b6fb 100644 --- a/crypto/x509/x509_cmp.c +++ b/crypto/x509/x509_cmp.c @@ -40,13 +40,18 @@ unsigned long X509_issuer_and_serial_hash(X509 *a) EVP_MD_CTX *ctx = EVP_MD_CTX_new(); unsigned char md[16]; char *f; + EVP_MD *digest = NULL; if (ctx == NULL) goto err; f = X509_NAME_oneline(a->cert_info.issuer, NULL, 0); if (f == NULL) goto err; - if (!EVP_DigestInit_ex(ctx, EVP_md5(), NULL)) + digest = EVP_MD_fetch(a->libctx, SN_md5, a->propq); + if (digest == NULL) + goto err; + + if (!EVP_DigestInit_ex(ctx, digest, NULL)) goto err; if (!EVP_DigestUpdate(ctx, (unsigned char *)f, strlen(f))) goto err; @@ -61,6 +66,7 @@ unsigned long X509_issuer_and_serial_hash(X509 *a) ((unsigned long)md[2] << 16L) | ((unsigned long)md[3] << 24L) ) & 0xffffffffL; err: + EVP_MD_free(digest); EVP_MD_CTX_free(ctx); return ret; } |