diff options
author | Dr. David von Oheimb <David.von.Oheimb@siemens.com> | 2022-06-28 08:17:59 +0200 |
---|---|---|
committer | Dr. David von Oheimb <dev@ddvo.net> | 2022-07-19 08:44:19 +0200 |
commit | 33847508d5605d8dbe868d7694a4eff79d785404 (patch) | |
tree | 7cb02368d3058f88e67ea4dcda88718e839b9018 /crypto/x509/x_pubkey.c | |
parent | Add X509_PUBKEY_set0_public_key(), extracted from X509_PUBKEY_set0_param() (diff) | |
download | openssl-33847508d5605d8dbe868d7694a4eff79d785404.tar.xz openssl-33847508d5605d8dbe868d7694a4eff79d785404.zip |
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/x_pubkey.c')
-rw-r--r-- | crypto/x509/x_pubkey.c | 4 |
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; |