diff options
author | Jack Lloyd <[email protected]> | 2019-10-28 06:48:38 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2019-10-28 06:51:35 -0400 |
commit | f84a03eaace029270d2d026fc3ecf5ba004f0c89 (patch) | |
tree | b8d96422275d9686bb56c532c9bdcd2770f3552b /src/lib/prov/pkcs11 | |
parent | dcb621e23a8ff8f1cb24adc681807a52dc6a49b3 (diff) |
Deprecate DER_Encoder::get_contents_unlocked
It's better to use the version taking the vector in the constructor
as otherwise we store to locked memory then copy out at the end.
Convert all library uses.
Diffstat (limited to 'src/lib/prov/pkcs11')
-rw-r--r-- | src/lib/prov/pkcs11/p11_ecdh.cpp | 2 | ||||
-rw-r--r-- | src/lib/prov/pkcs11/p11_x509.h | 4 |
2 files changed, 5 insertions, 1 deletions
diff --git a/src/lib/prov/pkcs11/p11_ecdh.cpp b/src/lib/prov/pkcs11/p11_ecdh.cpp index f6e27e513..32904aef6 100644 --- a/src/lib/prov/pkcs11/p11_ecdh.cpp +++ b/src/lib/prov/pkcs11/p11_ecdh.cpp @@ -55,7 +55,7 @@ class PKCS11_ECDH_KA_Operation final : public PK_Ops::Key_Agreement std::vector<uint8_t> der_encoded_other_key; if(m_key.point_encoding() == PublicPointEncoding::Der) { - der_encoded_other_key = DER_Encoder().encode(other_key, other_key_len, OCTET_STRING).get_contents_unlocked(); + DER_Encoder(der_encoded_other_key).encode(other_key, other_key_len, OCTET_STRING); m_mechanism.set_ecdh_other_key(der_encoded_other_key.data(), der_encoded_other_key.size()); } else diff --git a/src/lib/prov/pkcs11/p11_x509.h b/src/lib/prov/pkcs11/p11_x509.h index ed084e9c1..d3eafbe35 100644 --- a/src/lib/prov/pkcs11/p11_x509.h +++ b/src/lib/prov/pkcs11/p11_x509.h @@ -31,6 +31,10 @@ class BOTAN_PUBLIC_API(2,0) X509_CertificateProperties final : public Certificat */ X509_CertificateProperties(const std::vector<uint8_t>& subject, const std::vector<uint8_t>& value); + X509_CertificateProperties(const X509_Certificate& cert) : + X509_CertificateProperties(cert.raw_subject_dn(), cert.BER_encode()) + {} + /// @param id key identifier for public/private key pair inline void set_id(const std::vector<uint8_t>& id) { |