Skip to content

Commit 8166be6

Browse files
committed
WOLFSSL_WPAS_SMALL needs this as well.
1 parent c90fb03 commit 8166be6

File tree

4 files changed

+36
-31
lines changed

4 files changed

+36
-31
lines changed

src/x509.c

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4164,6 +4164,16 @@ byte* wolfSSL_X509_get_hw_serial_number(WOLFSSL_X509* x509,byte* in,
41644164
#endif /* WOLFSSL_SEP */
41654165
#endif /* OPENSSL_EXTRA */
41664166

4167+
4168+
4169+
#if defined(OPENSSL_EXTRA) || defined(WOLFSSL_WPAS_SMALL)
4170+
/* Return and remove the last x509 pushed on stack */
4171+
WOLFSSL_X509* wolfSSL_sk_X509_pop(WOLF_STACK_OF(WOLFSSL_X509_NAME)* sk)
4172+
{
4173+
return (WOLFSSL_X509*)wolfSSL_sk_pop(sk);
4174+
}
4175+
#endif /* OPENSSL_EXTRA || WOLFSSL_WPAS_SMALL */
4176+
41674177
/* require OPENSSL_EXTRA since wolfSSL_X509_free is wrapped by OPENSSL_EXTRA */
41684178
#if defined(OPENSSL_EXTRA)
41694179

@@ -4202,13 +4212,6 @@ int wolfSSL_sk_X509_push(WOLF_STACK_OF(WOLFSSL_X509_NAME)* sk,
42024212
return wolfSSL_sk_push(sk, x509);
42034213
}
42044214

4205-
4206-
/* Return and remove the last x509 pushed on stack */
4207-
WOLFSSL_X509* wolfSSL_sk_X509_pop(WOLF_STACK_OF(WOLFSSL_X509_NAME)* sk)
4208-
{
4209-
return (WOLFSSL_X509*)wolfSSL_sk_pop(sk);
4210-
}
4211-
42124215
/* Getter function for WOLFSSL_X509 pointer
42134216
*
42144217
* sk is the stack to retrieve pointer from
@@ -14050,7 +14053,7 @@ WOLFSSL_X509_CRL *wolfSSL_X509_OBJECT_get0_X509_CRL(WOLFSSL_X509_OBJECT *obj)
1405014053
* HAVE_SBLIM_SFCB)) */
1405114054

1405214055

14053-
#if defined(OPENSSL_EXTRA)
14056+
#if defined(OPENSSL_EXTRA) || defined(WOLFSSL_WPAS_SMALL)
1405414057

1405514058
int wolfSSL_sk_X509_num(const WOLF_STACK_OF(WOLFSSL_X509) *s)
1405614059
{
@@ -14061,7 +14064,7 @@ int wolfSSL_sk_X509_num(const WOLF_STACK_OF(WOLFSSL_X509) *s)
1406114064
return (int)s->num;
1406214065
}
1406314066

14064-
#endif /* OPENSSL_EXTRA */
14067+
#endif /* OPENSSL_EXTRA || WOLFSSL_WPAS_SMALL */
1406514068

1406614069
#ifdef HAVE_EX_DATA_CRYPTO
1406714070
int wolfSSL_X509_get_ex_new_index(int idx, void *arg,

src/x509_str.c

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1319,6 +1319,28 @@ int wolfSSL_X509_STORE_set_ex_data_with_cleanup(
13191319

13201320
#endif /* OPENSSL_EXTRA || HAVE_WEBSERVER || WOLFSSL_WPAS_SMALL */
13211321

1322+
#if defined(OPENSSL_EXTRA) || defined(WOLFSSL_WPAS_SMALL)
1323+
int X509StoreAddCa(WOLFSSL_X509_STORE* store, WOLFSSL_X509* x509, int type)
1324+
{
1325+
int result = WC_NO_ERR_TRACE(WOLFSSL_FATAL_ERROR);
1326+
DerBuffer* derCert = NULL;
1327+
1328+
WOLFSSL_ENTER("X509StoreAddCa");
1329+
if (store != NULL && x509 != NULL && x509->derCert != NULL) {
1330+
result = AllocDer(&derCert, x509->derCert->length,
1331+
x509->derCert->type, NULL);
1332+
if (result == 0) {
1333+
/* AddCA() frees the buffer. */
1334+
XMEMCPY(derCert->buffer,
1335+
x509->derCert->buffer, x509->derCert->length);
1336+
result = AddCA(store->cm, &derCert, type, VERIFY);
1337+
}
1338+
}
1339+
1340+
return result;
1341+
}
1342+
#endif /* OPENSSL_EXTRA || WOLFSSL_WPAS_SMALL */
1343+
13221344
#ifdef OPENSSL_EXTRA
13231345

13241346
#if defined(WOLFSSL_QT) || defined(OPENSSL_ALL)
@@ -1365,26 +1387,6 @@ WOLFSSL_X509_LOOKUP* wolfSSL_X509_STORE_add_lookup(WOLFSSL_X509_STORE* store,
13651387
return &store->lookup;
13661388
}
13671389

1368-
int X509StoreAddCa(WOLFSSL_X509_STORE* store, WOLFSSL_X509* x509, int type)
1369-
{
1370-
int result = WC_NO_ERR_TRACE(WOLFSSL_FATAL_ERROR);
1371-
DerBuffer* derCert = NULL;
1372-
1373-
WOLFSSL_ENTER("X509StoreAddCa");
1374-
if (store != NULL && x509 != NULL && x509->derCert != NULL) {
1375-
result = AllocDer(&derCert, x509->derCert->length,
1376-
x509->derCert->type, NULL);
1377-
if (result == 0) {
1378-
/* AddCA() frees the buffer. */
1379-
XMEMCPY(derCert->buffer,
1380-
x509->derCert->buffer, x509->derCert->length);
1381-
result = AddCA(store->cm, &derCert, type, VERIFY);
1382-
}
1383-
}
1384-
1385-
return result;
1386-
}
1387-
13881390

13891391
int wolfSSL_X509_STORE_add_cert(WOLFSSL_X509_STORE* store, WOLFSSL_X509* x509)
13901392
{

wolfssl/internal.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2781,7 +2781,7 @@ WOLFSSL_LOCAL int X509StoreLoadCertBuffer(WOLFSSL_X509_STORE *str,
27812781
byte *buf, word32 bufLen, int type);
27822782
#endif /* !defined NO_CERTS */
27832783

2784-
#ifdef OPENSSL_EXTRA
2784+
#if defined(OPENSSL_EXTRA) || defined(WOLFSSL_WPAS_SMALL)
27852785
WOLFSSL_LOCAL int X509StoreAddCa(WOLFSSL_X509_STORE* store,
27862786
WOLFSSL_X509* x509, int type);
27872787
#endif

wolfssl/ssl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5324,7 +5324,6 @@ WOLFSSL_API int wolfSSL_CIPHER_get_bits(const WOLFSSL_CIPHER *c, int *alg_bits);
53245324
WOLFSSL_API WOLFSSL_STACK* wolfSSL_sk_X509_new(
53255325
WOLF_SK_COMPARE_CB(WOLFSSL_X509, cb));
53265326
WOLFSSL_API WOLFSSL_STACK* wolfSSL_sk_X509_new_null(void);
5327-
WOLFSSL_API int wolfSSL_sk_X509_num(const WOLF_STACK_OF(WOLFSSL_X509) *s);
53285327

53295328
WOLFSSL_API WOLFSSL_STACK* wolfSSL_sk_X509_OBJECT_new(void);
53305329
WOLFSSL_API void wolfSSL_sk_X509_OBJECT_free(WOLFSSL_STACK* s);
@@ -5408,6 +5407,7 @@ WOLFSSL_API int wolfSSL_i2d_ASN1_BIT_STRING(const WOLFSSL_ASN1_BIT_STRING* bstr,
54085407
unsigned char** pp);
54095408
WOLFSSL_API WOLFSSL_ASN1_BIT_STRING* wolfSSL_d2i_ASN1_BIT_STRING(
54105409
WOLFSSL_ASN1_BIT_STRING** out, const byte** src, long len);
5410+
WOLFSSL_API int wolfSSL_sk_X509_num(const WOLF_STACK_OF(WOLFSSL_X509) *s);
54115411
#endif /* OPENSSL_EXTRA || WOLFSSL_WPAS_SMALL */
54125412

54135413
WOLFSSL_API int wolfSSL_version(WOLFSSL* ssl);

0 commit comments

Comments
 (0)