diff --git a/src/ssl.c b/src/ssl.c index 8cd25ee6f..27a2b5f8e 100644 --- a/src/ssl.c +++ b/src/ssl.c @@ -15109,6 +15109,14 @@ void wolfSSL_sk_X509_free(WOLF_STACK_OF(WOLFSSL_X509_NAME)* sk) { #endif /* NO_CERTS && OPENSSL_EXTRA */ + +WOLFSSL_X509* wolfSSL_d2i_X509(WOLFSSL_X509** x509, const unsigned char** in, + int len) +{ + return wolfSSL_X509_d2i(x509, *in, len); +} + + WOLFSSL_X509* wolfSSL_X509_d2i(WOLFSSL_X509** x509, const byte* in, int len) { WOLFSSL_X509 *newX509 = NULL; diff --git a/tests/api.c b/tests/api.c index fc0153ab7..c7c890646 100644 --- a/tests/api.c +++ b/tests/api.c @@ -14772,7 +14772,6 @@ static void test_wolfSSL_pseudo_rand(void) * int BN_pseudo_rand(BIGNUM* bn, int bits, int top, int bottom) */ for (i = 0; i < 10; i++) { AssertNotNull(bn = BN_new()); - XMEMSET(bn, 0, sizeof(bn)); AssertIntEQ(BN_pseudo_rand(bn, 8, 0, 0), SSL_SUCCESS); AssertIntGT(BN_bn2bin(bn, bin),0); AssertIntEQ((bin[0] & 0x80), 0x80); /* top bit should be set */ @@ -14781,7 +14780,6 @@ static void test_wolfSSL_pseudo_rand(void) for (i = 0; i < 10; i++) { AssertNotNull(bn = BN_new()); - XMEMSET(bn, 0, sizeof(bn)); AssertIntEQ(BN_pseudo_rand(bn, 8, 1, 1), SSL_SUCCESS); AssertIntGT(BN_bn2bin(bn, bin),0); AssertIntEQ((bin[0] & 0xc1), 0xc1); /* top bit should be set */ diff --git a/wolfssl/openssl/buffer.h b/wolfssl/openssl/buffer.h index 9cf5bc077..a3ca5e8d1 100644 --- a/wolfssl/openssl/buffer.h +++ b/wolfssl/openssl/buffer.h @@ -24,17 +24,17 @@ #define WOLFSSL_BUFFER_H_ #include -#include +#include #ifdef __cplusplus extern "C" { #endif -typedef struct WOLFSSL_BUF_MEM { +struct WOLFSSL_BUF_MEM { char* data; size_t length; /* current length */ size_t max; /* maximum length */ -} WOLFSSL_BUF_MEM; +}; WOLFSSL_API WOLFSSL_BUF_MEM* wolfSSL_BUF_MEM_new(void); diff --git a/wolfssl/openssl/objects.h b/wolfssl/openssl/objects.h index a6ffd5916..eb0d64122 100644 --- a/wolfssl/openssl/objects.h +++ b/wolfssl/openssl/objects.h @@ -24,26 +24,12 @@ #define WOLFSSL_OBJECTS_H_ #include -#include +#include #ifdef __cplusplus extern "C" { #endif - -WOLFSSL_API const char * wolfSSL_OBJ_nid2sn(int n); -WOLFSSL_API int wolfSSL_OBJ_obj2nid(const WOLFSSL_ASN1_OBJECT *o); -WOLFSSL_API int wolfSSL_OBJ_sn2nid(const char *sn); - -WOLFSSL_API char* wolfSSL_OBJ_nid2ln(int n); -WOLFSSL_API int wolfSSL_OBJ_txt2nid(const char *sn); - -WOLFSSL_API WOLFSSL_ASN1_OBJECT* wolfSSL_OBJ_nid2obj(int n); -WOLFSSL_API int wolfSSL_OBJ_obj2txt(char *buf, int buf_len, WOLFSSL_ASN1_OBJECT *a, int no_name); - -WOLFSSL_API void wolfSSL_OBJ_cleanup(void); - - #define OBJ_nid2sn wolfSSL_OBJ_nid2sn #define OBJ_obj2nid wolfSSL_OBJ_obj2nid #define OBJ_sn2nid wolfSSL_OBJ_sn2nid diff --git a/wolfssl/openssl/ssl.h b/wolfssl/openssl/ssl.h index e68250e4c..7996991a4 100644 --- a/wolfssl/openssl/ssl.h +++ b/wolfssl/openssl/ssl.h @@ -472,6 +472,7 @@ typedef WOLFSSL_X509_STORE_CTX X509_STORE_CTX; #define sk_X509_free wolfSSL_sk_X509_free #define i2d_X509_bio wolfSSL_i2d_X509_bio #define d2i_X509_bio wolfSSL_d2i_X509_bio +#define d2i_X509 wolfSSL_d2i_X509 #define SSL_CTX_get_ex_data wolfSSL_CTX_get_ex_data #define SSL_CTX_set_ex_data wolfSSL_CTX_set_ex_data diff --git a/wolfssl/ssl.h b/wolfssl/ssl.h index 6e1da80ab..a15ed608b 100644 --- a/wolfssl/ssl.h +++ b/wolfssl/ssl.h @@ -1399,6 +1399,8 @@ WOLFSSL_API int wolfSSL_cmp_peer_cert_to_file(WOLFSSL*, const char*); WOLFSSL_API char* wolfSSL_X509_get_next_altname(WOLFSSL_X509*); +WOLFSSL_API WOLFSSL_X509* wolfSSL_d2i_X509(WOLFSSL_X509** x509, + const unsigned char** in, int len); WOLFSSL_API WOLFSSL_X509* wolfSSL_X509_d2i(WOLFSSL_X509** x509, const unsigned char* in, int len); #ifndef NO_FILESYSTEM @@ -2331,6 +2333,20 @@ WOLFSSL_API char* wolfSSL_ASN1_TIME_to_string(WOLFSSL_ASN1_TIME* time, #ifdef OPENSSL_EXTRA +/* Object functions */ +WOLFSSL_API const char * wolfSSL_OBJ_nid2sn(int n); +WOLFSSL_API int wolfSSL_OBJ_obj2nid(const WOLFSSL_ASN1_OBJECT *o); +WOLFSSL_API int wolfSSL_OBJ_sn2nid(const char *sn); + +WOLFSSL_API char* wolfSSL_OBJ_nid2ln(int n); +WOLFSSL_API int wolfSSL_OBJ_txt2nid(const char *sn); + +WOLFSSL_API WOLFSSL_ASN1_OBJECT* wolfSSL_OBJ_nid2obj(int n); +WOLFSSL_API int wolfSSL_OBJ_obj2txt(char *buf, int buf_len, WOLFSSL_ASN1_OBJECT *a, int no_name); + +WOLFSSL_API void wolfSSL_OBJ_cleanup(void); +/* end of object functions */ + #ifndef NO_FILESYSTEM WOLFSSL_API long wolfSSL_BIO_set_fp(WOLFSSL_BIO *bio, XFILE fp, int c); WOLFSSL_API long wolfSSL_BIO_get_fp(WOLFSSL_BIO *bio, XFILE* fp);