Skip to content

Commit d8085cc

Browse files
committed
src/ssl_load.c, wolfssl/ssl.h, tests/api.c: rename wolfSSL*PrivateKey_id() to wolfSSL*PrivateKey_Id_ex(), and add missing WOLF_PRIVATE_KEY_ID gating.
1 parent b44d8c6 commit d8085cc

3 files changed

Lines changed: 27 additions & 21 deletions

File tree

src/ssl_load.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4198,20 +4198,20 @@ int wolfSSL_CTX_use_PrivateKey_Id(WOLFSSL_CTX* ctx, const unsigned char* id,
41984198
* @return 1 on success.
41994199
* @return 0 on failure.
42004200
*/
4201-
int wolfSSL_CTX_use_PrivateKey_id(WOLFSSL_CTX* ctx, const unsigned char* id,
4201+
int wolfSSL_CTX_use_PrivateKey_Id_ex(WOLFSSL_CTX* ctx, const unsigned char* id,
42024202
long sz, int devId, long keySz)
42034203
{
42044204
int ret;
42054205

4206-
WOLFSSL_ENTER("wolfSSL_CTX_use_PrivateKey_id");
4206+
WOLFSSL_ENTER("wolfSSL_CTX_use_PrivateKey_Id_ex");
42074207

42084208
ret = wolfSSL_CTX_use_PrivateKey_Id(ctx, id, sz, devId);
42094209
if (ret == 1) {
42104210
/* Set the key size which normally is calculated during decoding. */
42114211
ctx->privateKeySz = (int)keySz;
42124212
}
42134213

4214-
WOLFSSL_LEAVE("wolfSSL_CTX_use_PrivateKey_id", ret);
4214+
WOLFSSL_LEAVE("wolfSSL_CTX_use_PrivateKey_Id_ex", ret);
42154215
return ret;
42164216
}
42174217

@@ -4294,19 +4294,19 @@ int wolfSSL_CTX_use_AltPrivateKey_Id(WOLFSSL_CTX* ctx, const unsigned char* id,
42944294
return ret;
42954295
}
42964296

4297-
int wolfSSL_CTX_use_AltPrivateKey_id(WOLFSSL_CTX* ctx, const unsigned char* id,
4298-
long sz, int devId, long keySz)
4297+
int wolfSSL_CTX_use_AltPrivateKey_Id_ex(WOLFSSL_CTX* ctx,
4298+
const unsigned char* id, long sz, int devId, long keySz)
42994299
{
43004300
int ret;
43014301

4302-
WOLFSSL_ENTER("wolfSSL_CTX_use_AltPrivateKey_id");
4302+
WOLFSSL_ENTER("wolfSSL_CTX_use_AltPrivateKey_Id_ex");
43034303

43044304
ret = wolfSSL_CTX_use_AltPrivateKey_Id(ctx, id, sz, devId);
43054305
if (ret == 1) {
43064306
ctx->altPrivateKeySz = (word32)keySz;
43074307
}
43084308

4309-
WOLFSSL_LEAVE("wolfSSL_CTX_use_AltPrivateKey_id", ret);
4309+
WOLFSSL_LEAVE("wolfSSL_CTX_use_AltPrivateKey_Id_ex", ret);
43104310
return ret;
43114311
}
43124312

@@ -4606,7 +4606,7 @@ int wolfSSL_use_PrivateKey_Id(WOLFSSL* ssl, const unsigned char* id,
46064606
* @return 1 on success.
46074607
* @return 0 on failure.
46084608
*/
4609-
int wolfSSL_use_PrivateKey_id(WOLFSSL* ssl, const unsigned char* id,
4609+
int wolfSSL_use_PrivateKey_Id_ex(WOLFSSL* ssl, const unsigned char* id,
46104610
long sz, int devId, long keySz)
46114611
{
46124612
int ret = wolfSSL_use_PrivateKey_Id(ssl, id, sz, devId);
@@ -4703,8 +4703,8 @@ int wolfSSL_use_AltPrivateKey_Id(WOLFSSL* ssl, const unsigned char* id, long sz,
47034703
return ret;
47044704
}
47054705

4706-
int wolfSSL_use_AltPrivateKey_id(WOLFSSL* ssl, const unsigned char* id, long sz,
4707-
int devId, long keySz)
4706+
int wolfSSL_use_AltPrivateKey_Id_ex(WOLFSSL* ssl, const unsigned char* id,
4707+
long sz, int devId, long keySz)
47084708
{
47094709
int ret = wolfSSL_use_AltPrivateKey_Id(ssl, id, sz, devId);
47104710
if (ret == 1) {

tests/api.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1703,8 +1703,8 @@ static int test_dual_alg_ecdsa_mldsa(void)
17031703
static int test_wolfSSL_use_AltPrivateKey_Id(void)
17041704
{
17051705
EXPECT_DECLS;
1706-
#if defined(WOLFSSL_DUAL_ALG_CERTS) && !defined(NO_TLS) && \
1707-
!defined(NO_WOLFSSL_CLIENT)
1706+
#if defined(WOLF_PRIVATE_KEY_ID) && defined(WOLFSSL_DUAL_ALG_CERTS) && \
1707+
!defined(NO_TLS) && !defined(NO_WOLFSSL_CLIENT)
17081708
WOLFSSL_CTX* ctx = NULL;
17091709
WOLFSSL* ssl = NULL;
17101710
const unsigned char id[] = { 0x01, 0x02, 0x03, 0x04 };
@@ -1724,7 +1724,8 @@ static int test_wolfSSL_use_AltPrivateKey_Id(void)
17241724

17251725
wolfSSL_free(ssl);
17261726
wolfSSL_CTX_free(ctx);
1727-
#endif /* WOLFSSL_DUAL_ALG_CERTS && !NO_TLS && !NO_WOLFSSL_CLIENT */
1727+
#endif /* WOLF_PRIVATE_KEY_ID && WOLFSSL_DUAL_ALG_CERTS && !NO_TLS && */
1728+
/* !NO_WOLFSSL_CLIENT */
17281729
return EXPECT_RESULT();
17291730
}
17301731

@@ -1735,8 +1736,8 @@ static int test_wolfSSL_use_AltPrivateKey_Id(void)
17351736
static int test_wolfSSL_use_AltPrivateKey_Label(void)
17361737
{
17371738
EXPECT_DECLS;
1738-
#if defined(WOLFSSL_DUAL_ALG_CERTS) && !defined(NO_TLS) && \
1739-
!defined(NO_WOLFSSL_CLIENT)
1739+
#if defined(WOLF_PRIVATE_KEY_ID) && defined(WOLFSSL_DUAL_ALG_CERTS) && \
1740+
!defined(NO_TLS) && !defined(NO_WOLFSSL_CLIENT)
17401741
WOLFSSL_CTX* ctx = NULL;
17411742
WOLFSSL* ssl = NULL;
17421743

@@ -1754,7 +1755,8 @@ static int test_wolfSSL_use_AltPrivateKey_Label(void)
17541755

17551756
wolfSSL_free(ssl);
17561757
wolfSSL_CTX_free(ctx);
1757-
#endif /* WOLFSSL_DUAL_ALG_CERTS && !NO_TLS && !NO_WOLFSSL_CLIENT */
1758+
#endif /* WOLF_PRIVATE_KEY_ID && WOLFSSL_DUAL_ALG_CERTS && !NO_TLS && */
1759+
/* !NO_WOLFSSL_CLIENT */
17581760
return EXPECT_RESULT();
17591761
}
17601762

wolfssl/ssl.h

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3765,14 +3765,16 @@ WOLFSSL_API int wolfSSL_make_eap_keys(WOLFSSL* ssl, void* key, unsigned int len,
37653765
const unsigned char* in, long sz, int format);
37663766
WOLFSSL_API int wolfSSL_CTX_use_PrivateKey_buffer(WOLFSSL_CTX* ctx,
37673767
const unsigned char* in, long sz, int format);
3768-
WOLFSSL_API int wolfSSL_CTX_use_PrivateKey_id(WOLFSSL_CTX* ctx,
3768+
#ifdef WOLF_PRIVATE_KEY_ID
3769+
WOLFSSL_API int wolfSSL_CTX_use_PrivateKey_Id_ex(WOLFSSL_CTX* ctx,
37693770
const unsigned char* id, long sz,
37703771
int devId, long keySz);
37713772
WOLFSSL_API int wolfSSL_CTX_use_PrivateKey_Id(WOLFSSL_CTX* ctx,
37723773
const unsigned char* id, long sz,
37733774
int devId);
37743775
WOLFSSL_API int wolfSSL_CTX_use_PrivateKey_Label(WOLFSSL_CTX* ctx, const char* label,
37753776
int devId);
3777+
#endif /* WOLF_PRIVATE_KEY_ID */
37763778
WOLFSSL_API int wolfSSL_CTX_use_certificate_chain_buffer_format(WOLFSSL_CTX* ctx,
37773779
const unsigned char* in, long sz, int format);
37783780
WOLFSSL_API int wolfSSL_CTX_use_certificate_chain_buffer(WOLFSSL_CTX* ctx,
@@ -3786,7 +3788,7 @@ WOLFSSL_API int wolfSSL_make_eap_keys(WOLFSSL* ssl, void* key, unsigned int len,
37863788
#ifdef WOLFSSL_DUAL_ALG_CERTS
37873789
WOLFSSL_API int wolfSSL_CTX_use_AltPrivateKey_buffer(WOLFSSL_CTX* ctx,
37883790
const unsigned char* in, long sz, int format);
3789-
WOLFSSL_API int wolfSSL_CTX_use_AltPrivateKey_id(WOLFSSL_CTX* ctx,
3791+
WOLFSSL_API int wolfSSL_CTX_use_AltPrivateKey_Id_ex(WOLFSSL_CTX* ctx,
37903792
const unsigned char* id, long sz,
37913793
int devId, long keySz);
37923794
WOLFSSL_API int wolfSSL_CTX_use_AltPrivateKey_Id(WOLFSSL_CTX* ctx,
@@ -3802,7 +3804,7 @@ WOLFSSL_API int wolfSSL_make_eap_keys(WOLFSSL* ssl, void* key, unsigned int len,
38023804
const unsigned char* der, int derSz);
38033805
WOLFSSL_API int wolfSSL_use_PrivateKey_buffer(WOLFSSL* ssl, const unsigned char* in,
38043806
long sz, int format);
3805-
WOLFSSL_API int wolfSSL_use_PrivateKey_id(WOLFSSL* ssl, const unsigned char* id,
3807+
WOLFSSL_API int wolfSSL_use_PrivateKey_Id_ex(WOLFSSL* ssl, const unsigned char* id,
38063808
long sz, int devId, long keySz);
38073809
WOLFSSL_API int wolfSSL_use_PrivateKey_Id(WOLFSSL* ssl, const unsigned char* id,
38083810
long sz, int devId);
@@ -3815,14 +3817,16 @@ WOLFSSL_API int wolfSSL_make_eap_keys(WOLFSSL* ssl, void* key, unsigned int len,
38153817
#ifdef WOLFSSL_DUAL_ALG_CERTS
38163818
WOLFSSL_API int wolfSSL_use_AltPrivateKey_buffer(WOLFSSL* ssl,
38173819
const unsigned char* in, long sz, int format);
3818-
WOLFSSL_API int wolfSSL_use_AltPrivateKey_id(WOLFSSL* ssl,
3820+
#endif /* WOLFSSL_DUAL_ALG_CERTS */
3821+
#ifdef WOLF_PRIVATE_KEY_ID
3822+
WOLFSSL_API int wolfSSL_use_AltPrivateKey_Id_ex(WOLFSSL* ssl,
38193823
const unsigned char* id, long sz,
38203824
int devId, long keySz);
38213825
WOLFSSL_API int wolfSSL_use_AltPrivateKey_Id(WOLFSSL* ssl,
38223826
const unsigned char* id, long sz, int devId);
38233827
WOLFSSL_API int wolfSSL_use_AltPrivateKey_Label(WOLFSSL* ssl,
38243828
const char* label, int devId);
3825-
#endif
3829+
#endif /* WOLF_PRIVATE_KEY_ID */
38263830

38273831
#if (defined(OPENSSL_EXTRA) || defined(OPENSSL_EXTRA_X509_SMALL)) && \
38283832
defined(KEEP_OUR_CERT)

0 commit comments

Comments
 (0)