diff options
author | Jack Lloyd <[email protected]> | 2020-04-06 06:59:43 -0400 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2020-04-06 06:59:43 -0400 |
commit | 9f15f66587d9ef51d128c91ec7546b798e7acd56 (patch) | |
tree | 27c211f76ed5a6fbe898ae9acc7646d177b847f5 | |
parent | 83d2cf400cad9fed222c7d5b5f83f19875f64890 (diff) |
Don't return empty vector from raw_xxx_dn_sha256 if SHA-256 disabled
This can't happen currently because x509 module has a hard dep
on SHA-256 but if that changed in the future it would expose
incorrect behavior.
-rw-r--r-- | src/lib/x509/x509cert.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/lib/x509/x509cert.cpp b/src/lib/x509/x509cert.cpp index 22c0a1a61..579613c5d 100644 --- a/src/lib/x509/x509cert.cpp +++ b/src/lib/x509/x509cert.cpp @@ -697,11 +697,15 @@ std::unique_ptr<Public_Key> X509_Certificate::load_subject_public_key() const std::vector<uint8_t> X509_Certificate::raw_issuer_dn_sha256() const { + if(data().m_issuer_dn_bits_sha256.empty()) + throw Encoding_Error("X509_Certificate::raw_issuer_dn_sha256 called but SHA-256 disabled in build"); return data().m_issuer_dn_bits_sha256; } std::vector<uint8_t> X509_Certificate::raw_subject_dn_sha256() const { + if(data().m_subject_dn_bits_sha256.empty()) + throw Encoding_Error("X509_Certificate::raw_subject_dn_sha256 called but SHA-256 disabled in build"); return data().m_subject_dn_bits_sha256; } |