From 39271e92348cbf267a87297cc3eae9649198e1c9 Mon Sep 17 00:00:00 2001 From: Eric Blankenhorn Date: Wed, 22 Jul 2020 14:08:57 -0500 Subject: [PATCH 1/2] Fix build issue with OPENSSL_EXTRA_X509_SMALL --- src/ssl.c | 66 ++++++++++++++++++++++++++++++------------------------- 1 file changed, 36 insertions(+), 30 deletions(-) diff --git a/src/ssl.c b/src/ssl.c index 2a2ab7786..48d3d48a1 100644 --- a/src/ssl.c +++ b/src/ssl.c @@ -17388,6 +17388,34 @@ WOLFSSL_X509* wolfSSL_X509_d2i(WOLFSSL_X509** x509, const byte* in, int len) return newX509; } + +int wolfSSL_X509_get_isCA(WOLFSSL_X509* x509) +{ + int isCA = 0; + + WOLFSSL_ENTER("wolfSSL_X509_get_isCA"); + + if (x509 != NULL) + isCA = x509->isCa; + + WOLFSSL_LEAVE("wolfSSL_X509_get_isCA", isCA); + + return isCA; +} + +/* returns the number of entries in the WOLFSSL_X509_NAME */ +int wolfSSL_X509_NAME_entry_count(WOLFSSL_X509_NAME* name) +{ + int count = 0; + + WOLFSSL_ENTER("wolfSSL_X509_NAME_entry_count"); + + if (name != NULL) + count = name->entrySz; + + WOLFSSL_LEAVE("wolfSSL_X509_NAME_entry_count", count); + return count; +} #endif /* KEEP_PEER_CERT || SESSION_CERTS || OPENSSL_EXTRA || OPENSSL_EXTRA_X509_SMALL */ @@ -17416,20 +17444,6 @@ WOLFSSL_X509* wolfSSL_X509_d2i(WOLFSSL_X509** x509, const byte* in, int len) return ret; } - int wolfSSL_X509_get_isCA(WOLFSSL_X509* x509) - { - int isCA = 0; - - WOLFSSL_ENTER("wolfSSL_X509_get_isCA"); - - if (x509 != NULL) - isCA = x509->isCa; - - WOLFSSL_LEAVE("wolfSSL_X509_get_isCA", isCA); - - return isCA; - } - int wolfSSL_X509_get_signature(WOLFSSL_X509* x509, unsigned char* buf, int* bufSz) { @@ -20264,21 +20278,6 @@ int wolfSSL_X509_cmp(const WOLFSSL_X509 *a, const WOLFSSL_X509 *b) return id; } - - - /* returns the number of entries in the WOLFSSL_X509_NAME */ - int wolfSSL_X509_NAME_entry_count(WOLFSSL_X509_NAME* name) - { - int count = 0; - - WOLFSSL_ENTER("wolfSSL_X509_NAME_entry_count"); - - if (name != NULL) - count = name->entrySz; - - WOLFSSL_LEAVE("wolfSSL_X509_NAME_entry_count", count); - return count; - } #endif /* !NO_CERTS && OPENSSL_EXTRA */ #if defined(OPENSSL_EXTRA) || defined(WOLFSSL_WPAS_SMALL) || \ @@ -36748,9 +36747,16 @@ static int CopyX509NameToCertName(WOLFSSL_X509_NAME* n, CertName* cName) int hashType; int sigType = WOLFSSL_FAILURE; + #if !defined(NO_PWDBASED) /* Convert key type and hash algorithm to a signature algorithm */ - if (wolfSSL_EVP_get_hashinfo(md, &hashType, NULL) == WOLFSSL_FAILURE) + if (wolfSSL_EVP_get_hashinfo(md, &hashType, NULL) == WOLFSSL_FAILURE) { return WOLFSSL_FAILURE; + } + #else + (void)md; + WOLFSSL_MSG("Cannot get hashinfo when NO_PWDBASED is defined"); + return WOLFSSL_FAILURE; + #endif /* !defined(NO_PWDBASED) */ if (pkey->type == EVP_PKEY_RSA) { From 9b421ce497277f95aee47e0ba409315aacb8586e Mon Sep 17 00:00:00 2001 From: Eric Blankenhorn Date: Wed, 22 Jul 2020 17:22:46 -0500 Subject: [PATCH 2/2] Fix for config failure --- src/ssl.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/ssl.c b/src/ssl.c index 48d3d48a1..47e5ddc8a 100644 --- a/src/ssl.c +++ b/src/ssl.c @@ -17402,7 +17402,10 @@ int wolfSSL_X509_get_isCA(WOLFSSL_X509* x509) return isCA; } +#endif /* KEEP_PEER_CERT || SESSION_CERTS || OPENSSL_EXTRA || + OPENSSL_EXTRA_X509_SMALL */ +#if defined(OPENSSL_EXTRA) || defined(OPENSSL_EXTRA_X509_SMALL) /* returns the number of entries in the WOLFSSL_X509_NAME */ int wolfSSL_X509_NAME_entry_count(WOLFSSL_X509_NAME* name) { @@ -17416,8 +17419,7 @@ int wolfSSL_X509_NAME_entry_count(WOLFSSL_X509_NAME* name) WOLFSSL_LEAVE("wolfSSL_X509_NAME_entry_count", count); return count; } -#endif /* KEEP_PEER_CERT || SESSION_CERTS || OPENSSL_EXTRA || - OPENSSL_EXTRA_X509_SMALL */ +#endif /* OPENSSL_EXTRA || OPENSSL_EXTRA_X509_SMALL */