From bb34c9a008c176c2db28fbe8be807d2bc5afbfad Mon Sep 17 00:00:00 2001 From: tb Date: Tue, 24 May 2022 20:00:15 +0000 Subject: [PATCH] Straightforward conversion of ecdh_cms_encrypt() to asn1_abs_set_unused_bits() ok jsing --- lib/libcrypto/ec/ec_ameth.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/libcrypto/ec/ec_ameth.c b/lib/libcrypto/ec/ec_ameth.c index 86f509b7365..59957afd3d3 100644 --- a/lib/libcrypto/ec/ec_ameth.c +++ b/lib/libcrypto/ec/ec_ameth.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ec_ameth.c,v 1.31 2022/01/10 12:10:26 tb Exp $ */ +/* $OpenBSD: ec_ameth.c,v 1.32 2022/05/24 20:00:15 tb Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 2006. */ @@ -888,8 +888,8 @@ ecdh_cms_encrypt(CMS_RecipientInfo *ri) if (penclen <= 0) goto err; ASN1_STRING_set0(pubkey, penc, penclen); - pubkey->flags &= ~(ASN1_STRING_FLAG_BITS_LEFT | 0x07); - pubkey->flags |= ASN1_STRING_FLAG_BITS_LEFT; + if (!asn1_abs_set_unused_bits(pubkey, 0)) + goto err; penc = NULL; X509_ALGOR_set0(talg, OBJ_nid2obj(NID_X9_62_id_ecPublicKey), -- 2.20.1