OBJ_nid2sn(NID_sha256) is completely equivalent to OSSL_DIGEST_NAME_SHA2_256
authorTomas Mraz <tomas@openssl.org>
Fri, 26 Mar 2021 16:50:03 +0000 (17:50 +0100)
committerTomas Mraz <tomas@openssl.org>
Thu, 1 Apr 2021 12:39:53 +0000 (14:39 +0200)
The comment is bogus as that call for NID_sha256 does not do
anything else than looking up the string in an internal table.

Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/14703)

ssl/s3_lib.c

index f5b063319b83bc39a82f9db25a6e3cf2c575be0e..1b491e7f922401ce0719d7e3a7ece6e85af7fd3c 100644 (file)
@@ -4275,12 +4275,8 @@ const SSL_CIPHER *ssl3_choose_cipher(SSL *s, STACK_OF(SSL_CIPHER) *clnt,
             if (prefer_sha256) {
                 const SSL_CIPHER *tmp = sk_SSL_CIPHER_value(allow, ii);
 
-                /*
-                 * TODO: When there are no more legacy digests we can just use
-                 * OSSL_DIGEST_NAME_SHA2_256 instead of calling OBJ_nid2sn
-                 */
                 if (EVP_MD_is_a(ssl_md(s->ctx, tmp->algorithm2),
-                                       OBJ_nid2sn(NID_sha256))) {
+                                       OSSL_DIGEST_NAME_SHA2_256)) {
                     ret = tmp;
                     break;
                 }