Skip to content

Commit 90be76c

Browse files
committed
Misc fixes and improvements regarding PKCS#11
1 parent f59a27c commit 90be76c

3 files changed

Lines changed: 184 additions & 105 deletions

File tree

src/ssl_load.c

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4157,6 +4157,8 @@ int wolfSSL_CTX_use_PrivateKey_Id(WOLFSSL_CTX* ctx, const unsigned char* id,
41574157
{
41584158
int ret = 1;
41594159

4160+
WOLFSSL_ENTER("wolfSSL_CTX_use_PrivateKey_Id");
4161+
41604162
/* Dispose of old private key and allocate and copy in id. */
41614163
FreeDer(&ctx->privateKey);
41624164
if (AllocCopyDer(&ctx->privateKey, id, (word32)sz, PRIVATEKEY_TYPE,
@@ -4182,6 +4184,7 @@ int wolfSSL_CTX_use_PrivateKey_Id(WOLFSSL_CTX* ctx, const unsigned char* id,
41824184
#endif
41834185
}
41844186

4187+
WOLFSSL_LEAVE("wolfSSL_CTX_use_PrivateKey_Id", ret);
41854188
return ret;
41864189
}
41874190

@@ -4198,12 +4201,17 @@ int wolfSSL_CTX_use_PrivateKey_Id(WOLFSSL_CTX* ctx, const unsigned char* id,
41984201
int wolfSSL_CTX_use_PrivateKey_id(WOLFSSL_CTX* ctx, const unsigned char* id,
41994202
long sz, int devId, long keySz)
42004203
{
4201-
int ret = wolfSSL_CTX_use_PrivateKey_Id(ctx, id, sz, devId);
4204+
int ret;
4205+
4206+
WOLFSSL_ENTER("wolfSSL_CTX_use_PrivateKey_id");
4207+
4208+
ret = wolfSSL_CTX_use_PrivateKey_Id(ctx, id, sz, devId);
42024209
if (ret == 1) {
42034210
/* Set the key size which normally is calculated during decoding. */
42044211
ctx->privateKeySz = (int)keySz;
42054212
}
42064213

4214+
WOLFSSL_LEAVE("wolfSSL_CTX_use_PrivateKey_id", ret);
42074215
return ret;
42084216
}
42094217

@@ -4221,6 +4229,8 @@ int wolfSSL_CTX_use_PrivateKey_Label(WOLFSSL_CTX* ctx, const char* label,
42214229
int ret = 1;
42224230
word32 sz = (word32)XSTRLEN(label) + 1;
42234231

4232+
WOLFSSL_ENTER("wolfSSL_CTX_use_PrivateKey_Label");
4233+
42244234
/* Dispose of old private key and allocate and copy in label. */
42254235
FreeDer(&ctx->privateKey);
42264236
if (AllocCopyDer(&ctx->privateKey, (const byte*)label, (word32)sz,
@@ -4246,6 +4256,7 @@ int wolfSSL_CTX_use_PrivateKey_Label(WOLFSSL_CTX* ctx, const char* label,
42464256
#endif
42474257
}
42484258

4259+
WOLFSSL_LEAVE("wolfSSL_CTX_use_PrivateKey_Label", ret);
42494260
return ret;
42504261
}
42514262

@@ -4255,6 +4266,8 @@ int wolfSSL_CTX_use_AltPrivateKey_Id(WOLFSSL_CTX* ctx, const unsigned char* id,
42554266
{
42564267
int ret = 1;
42574268

4269+
WOLFSSL_ENTER("wolfSSL_CTX_use_AltPrivateKey_Id");
4270+
42584271
if ((ctx == NULL) || (id == NULL)) {
42594272
ret = 0;
42604273
}
@@ -4277,17 +4290,23 @@ int wolfSSL_CTX_use_AltPrivateKey_Id(WOLFSSL_CTX* ctx, const unsigned char* id,
42774290
}
42784291
}
42794292

4293+
WOLFSSL_LEAVE("wolfSSL_CTX_use_AltPrivateKey_Id", ret);
42804294
return ret;
42814295
}
42824296

42834297
int wolfSSL_CTX_use_AltPrivateKey_id(WOLFSSL_CTX* ctx, const unsigned char* id,
42844298
long sz, int devId, long keySz)
42854299
{
4286-
int ret = wolfSSL_CTX_use_AltPrivateKey_Id(ctx, id, sz, devId);
4300+
int ret;
4301+
4302+
WOLFSSL_ENTER("wolfSSL_CTX_use_AltPrivateKey_id");
4303+
4304+
ret = wolfSSL_CTX_use_AltPrivateKey_Id(ctx, id, sz, devId);
42874305
if (ret == 1) {
42884306
ctx->altPrivateKeySz = (word32)keySz;
42894307
}
42904308

4309+
WOLFSSL_LEAVE("wolfSSL_CTX_use_AltPrivateKey_id", ret);
42914310
return ret;
42924311
}
42934312

@@ -4297,6 +4316,8 @@ int wolfSSL_CTX_use_AltPrivateKey_Label(WOLFSSL_CTX* ctx, const char* label,
42974316
int ret = 1;
42984317
word32 sz;
42994318

4319+
WOLFSSL_ENTER("wolfSSL_CTX_use_AltPrivateKey_Label");
4320+
43004321
if ((ctx == NULL) || (label == NULL)) {
43014322
ret = 0;
43024323
}
@@ -4320,6 +4341,7 @@ int wolfSSL_CTX_use_AltPrivateKey_Label(WOLFSSL_CTX* ctx, const char* label,
43204341
}
43214342
}
43224343

4344+
WOLFSSL_LEAVE("wolfSSL_CTX_use_AltPrivateKey_Label", ret);
43234345
return ret;
43244346
}
43254347
#endif /* WOLFSSL_DUAL_ALG_CERTS */

0 commit comments

Comments
 (0)