summaryrefslogtreecommitdiff
path: root/crypto/x509
diff options
context:
space:
mode:
authorDr. David von Oheimb <David.von.Oheimb@siemens.com>2022-06-28 08:17:59 +0200
committerDr. David von Oheimb <dev@ddvo.net>2022-07-19 08:44:19 +0200
commit33847508d5605d8dbe868d7694a4eff79d785404 (patch)
tree7cb02368d3058f88e67ea4dcda88718e839b9018 /crypto/x509
parent9df71587f1897c3b282b3fe1b47c01656b58531e (diff)
downloadopenssl-new-33847508d5605d8dbe868d7694a4eff79d785404.tar.gz
libcrypto refactoring: make more use of ASN1_STRING_set0()
Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Shane Lontis <shane.lontis@oracle.com> Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com> (Merged from https://github.com/openssl/openssl/pull/18668)
Diffstat (limited to 'crypto/x509')
-rw-r--r--crypto/x509/x_pubkey.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/crypto/x509/x_pubkey.c b/crypto/x509/x_pubkey.c
index 6c554bc030..126c2400f6 100644
--- a/crypto/x509/x_pubkey.c
+++ b/crypto/x509/x_pubkey.c
@@ -980,9 +980,7 @@ int ossl_i2d_X448_PUBKEY(const ECX_KEY *a, unsigned char **pp)
void X509_PUBKEY_set0_public_key(X509_PUBKEY *pub,
unsigned char *penc, int penclen)
{
- OPENSSL_free(pub->public_key->data);
- pub->public_key->data = penc;
- pub->public_key->length = penclen;
+ ASN1_STRING_set0(pub->public_key, penc, penclen);
/* Set number of unused bits to zero */
pub->public_key->flags &= ~(ASN1_STRING_FLAG_BITS_LEFT | 0x07);
pub->public_key->flags |= ASN1_STRING_FLAG_BITS_LEFT;