Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 3 additions & 30 deletions src/ssl.c
Original file line number Diff line number Diff line change
Expand Up @@ -12757,7 +12757,6 @@ int wolfSSL_set_compression(WOLFSSL* ssl)
{
int r = 0;
SrpSide srp_side = SRP_CLIENT_SIDE;
byte salt[SRP_SALT_SIZE];

WOLFSSL_ENTER("wolfSSL_CTX_set_srp_username");
if (ctx == NULL || ctx->srp == NULL || username==NULL)
Expand Down Expand Up @@ -12786,37 +12785,11 @@ int wolfSSL_set_compression(WOLFSSL* ssl)
}

/* if wolfSSL_CTX_set_srp_password has already been called, */
/* execute wc_SrpSetPassword here */
/* use saved password here */
if (ctx->srp_password != NULL) {
WC_RNG rng;
if (wc_InitRng(&rng) < 0){
WOLFSSL_MSG("wc_InitRng failed");
return WOLFSSL_FAILURE;
}
XMEMSET(salt, 0, sizeof(salt)/sizeof(salt[0]));
r = wc_RNG_GenerateBlock(&rng, salt, sizeof(salt)/sizeof(salt[0]));
wc_FreeRng(&rng);
if (r < 0) {
WOLFSSL_MSG("wc_RNG_GenerateBlock failed");
if (ctx->srp->user == NULL)
return WOLFSSL_FAILURE;
}

if (wc_SrpSetParams(ctx->srp, srp_N, sizeof(srp_N)/sizeof(srp_N[0]),
srp_g, sizeof(srp_g)/sizeof(srp_g[0]),
salt, sizeof(salt)/sizeof(salt[0])) < 0) {
WOLFSSL_MSG("wc_SrpSetParam failed");
return WOLFSSL_FAILURE;
}
r = wc_SrpSetPassword(ctx->srp,
(const byte*)ctx->srp_password,
(word32)XSTRLEN((char *)ctx->srp_password));
if (r < 0) {
WOLFSSL_MSG("fail to set srp password.");
return WOLFSSL_FAILURE;
}

XFREE(ctx->srp_password, ctx->heap, DYNAMIC_TYPE_SRP);
ctx->srp_password = NULL;
return wolfSSL_CTX_set_srp_password(ctx, (char*)ctx->srp_password);
}

return WOLFSSL_SUCCESS;
Expand Down