Skip to content
Open
Show file tree
Hide file tree
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
37 changes: 29 additions & 8 deletions src/internal.c
Original file line number Diff line number Diff line change
Expand Up @@ -3031,7 +3031,7 @@ int wolfSSL_crypto_policy_init_ctx(WOLFSSL_CTX * ctx,
break;
case 0:
default:
ctx->minDowngrade = WOLFSSL_MIN_DOWNGRADE;
minDowngrade = WOLFSSL_MIN_DOWNGRADE;
break;
}
}
Expand Down Expand Up @@ -3173,7 +3173,6 @@ int InitSSL_Ctx(WOLFSSL_CTX* ctx, WOLFSSL_METHOD* method, void* heap)
else
#endif /* WOLFSSL_DTLS */
{
/* current default: TLSv1_MINOR */
ctx->minDowngrade = WOLFSSL_MIN_DOWNGRADE;
}

Expand Down Expand Up @@ -4410,6 +4409,23 @@ int InitCtxSuitesWithMutex(WOLFSSL_CTX* ctx)
return ret;
}

/* Drop derived sigalgs so that InitSuites derives them again. */
void ResetSuitesHashSigAlgo(Suites* suites)
{
if (!suites->setSuites && !suites->setHashSigAlgo)
suites->hashSigAlgoSz = 0;
}

/* Derive ctx->suites again after a setting they depend on changed. */
void RefreshCtxSuites(WOLFSSL_CTX* ctx)
{
if (ctx == NULL || ctx->suites == NULL || ctx->suites->setSuites)
return;

ResetSuitesHashSigAlgo(ctx->suites);
InitSSL_CTX_Suites(ctx, ctx->suites);
}

/* Call this when the ssl object needs to have its own ssl->suites object */
int AllocateSuites(WOLFSSL* ssl)
{
Expand Down Expand Up @@ -8739,6 +8755,11 @@ int SetSSL_CTX(WOLFSSL* ssl, WOLFSSL_CTX* ctx, int writeDup)
WOLFSSL_MSG("wolfSSL_set_options error");
return BAD_FUNC_ARG;
}
#ifdef OPENSSL_EXTRA
/* after wolfSSL_set_options(), which drops them */
ssl->options.minProtoMask = ctx->minProtoMask;
ssl->options.maxProtoMask = ctx->maxProtoMask;
#endif

#ifdef WOLFSSL_SESSION_EXPORT
#ifdef WOLFSSL_DTLS
Expand Down Expand Up @@ -35297,7 +35318,7 @@ static byte GetSigAlgFromName(const char* name, int len)
*
* suites [in,out] Cipher suites and signature algorithms.
* list [in] String representing hash/signature algorithms to set.
* returns 0 on failure.
* returns 0 on failure, leaving suites unchanged.
* 1 on success.
*/
int SetSuitesHashSigAlgo(Suites* suites, const char* list)
Expand All @@ -35307,9 +35328,7 @@ int SetSuitesHashSigAlgo(Suites* suites, const char* list)
const char* s = list;
byte sig_alg = 0;
byte mac_alg = no_mac;

/* Setting is destructive on error. */
suites->hashSigAlgoSz = 0;
byte hashSigAlgo[WOLFSSL_MAX_SIGALGO];

do {
if (*list == '+') {
Expand Down Expand Up @@ -35349,7 +35368,7 @@ int SetSuitesHashSigAlgo(Suites* suites, const char* list)
break;
}
}
AddSuiteHashSigAlgo(suites->hashSigAlgo, mac_alg, sig_alg, 0, &idx);
AddSuiteHashSigAlgo(hashSigAlgo, mac_alg, sig_alg, 0, &idx);
sig_alg = 0;
mac_alg = no_mac;
s = list + 1;
Expand All @@ -35362,8 +35381,10 @@ int SetSuitesHashSigAlgo(Suites* suites, const char* list)
if (s != list && (sig_alg != 0 || mac_alg != 0)) {
ret = 0;
}
else {
if (ret == 1) {
XMEMCPY(suites->hashSigAlgo, hashSigAlgo, idx);
suites->hashSigAlgoSz = idx;
suites->setHashSigAlgo = 1;
}

return ret;
Expand Down
Loading
Loading