[openssl/openssl] 61cfc2: Implement dupctx for chacha20 cipher

Neil Horman noreply at github.com
Mon Sep 4 00:18:15 UTC 2023


  Branch: refs/heads/master
  Home:   https://github.com/openssl/openssl
  Commit: 61cfc22b60e33bc77b1e1944759af48c8e58f0d2
      https://github.com/openssl/openssl/commit/61cfc22b60e33bc77b1e1944759af48c8e58f0d2
  Author: Neil Horman <nhorman at openssl.org>
  Date:   2023-09-04 (Mon, 04 Sep 2023)

  Changed paths:
    M providers/implementations/ciphers/cipher_chacha20.c

  Log Message:
  -----------
  Implement dupctx for chacha20 cipher

Implement the dupctx method for the chacha20 cipher, so that
EVP_PKEY_CTX_copy works

Its pretty straightforward, its basically just a memdup.  Checking the
pointers that might need fixing up:

in PROV_CHACHA20_CTX all members are statically declared, so memduping
should be fine

in PROV_CHACHA20_CTX->base (PROV_CIPHER_CTX):
        Non statically declared members:
                *tlsmac needs to get memduped to avoid double free
                 conditions, but only if base.alloced is set
                *hw pointer is always assigned to the chacha20_hw global
                 variable, so can be left alone
                *libctx can be left alone as provctx is always NULL in
                 chacha20_newctx
                *ks appears unused by chacha20, so can be ignored
Fixes #20978

Reviewed-by: Richard Levitte <levitte at openssl.org>
Reviewed-by: Tomas Mraz <tomas at openssl.org>
Reviewed-by: Shane Lontis <shane.lontis at oracle.com>
Reviewed-by: Paul Dale <pauli at openssl.org>
(Merged from https://github.com/openssl/openssl/pull/21878)




More information about the openssl-commits mailing list