diff options
author | Pauli <pauli@openssl.org> | 2021-04-15 10:35:28 +1000 |
---|---|---|
committer | Pauli <pauli@openssl.org> | 2021-04-21 09:27:51 +1000 |
commit | 42e7d043f09f7a54005800fb00cb11a0c38e891f (patch) | |
tree | 11e27a922f343974744c157c0eee1453095341dd /crypto/srp | |
parent | 3f700d4b95f249308e03c0f1fcb3c9620dad94fe (diff) |
srp: remove references to EVP_sha1()
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/14881)
Diffstat (limited to 'crypto/srp')
-rw-r--r-- | crypto/srp/srp_vfy.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/crypto/srp/srp_vfy.c b/crypto/srp/srp_vfy.c index 2c2ec11cd4..85e2c96e1a 100644 --- a/crypto/srp/srp_vfy.c +++ b/crypto/srp/srp_vfy.c @@ -551,6 +551,7 @@ SRP_user_pwd *SRP_VBASE_get1_by_user(SRP_VBASE *vb, char *username) unsigned char digv[SHA_DIGEST_LENGTH]; unsigned char digs[SHA_DIGEST_LENGTH]; EVP_MD_CTX *ctxt = NULL; + EVP_MD *md = NULL; if (vb == NULL) return NULL; @@ -574,21 +575,27 @@ SRP_user_pwd *SRP_VBASE_get1_by_user(SRP_VBASE *vb, char *username) if (RAND_priv_bytes(digv, SHA_DIGEST_LENGTH) <= 0) goto err; + md = EVP_MD_fetch(NULL, SN_sha1, NULL); + if (md == NULL) + goto err; ctxt = EVP_MD_CTX_new(); if (ctxt == NULL - || !EVP_DigestInit_ex(ctxt, EVP_sha1(), NULL) + || !EVP_DigestInit_ex(ctxt, md, NULL) || !EVP_DigestUpdate(ctxt, vb->seed_key, strlen(vb->seed_key)) || !EVP_DigestUpdate(ctxt, username, strlen(username)) || !EVP_DigestFinal_ex(ctxt, digs, NULL)) goto err; EVP_MD_CTX_free(ctxt); ctxt = NULL; + EVP_MD_free(md); + md = NULL; if (SRP_user_pwd_set0_sv(user, - BN_bin2bn(digs, SHA_DIGEST_LENGTH, NULL), - BN_bin2bn(digv, SHA_DIGEST_LENGTH, NULL))) + BN_bin2bn(digs, SHA_DIGEST_LENGTH, NULL), + BN_bin2bn(digv, SHA_DIGEST_LENGTH, NULL))) return user; err: + EVP_MD_free(md); EVP_MD_CTX_free(ctxt); SRP_user_pwd_free(user); return NULL; |