]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
pbe: sort stack before using find
authorPauli <pauli@openssl.org>
Thu, 27 Apr 2023 00:55:48 +0000 (10:55 +1000)
committerPauli <pauli@openssl.org>
Mon, 1 May 2023 07:14:42 +0000 (17:14 +1000)
There is no lock for the sort.  This is no worse than the
existing code which sorted silently without a lock.

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Todd Short <todd.short@me.com>
(Merged from https://github.com/openssl/openssl/pull/20842)

crypto/evp/evp_pbe.c

index d943dfeaddfd12df6c4160536e002b7bfa2b1f97..9901d66a777fc505eb62de8f0802b7c0a66b3c3f 100644 (file)
@@ -259,6 +259,8 @@ int EVP_PBE_find_ex(int type, int pbe_nid, int *pcnid, int *pmnid,
     pbelu.pbe_nid = pbe_nid;
 
     if (pbe_algs != NULL) {
+        /* Ideally, this would be done under lock */
+        sk_EVP_PBE_CTL_sort(pbe_algs);
         i = sk_EVP_PBE_CTL_find(pbe_algs, &pbelu);
         pbetmp = sk_EVP_PBE_CTL_value(pbe_algs, i);
     }