From 727d2c709c3255d40cf263a0710c0c78f01e92ba Mon Sep 17 00:00:00 2001 From: Ted Poole Date: Fri, 23 Jun 2023 10:33:06 +0100 Subject: [PATCH] OSSM-3365 Added X509_get_key_usage() Signed-off-by: Ted Poole --- bssl-compat/CMakeLists.txt | 1 + bssl-compat/patch/include/openssl/x509v3.h.patch | 6 ++++-- bssl-compat/patch/include/openssl/x509v3.h.sh | 3 ++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/bssl-compat/CMakeLists.txt b/bssl-compat/CMakeLists.txt index 568c17aa05..c981447221 100644 --- a/bssl-compat/CMakeLists.txt +++ b/bssl-compat/CMakeLists.txt @@ -281,6 +281,7 @@ target_add_bssl_function(bssl-compat X509_get_ext X509_get_ext_by_OBJ X509_get_ext_d2i + X509_get_key_usage X509_get_serialNumber X509_get_X509_PUBKEY X509_get0_notAfter diff --git a/bssl-compat/patch/include/openssl/x509v3.h.patch b/bssl-compat/patch/include/openssl/x509v3.h.patch index df1c4917e9..e9b9b0b0d6 100644 --- a/bssl-compat/patch/include/openssl/x509v3.h.patch +++ b/bssl-compat/patch/include/openssl/x509v3.h.patch @@ -107,15 +107,17 @@ // DECLARE_ASN1_ALLOC_FUNCTIONS(POLICY_CONSTRAINTS) // DECLARE_ASN1_ITEM(POLICY_CONSTRAINTS) -@@ -857,7 +861,7 @@ +@@ -857,8 +861,8 @@ // OPENSSL_EXPORT int X509_check_issued(X509 *issuer, X509 *subject); // OPENSSL_EXPORT int X509_check_akid(X509 *issuer, AUTHORITY_KEYID *akid); -// OPENSSL_EXPORT uint32_t X509_get_extension_flags(X509 *x); +-// OPENSSL_EXPORT uint32_t X509_get_key_usage(X509 *x); +OPENSSL_EXPORT uint32_t X509_get_extension_flags(X509 *x); - // OPENSSL_EXPORT uint32_t X509_get_key_usage(X509 *x); ++OPENSSL_EXPORT uint32_t X509_get_key_usage(X509 *x); // OPENSSL_EXPORT uint32_t X509_get_extended_key_usage(X509 *x); + // X509_get0_subject_key_id returns |x509|'s subject key identifier, if present. @@ -958,29 +962,29 @@ // made after this point may be overwritten when the script is next run. diff --git a/bssl-compat/patch/include/openssl/x509v3.h.sh b/bssl-compat/patch/include/openssl/x509v3.h.sh index 706c59bc37..ec272574d6 100755 --- a/bssl-compat/patch/include/openssl/x509v3.h.sh +++ b/bssl-compat/patch/include/openssl/x509v3.h.sh @@ -2,5 +2,6 @@ sed -i -e 's|^// \(#[ \t]*define[ \t]*\)\(X509V3_R_[a-zA-Z0-9_]*\)[^a-zA-Z0-9_].*$|#ifdef ossl_\2\n\1\2 ossl_\2\n#endif|g' \ -e 's|^// \(#[ \t]*define[ \t]*\)\(GEN_[A-Z0-9_]*\)[^a-zA-Z0-9_].*$|#ifdef ossl_\2\n\1\2 ossl_\2\n#endif|g' \ - -e 's|^// \(#[ \t]*define[ \t]*\)\(EXFLAG_[A-Z0-9_]*\)[^a-zA-Z0-9_].*$|#ifdef ossl_\2\n\1\2 ossl_\2\n#endif|g' "$1" + -e 's|^// \(#[ \t]*define[ \t]*\)\(EXFLAG_[A-Z0-9_]*\)[^a-zA-Z0-9_].*$|#ifdef ossl_\2\n\1\2 ossl_\2\n#endif|g' \ + -e 's|^// \(#[ \t]*define[ \t]*\)\(KU_[A-Z0-9_]*\)[^a-zA-Z0-9_].*$|#ifdef ossl_\2\n\1\2 ossl_\2\n#endif|g' "$1"