From 8ee3ded1c34d8cad25e768feb22b4887c8a5e11c Mon Sep 17 00:00:00 2001 From: tb <> Date: Sun, 12 May 2019 15:52:46 +0000 Subject: Revert the other hunk of r1.36 as well: in the case of CCM, ccm.key is assigned from aesni_ccm_init_key() via CRYPTO_ccm128_init(), so it needs to be copied over... Pointed out by Guido Vranken. ok jsing --- src/lib/libcrypto/evp/e_aes.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/lib/libcrypto/evp/e_aes.c b/src/lib/libcrypto/evp/e_aes.c index a1e94c8ff6..8fddeaaa40 100644 --- a/src/lib/libcrypto/evp/e_aes.c +++ b/src/lib/libcrypto/evp/e_aes.c @@ -1,4 +1,4 @@ -/* $OpenBSD: e_aes.c,v 1.38 2019/05/10 18:41:17 tb Exp $ */ +/* $OpenBSD: e_aes.c,v 1.39 2019/05/12 15:52:46 tb Exp $ */ /* ==================================================================== * Copyright (c) 2001-2011 The OpenSSL Project. All rights reserved. * @@ -1243,7 +1243,17 @@ aes_ccm_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr) return 1; case EVP_CTRL_COPY: + { + EVP_CIPHER_CTX *out = ptr; + EVP_AES_CCM_CTX *cctx_out = out->cipher_data; + + if (cctx->ccm.key) { + if (cctx->ccm.key != &cctx->ks) + return 0; + cctx_out->ccm.key = &cctx_out->ks; + } return 1; + } default: return -1; -- cgit v1.2.3-55-g6feb