mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-07-30 10:47:28 +02:00
Fix building NO_ASN_TIME with cert gen and OpenSSL Extra enabled.
This commit is contained in:
19
tests/api.c
19
tests/api.c
@ -10502,7 +10502,8 @@ static int test_wolfSSL_X509_verify(void)
|
|||||||
#if !defined(NO_FILESYSTEM) && !defined(NO_CERTS) && !defined(NO_RSA) && \
|
#if !defined(NO_FILESYSTEM) && !defined(NO_CERTS) && !defined(NO_RSA) && \
|
||||||
!defined(NO_WOLFSSL_CLIENT) && !defined(NO_DH) && !defined(NO_AES) && \
|
!defined(NO_WOLFSSL_CLIENT) && !defined(NO_DH) && !defined(NO_AES) && \
|
||||||
defined(HAVE_IO_TESTS_DEPENDENCIES) && !defined(SINGLE_THREADED) && \
|
defined(HAVE_IO_TESTS_DEPENDENCIES) && !defined(SINGLE_THREADED) && \
|
||||||
defined(OPENSSL_EXTRA) && defined(WOLFSSL_CERT_GEN) && !defined(NO_BIO)
|
defined(OPENSSL_EXTRA) && defined(WOLFSSL_CERT_GEN) && !defined(NO_BIO) \
|
||||||
|
&& !defined(NO_ASN_TIME)
|
||||||
/* create certificate with version 2 */
|
/* create certificate with version 2 */
|
||||||
static void test_set_x509_badversion(WOLFSSL_CTX* ctx)
|
static void test_set_x509_badversion(WOLFSSL_CTX* ctx)
|
||||||
{
|
{
|
||||||
@ -10591,7 +10592,8 @@ static int test_wolfSSL_X509_TLS_version(void)
|
|||||||
#if !defined(NO_FILESYSTEM) && !defined(NO_CERTS) && !defined(NO_RSA) && \
|
#if !defined(NO_FILESYSTEM) && !defined(NO_CERTS) && !defined(NO_RSA) && \
|
||||||
!defined(NO_WOLFSSL_CLIENT) && !defined(NO_DH) && !defined(NO_AES) && \
|
!defined(NO_WOLFSSL_CLIENT) && !defined(NO_DH) && !defined(NO_AES) && \
|
||||||
defined(HAVE_IO_TESTS_DEPENDENCIES) && !defined(SINGLE_THREADED) && \
|
defined(HAVE_IO_TESTS_DEPENDENCIES) && !defined(SINGLE_THREADED) && \
|
||||||
defined(OPENSSL_EXTRA) && defined(WOLFSSL_CERT_GEN) && !defined(NO_BIO)
|
defined(OPENSSL_EXTRA) && defined(WOLFSSL_CERT_GEN) && !defined(NO_BIO) \
|
||||||
|
&& !defined(NO_ASN_TIME)
|
||||||
tcp_ready ready;
|
tcp_ready ready;
|
||||||
func_args server_args;
|
func_args server_args;
|
||||||
func_args client_args;
|
func_args client_args;
|
||||||
@ -37917,8 +37919,8 @@ static int test_wolfSSL_ASN1_TIME_adj(void)
|
|||||||
static int test_wolfSSL_ASN1_TIME_to_tm(void)
|
static int test_wolfSSL_ASN1_TIME_to_tm(void)
|
||||||
{
|
{
|
||||||
int res = TEST_SKIPPED;
|
int res = TEST_SKIPPED;
|
||||||
#if defined(WOLFSSL_MYSQL_COMPATIBLE) || defined(WOLFSSL_NGINX) || \
|
#if (defined(WOLFSSL_MYSQL_COMPATIBLE) || defined(WOLFSSL_NGINX) || \
|
||||||
defined(WOLFSSL_HAPROXY) || defined(OPENSSL_EXTRA) || defined(OPENSSL_ALL) \
|
defined(WOLFSSL_HAPROXY) || defined(OPENSSL_EXTRA) || defined(OPENSSL_ALL)) \
|
||||||
&& !defined(NO_ASN_TIME)
|
&& !defined(NO_ASN_TIME)
|
||||||
ASN1_TIME asnTime;
|
ASN1_TIME asnTime;
|
||||||
struct tm tm;
|
struct tm tm;
|
||||||
@ -38118,14 +38120,16 @@ static int test_wolfSSL_X509_sign2(void)
|
|||||||
const unsigned char *pt;
|
const unsigned char *pt;
|
||||||
WOLFSSL_EVP_PKEY *priv;
|
WOLFSSL_EVP_PKEY *priv;
|
||||||
WOLFSSL_X509_NAME *name;
|
WOLFSSL_X509_NAME *name;
|
||||||
WOLFSSL_ASN1_TIME *notBefore, *notAfter;
|
|
||||||
int derSz;
|
int derSz;
|
||||||
|
#ifndef NO_ASN_TIME
|
||||||
|
WOLFSSL_ASN1_TIME *notBefore, *notAfter;
|
||||||
|
|
||||||
const int year = 365*24*60*60;
|
const int year = 365*24*60*60;
|
||||||
const int day = 24*60*60;
|
const int day = 24*60*60;
|
||||||
const int hour = 60*60;
|
const int hour = 60*60;
|
||||||
const int mini = 60;
|
const int mini = 60;
|
||||||
time_t t;
|
time_t t;
|
||||||
|
#endif
|
||||||
|
|
||||||
const unsigned char expected[] = {
|
const unsigned char expected[] = {
|
||||||
0x30, 0x82, 0x05, 0x13, 0x30, 0x82, 0x03, 0xFB, 0xA0, 0x03, 0x02, 0x01,
|
0x30, 0x82, 0x05, 0x13, 0x30, 0x82, 0x03, 0xFB, 0xA0, 0x03, 0x02, 0x01,
|
||||||
@ -38252,6 +38256,7 @@ static int test_wolfSSL_X509_sign2(void)
|
|||||||
AssertNotNull(name = wolfSSL_X509_get_subject_name(ca));
|
AssertNotNull(name = wolfSSL_X509_get_subject_name(ca));
|
||||||
AssertIntEQ(wolfSSL_X509_set_issuer_name(x509, name), WOLFSSL_SUCCESS);
|
AssertIntEQ(wolfSSL_X509_set_issuer_name(x509, name), WOLFSSL_SUCCESS);
|
||||||
|
|
||||||
|
#ifndef NO_ASN_TIME
|
||||||
t = (time_t)30 * year + 45 * day + 20 * hour + 30 * mini + 7 * day;
|
t = (time_t)30 * year + 45 * day + 20 * hour + 30 * mini + 7 * day;
|
||||||
AssertNotNull(notBefore = wolfSSL_ASN1_TIME_adj(NULL, t, 0, 0));
|
AssertNotNull(notBefore = wolfSSL_ASN1_TIME_adj(NULL, t, 0, 0));
|
||||||
AssertNotNull(notAfter = wolfSSL_ASN1_TIME_adj(NULL, t, 365, 0));
|
AssertNotNull(notAfter = wolfSSL_ASN1_TIME_adj(NULL, t, 365, 0));
|
||||||
@ -38259,6 +38264,7 @@ static int test_wolfSSL_X509_sign2(void)
|
|||||||
|
|
||||||
AssertTrue(wolfSSL_X509_set_notBefore(x509, notBefore));
|
AssertTrue(wolfSSL_X509_set_notBefore(x509, notBefore));
|
||||||
AssertTrue(wolfSSL_X509_set_notAfter(x509, notAfter));
|
AssertTrue(wolfSSL_X509_set_notAfter(x509, notAfter));
|
||||||
|
#endif
|
||||||
|
|
||||||
wolfSSL_X509_sign(x509, priv, EVP_sha256());
|
wolfSSL_X509_sign(x509, priv, EVP_sha256());
|
||||||
AssertNotNull((der = wolfSSL_X509_get_der(x509, &derSz)));
|
AssertNotNull((der = wolfSSL_X509_get_der(x509, &derSz)));
|
||||||
@ -53699,6 +53705,9 @@ static int test_wolfSSL_X509_print(void)
|
|||||||
/* Will print IP address subject alt name. */
|
/* Will print IP address subject alt name. */
|
||||||
AssertIntEQ(BIO_get_mem_data(bio, NULL), 3350);
|
AssertIntEQ(BIO_get_mem_data(bio, NULL), 3350);
|
||||||
#endif
|
#endif
|
||||||
|
#elif defined(NO_ASN_TIME)
|
||||||
|
/* With NO_ASN_TIME defined, X509_print skips printing Validity. */
|
||||||
|
AssertIntEQ(BIO_get_mem_data(bio, NULL), 3213);
|
||||||
#else
|
#else
|
||||||
AssertIntEQ(BIO_get_mem_data(bio, NULL), 3328);
|
AssertIntEQ(BIO_get_mem_data(bio, NULL), 3328);
|
||||||
#endif
|
#endif
|
||||||
|
@ -13166,13 +13166,15 @@ WOLFSSL_TEST_SUBROUTINE int memory_test(void)
|
|||||||
#ifndef NO_RSA
|
#ifndef NO_RSA
|
||||||
static const char* eccKeyPubFileDer = CERT_ROOT "ecc-keyPub.der";
|
static const char* eccKeyPubFileDer = CERT_ROOT "ecc-keyPub.der";
|
||||||
#endif
|
#endif
|
||||||
static const char* eccCaKeyFile = CERT_ROOT "ca-ecc-key.der";
|
#ifndef NO_ASN_TIME
|
||||||
static const char* eccCaCertFile = CERT_ROOT "ca-ecc-cert.pem";
|
static const char* eccCaKeyFile = CERT_ROOT "ca-ecc-key.der";
|
||||||
#ifdef ENABLE_ECC384_CERT_GEN_TEST
|
static const char* eccCaCertFile = CERT_ROOT "ca-ecc-cert.pem";
|
||||||
static const char* eccCaKey384File =
|
#ifdef ENABLE_ECC384_CERT_GEN_TEST
|
||||||
CERT_ROOT "ca-ecc384-key.der";
|
static const char* eccCaKey384File =
|
||||||
static const char* eccCaCert384File =
|
CERT_ROOT "ca-ecc384-key.der";
|
||||||
CERT_ROOT "ca-ecc384-cert.pem";
|
static const char* eccCaCert384File =
|
||||||
|
CERT_ROOT "ca-ecc384-cert.pem";
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#if defined(HAVE_PKCS7) && defined(HAVE_ECC)
|
#if defined(HAVE_PKCS7) && defined(HAVE_ECC)
|
||||||
@ -13209,7 +13211,7 @@ WOLFSSL_TEST_SUBROUTINE int memory_test(void)
|
|||||||
|
|
||||||
#ifndef NO_WRITE_TEMP_FILES
|
#ifndef NO_WRITE_TEMP_FILES
|
||||||
#ifdef HAVE_ECC
|
#ifdef HAVE_ECC
|
||||||
#ifdef WOLFSSL_CERT_GEN
|
#if defined(WOLFSSL_CERT_GEN) && !defined(NO_ASN_TIME)
|
||||||
static const char* certEccPemFile = CERT_WRITE_TEMP_DIR "certecc.pem";
|
static const char* certEccPemFile = CERT_WRITE_TEMP_DIR "certecc.pem";
|
||||||
static const char* certEccDerFile = CERT_WRITE_TEMP_DIR "certecc.der";
|
static const char* certEccDerFile = CERT_WRITE_TEMP_DIR "certecc.der";
|
||||||
#endif
|
#endif
|
||||||
@ -13230,7 +13232,7 @@ WOLFSSL_TEST_SUBROUTINE int memory_test(void)
|
|||||||
#endif /* HAVE_ECC */
|
#endif /* HAVE_ECC */
|
||||||
|
|
||||||
#ifndef NO_RSA
|
#ifndef NO_RSA
|
||||||
#ifdef WOLFSSL_CERT_GEN
|
#if defined(WOLFSSL_CERT_GEN) && !defined(NO_ASN_TIME)
|
||||||
static const char* otherCertDerFile = CERT_WRITE_TEMP_DIR "othercert.der";
|
static const char* otherCertDerFile = CERT_WRITE_TEMP_DIR "othercert.der";
|
||||||
static const char* certDerFile = CERT_WRITE_TEMP_DIR "cert.der";
|
static const char* certDerFile = CERT_WRITE_TEMP_DIR "cert.der";
|
||||||
static const char* otherCertPemFile = CERT_WRITE_TEMP_DIR "othercert.pem";
|
static const char* otherCertPemFile = CERT_WRITE_TEMP_DIR "othercert.pem";
|
||||||
@ -15320,7 +15322,7 @@ exit_rsa_even_mod:
|
|||||||
}
|
}
|
||||||
#endif /* WOLFSSL_HAVE_SP_RSA */
|
#endif /* WOLFSSL_HAVE_SP_RSA */
|
||||||
|
|
||||||
#ifdef WOLFSSL_CERT_GEN
|
#if defined(WOLFSSL_CERT_GEN) && !defined(NO_ASN_TIME)
|
||||||
static int rsa_certgen_test(RsaKey* key, RsaKey* keypub, WC_RNG* rng, byte* tmp)
|
static int rsa_certgen_test(RsaKey* key, RsaKey* keypub, WC_RNG* rng, byte* tmp)
|
||||||
{
|
{
|
||||||
#if defined(WOLFSSL_SMALL_STACK) && !defined(WOLFSSL_NO_MALLOC)
|
#if defined(WOLFSSL_SMALL_STACK) && !defined(WOLFSSL_NO_MALLOC)
|
||||||
@ -16805,7 +16807,7 @@ WOLFSSL_TEST_SUBROUTINE int rsa_test(void)
|
|||||||
goto exit_rsa;
|
goto exit_rsa;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef WOLFSSL_CERT_GEN
|
#if defined(WOLFSSL_CERT_GEN) && !defined(NO_ASN_TIME)
|
||||||
/* Make Cert / Sign example for RSA cert and RSA CA */
|
/* Make Cert / Sign example for RSA cert and RSA CA */
|
||||||
ret = rsa_certgen_test(key, keypub, &rng, tmp);
|
ret = rsa_certgen_test(key, keypub, &rng, tmp);
|
||||||
if (ret != 0)
|
if (ret != 0)
|
||||||
@ -25624,7 +25626,7 @@ static int ecc_test_custom_curves(WC_RNG* rng)
|
|||||||
}
|
}
|
||||||
#endif /* WOLFSSL_CUSTOM_CURVES */
|
#endif /* WOLFSSL_CUSTOM_CURVES */
|
||||||
|
|
||||||
#ifdef WOLFSSL_CERT_GEN
|
#if defined(WOLFSSL_CERT_GEN) && !defined(NO_ASN_TIME)
|
||||||
|
|
||||||
/* Make Cert / Sign example for ECC cert and ECC CA */
|
/* Make Cert / Sign example for ECC cert and ECC CA */
|
||||||
static int ecc_test_cert_gen(WC_RNG* rng)
|
static int ecc_test_cert_gen(WC_RNG* rng)
|
||||||
@ -26515,7 +26517,7 @@ WOLFSSL_TEST_SUBROUTINE int ecc_test(void)
|
|||||||
#elif defined(HAVE_ECC_KEY_IMPORT)
|
#elif defined(HAVE_ECC_KEY_IMPORT)
|
||||||
(void)ecc_test_make_pub; /* for compiler warning */
|
(void)ecc_test_make_pub; /* for compiler warning */
|
||||||
#endif
|
#endif
|
||||||
#ifdef WOLFSSL_CERT_GEN
|
#if defined(WOLFSSL_CERT_GEN) && !defined(NO_ASN_TIME)
|
||||||
ret = ecc_test_cert_gen(&rng);
|
ret = ecc_test_cert_gen(&rng);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
printf("ecc_test_cert_gen failed!: %d\n", ret);
|
printf("ecc_test_cert_gen failed!: %d\n", ret);
|
||||||
|
@ -823,17 +823,19 @@ wolfSSL_X509_STORE_set_verify_cb((WOLFSSL_X509_STORE *)(s), (WOLFSSL_X509_STORE_
|
|||||||
|
|
||||||
#define sk_ASN1_OBJECT_free wolfSSL_sk_ASN1_OBJECT_free
|
#define sk_ASN1_OBJECT_free wolfSSL_sk_ASN1_OBJECT_free
|
||||||
|
|
||||||
|
#ifndef NO_ASN_TIME
|
||||||
#define ASN1_TIME_new wolfSSL_ASN1_TIME_new
|
#define ASN1_TIME_new wolfSSL_ASN1_TIME_new
|
||||||
#define ASN1_UTCTIME_new wolfSSL_ASN1_TIME_new
|
#define ASN1_UTCTIME_new wolfSSL_ASN1_TIME_new
|
||||||
#define ASN1_TIME_free wolfSSL_ASN1_TIME_free
|
#define ASN1_TIME_free wolfSSL_ASN1_TIME_free
|
||||||
#define ASN1_UTCTIME_free wolfSSL_ASN1_TIME_free
|
#define ASN1_UTCTIME_free wolfSSL_ASN1_TIME_free
|
||||||
#define ASN1_TIME_adj wolfSSL_ASN1_TIME_adj
|
#define ASN1_TIME_adj wolfSSL_ASN1_TIME_adj
|
||||||
#define ASN1_TIME_print wolfSSL_ASN1_TIME_print
|
#define ASN1_TIME_print wolfSSL_ASN1_TIME_print
|
||||||
#define ASN1_TIME_to_generalizedtime wolfSSL_ASN1_TIME_to_generalizedtime
|
|
||||||
#define ASN1_TIME_set wolfSSL_ASN1_TIME_set
|
|
||||||
#define ASN1_TIME_set_string wolfSSL_ASN1_TIME_set_string
|
|
||||||
#define ASN1_TIME_to_string wolfSSL_ASN1_TIME_to_string
|
#define ASN1_TIME_to_string wolfSSL_ASN1_TIME_to_string
|
||||||
#define ASN1_TIME_to_tm wolfSSL_ASN1_TIME_to_tm
|
#define ASN1_TIME_to_tm wolfSSL_ASN1_TIME_to_tm
|
||||||
|
#define ASN1_TIME_to_generalizedtime wolfSSL_ASN1_TIME_to_generalizedtime
|
||||||
|
#endif
|
||||||
|
#define ASN1_TIME_set wolfSSL_ASN1_TIME_set
|
||||||
|
#define ASN1_TIME_set_string wolfSSL_ASN1_TIME_set_string
|
||||||
#define ASN1_GENERALIZEDTIME_print wolfSSL_ASN1_GENERALIZEDTIME_print
|
#define ASN1_GENERALIZEDTIME_print wolfSSL_ASN1_GENERALIZEDTIME_print
|
||||||
#define ASN1_GENERALIZEDTIME_free wolfSSL_ASN1_GENERALIZEDTIME_free
|
#define ASN1_GENERALIZEDTIME_free wolfSSL_ASN1_GENERALIZEDTIME_free
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user