summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/x509/x509_lcl.h
diff options
context:
space:
mode:
authorbeck <>2021-11-04 23:52:34 +0000
committerbeck <>2021-11-04 23:52:34 +0000
commit87decea9a33c04cfad36679efd6678bbc21363cd (patch)
tree3ca9bd91a3930e5f3e28873aa362dffdb8cf6227 /src/lib/libcrypto/x509/x509_lcl.h
parent427635c8217e5b9c6e458a39dac977cc6818582f (diff)
downloadopenbsd-87decea9a33c04cfad36679efd6678bbc21363cd.tar.gz
openbsd-87decea9a33c04cfad36679efd6678bbc21363cd.tar.bz2
openbsd-87decea9a33c04cfad36679efd6678bbc21363cd.zip
Cache sha512 hash and parsed not_before and not_after with X509 cert.
Replace sha1 hash use with sha512 for certificate comparisons internal to the library. use the cached sha512 for the validator's verification cache. Reduces our recomputation of hashes, and heavy use of time1 time conversion functions noticed bu claudio@ in rpki client. ok jsing@ tb@
Diffstat (limited to 'src/lib/libcrypto/x509/x509_lcl.h')
-rw-r--r--src/lib/libcrypto/x509/x509_lcl.h12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/lib/libcrypto/x509/x509_lcl.h b/src/lib/libcrypto/x509/x509_lcl.h
index 1b352aee78..804fff48fc 100644
--- a/src/lib/libcrypto/x509/x509_lcl.h
+++ b/src/lib/libcrypto/x509/x509_lcl.h
@@ -61,6 +61,12 @@
61 61
62__BEGIN_HIDDEN_DECLS 62__BEGIN_HIDDEN_DECLS
63 63
64#define TS_HASH_EVP EVP_sha1()
65#define TS_HASH_LEN SHA_DIGEST_LENGTH
66
67#define X509_CERT_HASH_EVP EVP_sha512()
68#define X509_CERT_HASH_LEN SHA512_DIGEST_LENGTH
69
64struct X509_pubkey_st { 70struct X509_pubkey_st {
65 X509_ALGOR *algor; 71 X509_ALGOR *algor;
66 ASN1_BIT_STRING *public_key; 72 ASN1_BIT_STRING *public_key;
@@ -177,9 +183,9 @@ struct x509_st {
177 STACK_OF(IPAddressFamily) *rfc3779_addr; 183 STACK_OF(IPAddressFamily) *rfc3779_addr;
178 struct ASIdentifiers_st *rfc3779_asid; 184 struct ASIdentifiers_st *rfc3779_asid;
179#endif 185#endif
180#ifndef OPENSSL_NO_SHA 186 unsigned char hash[X509_CERT_HASH_LEN];
181 unsigned char sha1_hash[SHA_DIGEST_LENGTH]; 187 time_t not_before;
182#endif 188 time_t not_after;
183 X509_CERT_AUX *aux; 189 X509_CERT_AUX *aux;
184} /* X509 */; 190} /* X509 */;
185 191