Add all stubs.

This commit is contained in:
Go Hosohara 2018-05-07 19:27:43 +09:00
parent 36ced360cb
commit b1ef0c808e
4 changed files with 171 additions and 6 deletions

135
src/ssl.c
View File

@ -14364,7 +14364,15 @@ WOLFSSL_X509* wolfSSL_X509_d2i(WOLFSSL_X509** x509, const byte* in, int len)
return newX509;
}
#ifndef NO_WOLFSSL_STUB
WOLFSSL_X509* wolfSSL_d2i_X509_fp(FILE *fp, WOLFSSL_X509 **x509)
{
WOLFSSL_STUB("d2i_X509_fp");
(void)fp;
(void)x509;
return 0;
}
#endif
#endif /* KEEP_PEER_CERT || SESSION_CERTS || OPENSSL_EXTRA ||
OPENSSL_EXTRA_X509_SMALL */
@ -21582,6 +21590,7 @@ int wolfSSL_RAND_bytes(unsigned char* buf, int num)
}
#define RAND_ENTROPY_SZ (256/16)
int wolfSSL_RAND_poll()
{
WOLFSSL_ENTER("wolfSSL_RAND_poll");
@ -32619,3 +32628,127 @@ int wolfSSL_CTX_set_alpn_protos(WOLFSSL_CTX *ctx, const unsigned char *p,
#endif
#endif /* WOLFCRYPT_ONLY */
#if defined(OPENSSL_EXTRA)
#ifndef NO_WOLFSSL_STUB
int wolfSSL_X509_check_ca(WOLFSSL_X509 *x509)
{
WOLFSSL_STUB("X509_check_ca");
(void)x509;
return 0;
}
int wolfSSL_d2i_PKCS12_fp(FILE *fp, WC_PKCS12 *pkcs12)
{
WOLFSSL_STUB("d2i_PKCS12_fp");
(void)fp;
(void)pkcs12;
return 0;
}
const char *wolfSSL_ASN1_tag2str(int tag){
static const char *const tag_label[] = {
"EOC", "BOOLEAN", "INTEGER", "BIT STRING", "OCTET STRING", "NULL",
"OBJECT", "OBJECT DESCRIPTOR", "EXTERNAL", "REAL", "ENUMRATED",
"<ASN1 11>", "UTF8STRING", "<ASN1 13>", "<ASN1 14>", "<ASN1 15>",
"SEQUENCE", "SET", "NUMERICSTRING", "PRINTABLESTRING", "T61STRING",
"VIDEOTEXTSTRING", "IA5STRING", "TUCTIME", "GENERALIZEDTIME",
"GRAPHICSTRING", "VISIBLESTRING", "GENERALSTRING", "UNIVERSALSTRING",
"<ASN1 29>", "BMPSTRINT"
};
if ((tag == V_ASN1_NEG_INTEGER) || (tag == V_ASN1_NEG_ENUMERATED))
tag &= ~0x100;
if (tag < 0 || tag > 30)
return "(unknown)";
return tag_label[tag];
}
int wolfSSL_ASN1_STRING_print_ex(WOLFSSL_BIO *out, WOLFSSL_ASN1_STRING *str,
unsigned long flags)
{
WOLFSSL_STUB("ASN1_STRING_PRINT_ex");
int strLen = 0;
unsigned char *strBuf = NULL;
if (out == NULL || str == NULL)
return WOLFSSL_FAILURE;
if (flags & ASN1_STRFLGS_SHOW_TYPE){
const char *tag = wolfSSL_ASN1_tag2str(str->type);
strLen += XSTRLEN(tag);
strBuf = (unsigned char *)XMALLOC(strLen + 1, NULL, DYNAMIC_TYPE_TMP_BUFFER);
if (strBuf == NULL){
WOLFSSL_MSG("memory alloc failed.");
return WOLFSSL_FAILURE;
}
XMEMSET(strBuf, 0, strLen + 1);
XSNPRINTF((char*)strBuf, strLen + 1, "%s:", tag);
if (wolfSSL_BIO_write(out, strBuf, strLen) <= 0){
XFREE(strBuf, NULL, DYNAMIC_TYPE_TMP_BUFFER);
return WOLFSSL_FAILURE;
}
strLen++;
XFREE(strBuf, NULL, DYNAMIC_TYPE_TMP_BUFFER);
}
if (flags & ASN1_STRFLGS_DUMP_ALL){
if (!(flags & ASN1_STRFLGS_DUMP_DER)){
static const char hexChar[] = { '0', '1', '2', '3', '4', '5', '6',
'7','8', '9', 'a', 'b', 'c', 'd',
'e', 'f' };
char hextmp[2];
char *strPtr, *strEnd;
strPtr = str->data;
strEnd = str->data + str->length;
while (strPtr != strEnd){
hextmp[0] = hexChar[*strPtr >> 4];
hextmp[1] = hexChar[*strPtr & 0xf];
if (wolfSSL_BIO_write(out, hextmp, 2) <= 0){
return WOLFSSL_FAILURE;
}
strPtr++;
strLen += 2;
}
return strLen;
}
/* ASN1_STRFLGS_DUMP_DER */
wolfSSL_BIO_write(out, str->data, str->length);
strLen += str->length;
return strLen;
}
if (flags & ASN1_STRFLGS_UTF8_CONVERT){
/* Not implemented yet */
}
return 0;
}
WOLFSSL_ASN1_TIME *wolfSSL_ASN1_TIME_to_generalizedtime(WOLFSSL_ASN1_TIME *t,
WOLFSSL_ASN1_TIME **out)
{
WOLFSSL_STUB("ASN1_TIME_to_generalizedtime");
(void)t;
(void)out;
return 0;
}
int wolfSSL_i2c_ASN1_INTEGER(WOLFSSL_ASN1_INTEGER **a, unsigned char **pp)
{
WOLFSSL_STUB("i2c_ASN1_INTEGER");
(void)a;
(void)pp;
return 0;
}
int wolfSSL_X509_STORE_add_crl(WOLFSSL_X509_STORE *ctx, WOLFSSL_X509_CRL *x)
{
(void)ctx;
(void)x;
return 0;
}
#endif
#endif

View File

@ -31,5 +31,26 @@
#define ASN1_STRING_set wolfSSL_ASN1_STRING_set
#define ASN1_STRING_free wolfSSL_ASN1_STRING_free
#define V_ASN1_OCTET_STRING 0x04 /* tag for ASN1_OCTET_STRING */
#endif /* WOLFSSL_ASN1_H_ */
#define V_ASN1_OCTET_STRING 0x04 /* tag for ASN1_OCTET_STRING */
#define V_ASN1_NEG 0x100
#define V_ASN1_NEG_INTEGER (2 | V_ASN1_NEG)
#define V_ASN1_NEG_ENUMERATED (10 | V_ASN1_NEG)
/* Type for ASN1_print_ex */
# define ASN1_STRFLGS_ESC_2253 1
# define ASN1_STRFLGS_ESC_CTRL 2
# define ASN1_STRFLGS_ESC_MSB 4
# define ASN1_STRFLGS_ESC_QUOTE 8
# define ASN1_STRFLGS_UTF8_CONVERT 0x10
# define ASN1_STRFLGS_IGNORE_TYPE 0x20
# define ASN1_STRFLGS_SHOW_TYPE 0x40
# define ASN1_STRFLGS_DUMP_ALL 0x80
# define ASN1_STRFLGS_DUMP_UNKNOWN 0x100
# define ASN1_STRFLGS_DUMP_DER 0x200
# define ASN1_STRFLGS_RFC2253 (ASN1_STRFLGS_ESC_2253 | \
ASN1_STRFLGS_ESC_CTRL | \
ASN1_STRFLGS_ESC_MSB | \
ASN1_STRFLGS_UTF8_CONVERT | \
ASN1_STRFLGS_DUMP_UNKNOWN | \
ASN1_STRFLGS_DUMP_DER)
#endif /* WOLFSSL_ASN1_H_ */

View File

@ -128,6 +128,7 @@ typedef WOLFSSL_X509_STORE_CTX X509_STORE_CTX;
#define SSL_use_certificate_ASN1 wolfSSL_use_certificate_ASN1
#define d2i_PKCS8_PRIV_KEY_INFO_bio wolfSSL_d2i_PKCS8_PKEY_bio
#define PKCS8_PRIV_KEY_INFO_free wolfSSL_EVP_PKEY_free
#define d2i_PKCS12_fp wolfSSL_d2i_PKCS12_fp
#define d2i_PUBKEY_bio wolfSSL_d2i_PUBKEY_bio
#define d2i_PrivateKey wolfSSL_d2i_PrivateKey
@ -383,6 +384,7 @@ typedef WOLFSSL_X509_STORE_CTX X509_STORE_CTX;
#define ASN1_TIME_adj wolfSSL_ASN1_TIME_adj
#define ASN1_GENERALIZEDTIME_free wolfSSL_ASN1_GENERALIZEDTIME_free
#define ASN1_STRING_print_ex wolfSSL_ASN1_STRING_print_ex
#define ASN1_tag2str wolfSSL_ASN1_tag2str
#define ASN1_TIME_to_generalizedtime wolfSSL_ASN1_TIME_to_generalizedtime
#define ASN1_INTEGER_new wolfSSL_ASN1_INTEGER_new
@ -586,8 +588,7 @@ typedef WOLFSSL_X509_STORE_CTX X509_STORE_CTX;
#define X509_check_private_key wolfSSL_X509_check_private_key
#define SSL_dup_CA_list wolfSSL_dup_CA_list
#define X509_check_ca wolfSSL_X509_check_ca
/* NIDs */
@ -894,6 +895,7 @@ typedef WOLFSSL_ASN1_BIT_STRING ASN1_BIT_STRING;
#define SSL_get0_session wolfSSL_SSL_get0_session
#define X509_check_host wolfSSL_X509_check_host
#define i2a_ASN1_INTEGER wolfSSL_i2a_ASN1_INTEGER
#define i2c_ASN1_INTEGER wolfSSL_i2a_ASN1_INTEGER
#define ERR_peek_error_line_data wolfSSL_ERR_peek_error_line_data
#define ERR_load_BIO_strings wolfSSL_ERR_load_BIO_strings
#define SSL_CTX_set_tlsext_ticket_key_cb wolfSSL_CTX_set_tlsext_ticket_key_cb
@ -922,7 +924,7 @@ typedef WOLFSSL_ASN1_BIT_STRING ASN1_BIT_STRING;
#define SSL_CTX_add_client_CA wolfSSL_CTX_add_client_CA
#define SSL_CTX_set_srp_password wolfSSL_CTX_set_srp_password
#define SSL_CTX_set_srp_username wolfSSL_CTX_set_srp_username
#define OPENSSL_add_algorithms_noconf wolfSSL_OPENSSL_add_alogrithms_noconf
#define OPENSSL_add_all_algorithms_noconf wolfSSL_OPENSSL_add_all_alogrithms_noconf
#ifdef __cplusplus
} /* extern "C" */

View File

@ -1528,6 +1528,7 @@ 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);
WOLFSSL_API WOLFSSL_X509* wolfSSL_d2i_X509_fp(FILE *fp, WOLFSSL_X509 **x509);
WOLFSSL_API int wolfSSL_i2d_X509(WOLFSSL_X509* x509, unsigned char** out);
WOLFSSL_API WOLFSSL_X509_CRL *wolfSSL_d2i_X509_CRL(WOLFSSL_X509_CRL **crl,
const unsigned char *in, int len);
@ -2609,6 +2610,7 @@ WOLFSSL_API unsigned char *wolfSSL_SHA384(const unsigned char *d, size_t n, unsi
WOLFSSL_API unsigned char *wolfSSL_SHA512(const unsigned char *d, size_t n, unsigned char *md);
WOLFSSL_API int wolfSSL_X509_check_private_key(WOLFSSL_X509*, WOLFSSL_EVP_PKEY*);
WOLFSSL_API WOLF_STACK_OF(WOLFSSL_X509_NAME) *wolfSSL_dup_CA_list( WOLF_STACK_OF(WOLFSSL_X509_NAME) *sk );
WOLFSSL_API int wolfSSL_X509_check_ca(WOLFSSL_X509 *x509);
#ifndef NO_FILESYSTEM
WOLFSSL_API long wolfSSL_BIO_set_fp(WOLFSSL_BIO *bio, XFILE fp, int c);
@ -2914,6 +2916,13 @@ WOLFSSL_API WOLFSSL_CIPHER* wolfSSL_sk_SSL_CIPHER_value(void *ciphers, int idx);
WOLFSSL_API void ERR_load_SSL_strings(void);
WOLFSSL_API void wolfSSL_EC_POINT_dump(const char *msg, const WOLFSSL_EC_POINT *p);
WOLFSSL_API int wolfSSL_d2i_PKCS12_fp(FILE *fp, WC_PKCS12 *pkcs12);
WOLFSSL_API const char *wolfSSL_ASN1_tag2str(int tag);
WOLFSSL_API int wolfSSL_ASN1_STRING_print_ex(WOLFSSL_BIO *out, WOLFSSL_ASN1_STRING *str, unsigned long flags);
WOLFSSL_API WOLFSSL_ASN1_TIME *wolfSSL_ASN1_TIME_to_generalizedtime(WOLFSSL_ASN1_TIME *t,
WOLFSSL_ASN1_TIME **out);
WOLFSSL_API int wolfSSL_i2c_ASN1_INTEGER(WOLFSSL_ASN1_INTEGER **a, unsigned char **pp);
WOLFSSL_API int wolfSSL_X509_STORE_add_crl(WOLFSSL_X509_STORE *ctx, WOLFSSL_X509_CRL *x);
#endif /* OPENSSL_EXTRA */
#ifdef HAVE_PK_CALLBACKS