summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/x509/x509_purp.c
diff options
context:
space:
mode:
authorbeck <>2021-11-04 23:52:34 +0000
committerbeck <>2021-11-04 23:52:34 +0000
commit244374d8dda906a87c40f39a8ed949cf07a1c8f3 (patch)
tree3ca9bd91a3930e5f3e28873aa362dffdb8cf6227 /src/lib/libcrypto/x509/x509_purp.c
parentb866948734d2d995d78efdc04fb93574782722fa (diff)
downloadopenbsd-244374d8dda906a87c40f39a8ed949cf07a1c8f3.tar.gz
openbsd-244374d8dda906a87c40f39a8ed949cf07a1c8f3.tar.bz2
openbsd-244374d8dda906a87c40f39a8ed949cf07a1c8f3.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_purp.c')
-rw-r--r--src/lib/libcrypto/x509/x509_purp.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/lib/libcrypto/x509/x509_purp.c b/src/lib/libcrypto/x509/x509_purp.c
index 67a7b51fb1..a05c0388ac 100644
--- a/src/lib/libcrypto/x509/x509_purp.c
+++ b/src/lib/libcrypto/x509/x509_purp.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: x509_purp.c,v 1.12 2021/11/01 20:53:08 tb Exp $ */ 1/* $OpenBSD: x509_purp.c,v 1.13 2021/11/04 23:52:34 beck Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 2001. 3 * project 2001.
4 */ 4 */
@@ -65,6 +65,7 @@
65#include <openssl/x509v3.h> 65#include <openssl/x509v3.h>
66#include <openssl/x509_vfy.h> 66#include <openssl/x509_vfy.h>
67 67
68#include "x509_internal.h"
68#include "x509_lcl.h" 69#include "x509_lcl.h"
69 70
70#define V1_ROOT (EXFLAG_V1|EXFLAG_SS) 71#define V1_ROOT (EXFLAG_V1|EXFLAG_SS)
@@ -449,9 +450,7 @@ x509v3_cache_extensions(X509 *x)
449 if (x->ex_flags & EXFLAG_SET) 450 if (x->ex_flags & EXFLAG_SET)
450 return; 451 return;
451 452
452#ifndef OPENSSL_NO_SHA 453 X509_digest(x, X509_CERT_HASH_EVP, x->hash, NULL);
453 X509_digest(x, EVP_sha1(), x->sha1_hash, NULL);
454#endif
455 454
456 /* V1 should mean no extensions ... */ 455 /* V1 should mean no extensions ... */
457 if (!X509_get_version(x)) 456 if (!X509_get_version(x))
@@ -618,6 +617,9 @@ x509v3_cache_extensions(X509 *x)
618 break; 617 break;
619 } 618 }
620 } 619 }
620
621 x509_verify_cert_info_populate(x);
622
621 x->ex_flags |= EXFLAG_SET; 623 x->ex_flags |= EXFLAG_SET;
622} 624}
623 625