fix #if conditions and others

This commit is contained in:
Takashi Kojo
2018-05-19 17:57:00 +09:00
parent 153bcb5297
commit 874022d938
6 changed files with 18 additions and 12 deletions

View File

@@ -490,7 +490,7 @@ int BufferLoadCRL(WOLFSSL_CRL* crl, const byte* buff, long sz, int type,
return ret ? ret : WOLFSSL_SUCCESS; /* convert 0 to WOLFSSL_SUCCESS */ return ret ? ret : WOLFSSL_SUCCESS; /* convert 0 to WOLFSSL_SUCCESS */
} }
#if defined(OPENSSL_EXTRA) || defined(HAVE_CRL) #if defined(OPENSSL_EXTRA) && defined(HAVE_CRL)
int wolfSSL_X509_STORE_add_crl(WOLFSSL_X509_STORE *store, WOLFSSL_X509_CRL *newcrl) int wolfSSL_X509_STORE_add_crl(WOLFSSL_X509_STORE *store, WOLFSSL_X509_CRL *newcrl)
{ {
CRL_Entry *crle; CRL_Entry *crle;

View File

@@ -17996,7 +17996,7 @@ int wolfSSL_X509_verify_cert(WOLFSSL_X509_STORE_CTX* ctx)
#ifndef NO_FILESYSTEM #ifndef NO_FILESYSTEM
static void *wolfSSL_d2i_X509_fp_ex(XFILE file, void **x509, int type) static void *wolfSSL_d2i_X509_fp_ex(XFILE file, void **x509, int type)
{ {
void *new = NULL; void *newx509 = NULL;
DerBuffer* der = NULL; DerBuffer* der = NULL;
byte *fileBuffer = NULL; byte *fileBuffer = NULL;
@@ -18023,13 +18023,13 @@ static void *wolfSSL_d2i_X509_fp_ex(XFILE file, void **x509, int type)
goto err_exit; goto err_exit;
} }
if(type == CERT_TYPE) if(type == CERT_TYPE)
new = (void *)wolfSSL_X509_d2i(NULL, fileBuffer, (int)sz); newx509 = (void *)wolfSSL_X509_d2i(NULL, fileBuffer, (int)sz);
#ifdef HAVE_CRL #ifdef HAVE_CRL
else if(type == CRL_TYPE) else if(type == CRL_TYPE)
new = (void *)wolfSSL_d2i_X509_CRL(NULL, fileBuffer, (int)sz); newx509 = (void *)wolfSSL_d2i_X509_CRL(NULL, fileBuffer, (int)sz);
#endif #endif
else goto err_exit; else goto err_exit;
if(new == NULL) if(newx509 == NULL)
{ {
WOLFSSL_MSG("X509 failed"); WOLFSSL_MSG("X509 failed");
goto err_exit; goto err_exit;
@@ -18037,18 +18037,18 @@ static void *wolfSSL_d2i_X509_fp_ex(XFILE file, void **x509, int type)
} }
} }
if (x509 != NULL) if (x509 != NULL)
*x509 = new; *x509 = newx509;
goto _exit; goto _exit;
err_exit: err_exit:
if(new != NULL){ if(newx509 != NULL){
if(type == CERT_TYPE) if(type == CERT_TYPE)
wolfSSL_X509_free(new); wolfSSL_X509_free((WOLFSSL_X509*)newx509);
#ifdef HAVE_CRL #ifdef HAVE_CRL
else { else {
if(type == CRL_TYPE) if(type == CRL_TYPE)
wolfSSL_X509_CRL_free(new); wolfSSL_X509_CRL_free((WOLFSSL_X509_CRL*)newx509);
} }
#endif #endif
} }
@@ -18057,7 +18057,7 @@ _exit:
FreeDer(&der); FreeDer(&der);
if(fileBuffer != NULL) if(fileBuffer != NULL)
XFREE(fileBuffer, NULL, DYNAMIC_TYPE_FILE); XFREE(fileBuffer, NULL, DYNAMIC_TYPE_FILE);
return new; return newx509;
} }
WOLFSSL_X509 *wolfSSL_d2i_X509_fp(XFILE fp, WOLFSSL_X509 **x509) WOLFSSL_X509 *wolfSSL_d2i_X509_fp(XFILE fp, WOLFSSL_X509 **x509)

View File

@@ -17753,7 +17753,7 @@ static void test_wolfSSL_SHA(void)
} }
#endif #endif
#if !defined(WOLFSSL_SHA512) #if defined(WOLFSSL_SHA512)
{ {
const unsigned char in[] = "abc"; const unsigned char in[] = "abc";
unsigned char expected[] = "\xdd\xaf\x35\xa1\x93\x61\x7a\xba\xcc\x41\x73\x49\xae\x20\x41" unsigned char expected[] = "\xdd\xaf\x35\xa1\x93\x61\x7a\xba\xcc\x41\x73\x49\xae\x20\x41"

View File

@@ -516,6 +516,8 @@ typedef WOLFSSL_X509_STORE_CTX X509_STORE_CTX;
#define d2i_X509_fp wolfSSL_d2i_X509_fp #define d2i_X509_fp wolfSSL_d2i_X509_fp
#define i2d_X509 wolfSSL_i2d_X509 #define i2d_X509 wolfSSL_i2d_X509
#define d2i_X509 wolfSSL_d2i_X509 #define d2i_X509 wolfSSL_d2i_X509
#define d2i_PKCS12_bio wolfSSL_d2i_PKCS12_bio
#define d2i_PKCS12_fp wolfSSL_d2i_PKCS12_fp
#define d2i_RSAPublicKey wolfSSL_d2i_RSAPublicKey #define d2i_RSAPublicKey wolfSSL_d2i_RSAPublicKey
#define i2d_RSAPublicKey wolfSSL_i2d_RSAPublicKey #define i2d_RSAPublicKey wolfSSL_i2d_RSAPublicKey
#define d2i_X509_CRL wolfSSL_d2i_X509_CRL #define d2i_X509_CRL wolfSSL_d2i_X509_CRL

View File

@@ -1554,6 +1554,10 @@ WOLFSSL_API int wolfSSL_connect_cert(WOLFSSL* ssl);
typedef struct WC_PKCS12 WC_PKCS12; typedef struct WC_PKCS12 WC_PKCS12;
WOLFSSL_API WC_PKCS12* wolfSSL_d2i_PKCS12_bio(WOLFSSL_BIO* bio, WOLFSSL_API WC_PKCS12* wolfSSL_d2i_PKCS12_bio(WOLFSSL_BIO* bio,
WC_PKCS12** pkcs12); WC_PKCS12** pkcs12);
#ifndef NO_FILESYSTEM
WOLFSSL_API WC_PKCS12* wolfSSL_d2i_PKCS12_fp(XFILE fp,
WC_PKCS12** pkcs12);
#endif
WOLFSSL_API int wolfSSL_PKCS12_parse(WC_PKCS12* pkcs12, const char* psw, WOLFSSL_API int wolfSSL_PKCS12_parse(WC_PKCS12* pkcs12, const char* psw,
WOLFSSL_EVP_PKEY** pkey, WOLFSSL_X509** cert, WOLFSSL_EVP_PKEY** pkey, WOLFSSL_X509** cert,
WOLF_STACK_OF(WOLFSSL_X509)** ca); WOLF_STACK_OF(WOLFSSL_X509)** ca);

View File

@@ -81,7 +81,7 @@
#define SHA256_NOINLINE #define SHA256_NOINLINE
#endif #endif
#if !defined(NO_OLD_SHA256_NAMES) || !defined(OPENSSL_EXTRA) #if !defined(NO_OLD_SHA256_NAMES)
#define SHA256 WC_SHA256 #define SHA256 WC_SHA256
#endif #endif