Skip to content

Commit

Permalink
additional fixes and peer review for -DOPENSSL_EXTRA -DOPENSSL_COEXIS…
Browse files Browse the repository at this point in the history
…T: cover -DWOLFSSL_QUIC, fix -DNO_ASN, rename WOLFSSL_ASN1_TYPE_* to WOLFSSL_V_ASN1_*, completed nativization of NID_*, and switch to prefix WC_NID_ rather than wc_NID_.
  • Loading branch information
douzzer committed Oct 31, 2024
1 parent 2165c63 commit 2f96291
Show file tree
Hide file tree
Showing 23 changed files with 1,571 additions and 1,496 deletions.
14 changes: 5 additions & 9 deletions examples/echoclient/echoclient.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,15 @@
#include <wolfssl/options.h>
#endif

#undef TEST_OPENSSL_COEXIST /* can't use this option with this example */
#ifdef OPENSSL_EXTRA
#undef OPENSSL_COEXIST /* can't use this option with this example */
/* Force enable the compatibility macros for this example */
#undef TEST_OPENSSL_COEXIST
#undef OPENSSL_COEXIST
#ifndef OPENSSL_EXTRA_X509_SMALL
#define OPENSSL_EXTRA_X509_SMALL
#endif

/* let's use cyassl layer AND cyassl openssl layer */
#undef TEST_OPENSSL_COEXIST /* can't use this option with this example */
#include <wolfssl/ssl.h>

/* Force enable the compatibility macros for this example */
#ifdef WOLFSSL_DTLS
#include <wolfssl/error-ssl.h>
#endif
Expand All @@ -54,9 +53,6 @@

#include <wolfssl/test.h>

#ifndef OPENSSL_EXTRA_X509_SMALL
#define OPENSSL_EXTRA_X509_SMALL
#endif
#include <wolfssl/openssl/ssl.h>

#include <examples/echoclient/echoclient.h>
Expand Down
4 changes: 2 additions & 2 deletions src/bio.c
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ static int wolfSSL_BIO_SSL_read(WOLFSSL_BIO* bio, void* buf,

static int wolfSSL_BIO_MD_read(WOLFSSL_BIO* bio, void* buf, int sz)
{
if (wolfSSL_EVP_MD_CTX_type(bio->ptr.md_ctx) == wc_NID_hmac) {
if (wolfSSL_EVP_MD_CTX_type(bio->ptr.md_ctx) == WC_NID_hmac) {
if (wolfSSL_EVP_DigestSignUpdate(bio->ptr.md_ctx, buf,
(unsigned int)sz) != WOLFSSL_SUCCESS)
{
Expand Down Expand Up @@ -642,7 +642,7 @@ static int wolfSSL_BIO_MD_write(WOLFSSL_BIO* bio, const void* data, int len)
return BAD_FUNC_ARG;
}

if (wolfSSL_EVP_MD_CTX_type(bio->ptr.md_ctx) == wc_NID_hmac) {
if (wolfSSL_EVP_MD_CTX_type(bio->ptr.md_ctx) == WC_NID_hmac) {
if (wolfSSL_EVP_DigestSignUpdate(bio->ptr.md_ctx, data,
(unsigned int)len) != WOLFSSL_SUCCESS) {
ret = WOLFSSL_BIO_ERROR;
Expand Down
16 changes: 8 additions & 8 deletions src/internal.c
Original file line number Diff line number Diff line change
Expand Up @@ -12917,7 +12917,7 @@ static int CopyREQAttributes(WOLFSSL_X509* x509, DecodedCert* dCert)
x509->challengePw[dCert->cPwdLen] = '\0';
#if defined(OPENSSL_ALL) && defined(WOLFSSL_CERT_GEN)
if (wolfSSL_X509_REQ_add1_attr_by_NID(x509,
NID_pkcs9_challengePassword,
WC_NID_pkcs9_challengePassword,
MBSTRING_ASC,
(const byte*)dCert->cPwd,
dCert->cPwdLen) != WOLFSSL_SUCCESS) {
Expand All @@ -12939,7 +12939,7 @@ static int CopyREQAttributes(WOLFSSL_X509* x509, DecodedCert* dCert)
}
#if defined(OPENSSL_ALL) && defined(WOLFSSL_CERT_GEN)
if (wolfSSL_X509_REQ_add1_attr_by_NID(x509,
NID_pkcs9_contentType,
WC_NID_pkcs9_contentType,
MBSTRING_ASC,
(const byte*)dCert->contentType,
dCert->contentTypeLen) !=
Expand All @@ -12953,7 +12953,7 @@ static int CopyREQAttributes(WOLFSSL_X509* x509, DecodedCert* dCert)
#if defined(OPENSSL_ALL) && defined(WOLFSSL_CERT_GEN)
if (dCert->sNum) {
if (wolfSSL_X509_REQ_add1_attr_by_NID(x509,
NID_serialNumber,
WC_NID_serialNumber,
MBSTRING_ASC,
(const byte*)dCert->sNum,
dCert->sNumLen) != WOLFSSL_SUCCESS) {
Expand All @@ -12963,7 +12963,7 @@ static int CopyREQAttributes(WOLFSSL_X509* x509, DecodedCert* dCert)
}
if (dCert->unstructuredName) {
if (wolfSSL_X509_REQ_add1_attr_by_NID(x509,
NID_pkcs9_unstructuredName,
WC_NID_pkcs9_unstructuredName,
MBSTRING_ASC,
(const byte*)dCert->unstructuredName,
dCert->unstructuredNameLen)
Expand All @@ -12974,7 +12974,7 @@ static int CopyREQAttributes(WOLFSSL_X509* x509, DecodedCert* dCert)
}
if (dCert->surname) {
if (wolfSSL_X509_REQ_add1_attr_by_NID(x509,
NID_surname,
WC_NID_surname,
MBSTRING_ASC,
(const byte*)dCert->surname,
dCert->surnameLen) != WOLFSSL_SUCCESS) {
Expand All @@ -12984,7 +12984,7 @@ static int CopyREQAttributes(WOLFSSL_X509* x509, DecodedCert* dCert)
}
if (dCert->givenName) {
if (wolfSSL_X509_REQ_add1_attr_by_NID(x509,
NID_givenName,
WC_NID_givenName,
MBSTRING_ASC,
(const byte*)dCert->givenName,
dCert->givenNameLen) != WOLFSSL_SUCCESS) {
Expand All @@ -12994,7 +12994,7 @@ static int CopyREQAttributes(WOLFSSL_X509* x509, DecodedCert* dCert)
}
if (dCert->dnQualifier) {
if (wolfSSL_X509_REQ_add1_attr_by_NID(x509,
NID_dnQualifier,
WC_NID_dnQualifier,
MBSTRING_ASC,
(const byte*)dCert->dnQualifier,
dCert->dnQualifierLen) != WOLFSSL_SUCCESS) {
Expand All @@ -13004,7 +13004,7 @@ static int CopyREQAttributes(WOLFSSL_X509* x509, DecodedCert* dCert)
}
if (dCert->initials) {
if (wolfSSL_X509_REQ_add1_attr_by_NID(x509,
NID_initials,
WC_NID_initials,
MBSTRING_ASC,
(const byte*)dCert->initials,
dCert->initialsLen) != WOLFSSL_SUCCESS) {
Expand Down
Loading

0 comments on commit 2f96291

Please sign in to comment.