Commit d8aa15439f for openssl.org

commit d8aa15439f8001ddb43816f74314404c7db6e42c
Author: Pauli <paul.dale@oracle.com>
Date:   Mon Nov 9 09:03:08 2026 +1100

    crypto/stack/stack.c: streamline OPENSSL_sk_zero()

    OPENSSL_sk_zero() cleared the memory occupied by the element pointers
    in addition to setting the number of elements to zero.  This was more
    work than using OPENSSL_sk_pop() in a loop until OPENSSL_sk_num()
    is zero (that won't zero the pointers but yield the same result
    with regards to the element count).  Drop the memory zeroing and just
    set the count.

    Note: the is no API contract to clear out the elements of the stack,
    only their references.  There isn't a security implication
    by not zeroing the pointers to the data.  The documentation doesn't
    require updating because it only claims that the number of elements
    is set to zero, which is still occurring.

    Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
    Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
    Merge-date: Tue Nov 10 11:16:20 2026
    Merged-from: https://github.com/openssl/openssl/pull/33605

diff --git a/crypto/stack/stack.c b/crypto/stack/stack.c
index 5799bf9d7c..90e56f6e4d 100644
--- a/crypto/stack/stack.c
+++ b/crypto/stack/stack.c
@@ -472,7 +472,6 @@ void OPENSSL_sk_zero(OPENSSL_STACK *st)
 {
     if (st == NULL || st->num == 0)
         return;
-    memset(st->data, 0, sizeof(*st->data) * st->num);
     st->num = 0;
 }