adjust compat. layer to not include wolfSSL headers where possible, add d2i for X509's, clang-3.3 build

This commit is contained in:
Jacob Barthelmeh 2017-01-21 14:02:09 -07:00
parent e213e60471
commit 704d765501
6 changed files with 29 additions and 20 deletions

View File

@ -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;

View File

@ -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 */

View File

@ -24,17 +24,17 @@
#define WOLFSSL_BUFFER_H_
#include <wolfssl/wolfcrypt/settings.h>
#include <wolfssl/wolfcrypt/error-crypt.h>
#include <wolfssl/openssl/ssl.h>
#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);

View File

@ -24,26 +24,12 @@
#define WOLFSSL_OBJECTS_H_
#include <wolfssl/wolfcrypt/settings.h>
#include <wolfssl/wolfcrypt/asn.h>
#include <wolfssl/openssl/ssl.h>
#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

View File

@ -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

View File

@ -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);