Skip to content

Commit 9096bcc

Browse files
authored
Merge pull request #10393 from JacobBarthelmeh/opensslextra
support build --enable-opensslextra with NO_BIO and NO_FILESYSTEM
2 parents ec22229 + 3bca71b commit 9096bcc

7 files changed

Lines changed: 18 additions & 12 deletions

File tree

.github/workflows/os-check.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ jobs:
128128
CPPFLAGS=''-DNO_WOLFSSL_SERVER -DWOLFSSL_NO_TLS12 -DNO_SESSION_CACHE
129129
-DWOLFSSL_AES_NO_UNROLL -DUSE_SLOW_SHA256 -DWOLFSSL_NO_ASYNC_IO
130130
-DWOLFSSL_DTLS_ONLY'' ',
131+
'--enable-opensslextra --disable-filesystem CPPFLAGS="-DNO_BIO"',
131132
'CPPFLAGS=-DNO_VERIFY_OID',
132133
'CPPFLAGS="-DNO_VERIFY_OID -DWOLFSSL_FPKI"',
133134
]

src/pk.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,8 @@ static int pem_read_file_key(XFILE fp, wc_pem_password_cb* cb, void* pass,
211211
#endif
212212

213213
#if defined(OPENSSL_EXTRA) && ((!defined(NO_RSA) && defined(WOLFSSL_KEY_GEN)) \
214-
|| !defined(WOLFCRYPT_ONLY))
214+
|| !defined(WOLFCRYPT_ONLY)) \
215+
&& (!defined(NO_BIO) || !defined(NO_FILESYSTEM))
215216
/* Convert DER data to PEM in an allocated buffer.
216217
*
217218
* @param [in] der Buffer containing DER data.

src/pk_ec.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,6 @@ void wolfSSL_EC_GROUP_free(WOLFSSL_EC_GROUP *group)
426426
#endif /* OPENSSL_EXTRA || OPENSSL_EXTRA_X509_SMALL */
427427

428428
#ifdef OPENSSL_EXTRA
429-
#ifndef NO_BIO
430429

431430
/* Creates an EC group from the DER encoding.
432431
*
@@ -506,6 +505,7 @@ static WOLFSSL_EC_GROUP* wolfssl_ec_group_d2i(WOLFSSL_EC_GROUP** group,
506505
return ret;
507506
}
508507

508+
#ifndef NO_BIO
509509
/* Creates a new EC group from the PEM encoding in the BIO.
510510
*
511511
* @param [in] bio BIO to read PEM encoding from.
@@ -545,6 +545,7 @@ WOLFSSL_EC_GROUP* wolfSSL_PEM_read_bio_ECPKParameters(WOLFSSL_BIO* bio,
545545
FreeDer(&der);
546546
return ret;
547547
}
548+
#endif /* !NO_BIO */
548549

549550
WOLFSSL_EC_GROUP *wolfSSL_d2i_ECPKParameters(WOLFSSL_EC_GROUP **out,
550551
const unsigned char **in, long len)
@@ -592,7 +593,6 @@ int wolfSSL_i2d_ECPKParameters(const WOLFSSL_EC_GROUP* grp, unsigned char** pp)
592593

593594
return len;
594595
}
595-
#endif /* !NO_BIO */
596596

597597
#if defined(OPENSSL_ALL) && !defined(NO_CERTS)
598598
/* Copy an EC group.

src/pk_rsa.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -986,7 +986,6 @@ int wolfSSL_RSA_LoadDer_ex(WOLFSSL_RSA* rsa, const unsigned char* derBuf,
986986

987987
#if defined(OPENSSL_EXTRA) || defined(WOLFSSL_WPAS_SMALL)
988988

989-
#if !defined(NO_BIO) || !defined(NO_FILESYSTEM)
990989
/* Load DER encoded data into WOLFSSL_RSA object.
991990
*
992991
* Creates a new WOLFSSL_RSA object if one is not passed in.
@@ -1026,7 +1025,6 @@ static WOLFSSL_RSA* wolfssl_rsa_d2i(WOLFSSL_RSA** rsa, const unsigned char* in,
10261025
}
10271026
return ret;
10281027
}
1029-
#endif
10301028

10311029
#endif /* OPENSSL_EXTRA || WOLFSSL_WPAS_SMALL */
10321030

tests/api/test_ossl_ec.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1077,6 +1077,7 @@ int test_EC_i2d(void)
10771077
ExpectNull(d2i_ECPrivateKey(&copy, &tmp, 1));
10781078
ExpectNull(d2i_ECPrivateKey(&key, &tmp, 0));
10791079

1080+
#ifndef NO_BIO
10801081
{
10811082
EC_KEY *pubkey = NULL;
10821083
BIO* bio = NULL;
@@ -1088,6 +1089,7 @@ int test_EC_i2d(void)
10881089
BIO_free(bio);
10891090
EC_KEY_free(pubkey);
10901091
}
1092+
#endif
10911093

10921094
ExpectIntEQ(i2d_ECPrivateKey(NULL, &p), 0);
10931095
ExpectIntEQ(i2d_ECPrivateKey(NULL, NULL), 0);

tests/api/test_tls.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,8 @@ int test_tls_certreq_order(void)
389389
}
390390

391391
#if !defined(WOLFSSL_NO_TLS12) && !defined(NO_RSA) && defined(HAVE_ECC) && \
392-
!defined(NO_WOLFSSL_SERVER) && !defined(WOLFSSL_NO_CLIENT_AUTH)
392+
!defined(NO_WOLFSSL_SERVER) && !defined(WOLFSSL_NO_CLIENT_AUTH) && \
393+
!defined(NO_FILESYSTEM)
393394
/* Called when writing. */
394395
static int CsSend(WOLFSSL* ssl, char* buf, int sz, void* ctx)
395396
{
@@ -425,7 +426,8 @@ int test_tls12_bad_cv_sig_alg(void)
425426
{
426427
EXPECT_DECLS;
427428
#if !defined(WOLFSSL_NO_TLS12) && !defined(NO_RSA) && defined(HAVE_ECC) && \
428-
!defined(NO_WOLFSSL_SERVER) && !defined(WOLFSSL_NO_CLIENT_AUTH)
429+
!defined(NO_WOLFSSL_SERVER) && !defined(WOLFSSL_NO_CLIENT_AUTH) && \
430+
!defined(NO_FILESYSTEM)
429431
byte clientMsgs[] = {
430432
/* Client Hello */
431433
0x16, 0x03, 0x03, 0x00, 0xe7,

tests/api/test_tls13.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3844,7 +3844,7 @@ int test_tls13_ch2_different_cs(void)
38443844
}
38453845

38463846
#if defined(WOLFSSL_TLS13) && !defined(NO_WOLFSSL_SERVER) && \
3847-
defined(HAVE_ECC)
3847+
defined(HAVE_ECC) && !defined(NO_FILESYSTEM)
38483848
/* Called when writing. */
38493849
static int MESend(WOLFSSL* ssl, char* buf, int sz, void* ctx)
38503850
{
@@ -3881,7 +3881,7 @@ int test_tls13_sg_missing(void)
38813881
{
38823882
EXPECT_DECLS;
38833883
#if defined(WOLFSSL_TLS13) && !defined(NO_WOLFSSL_SERVER) && \
3884-
defined(HAVE_ECC)
3884+
defined(HAVE_ECC) && !defined(NO_FILESYSTEM)
38853885
WOLFSSL_CTX *ctx = NULL;
38863886
WOLFSSL *ssl = NULL;
38873887
byte clientHello[] = {
@@ -3952,7 +3952,7 @@ int test_tls13_ks_missing(void)
39523952
{
39533953
EXPECT_DECLS;
39543954
#if defined(WOLFSSL_TLS13) && !defined(NO_WOLFSSL_SERVER) && \
3955-
defined(HAVE_ECC)
3955+
defined(HAVE_ECC) && !defined(NO_FILESYSTEM)
39563956
WOLFSSL_CTX *ctx = NULL;
39573957
WOLFSSL *ssl = NULL;
39583958
byte clientHello[] = {
@@ -4282,7 +4282,8 @@ int test_key_share_mismatch(void)
42824282

42834283

42844284
#if defined(WOLFSSL_TLS13) && !defined(NO_RSA) && defined(HAVE_ECC) && \
4285-
defined(HAVE_AESGCM) && !defined(NO_WOLFSSL_SERVER)
4285+
defined(HAVE_AESGCM) && !defined(NO_WOLFSSL_SERVER) && \
4286+
!defined(NO_FILESYSTEM)
42864287
/* Called when writing. */
42874288
static int Tls13PTASend(WOLFSSL* ssl, char* buf, int sz, void* ctx)
42884289
{
@@ -4410,7 +4411,8 @@ int test_tls13_plaintext_alert(void)
44104411
EXPECT_DECLS;
44114412

44124413
#if defined(WOLFSSL_TLS13) && !defined(NO_RSA) && defined(HAVE_ECC) && \
4413-
defined(HAVE_AESGCM) && !defined(NO_WOLFSSL_SERVER)
4414+
defined(HAVE_AESGCM) && !defined(NO_WOLFSSL_SERVER) && \
4415+
!defined(NO_FILESYSTEM)
44144416
byte clientMsgs[] = {
44154417
/* Client Hello */
44164418
0x16, 0x03, 0x03, 0x01, 0x9b, 0x01, 0x00, 0x01,

0 commit comments

Comments
 (0)