@@ -6922,13 +6922,33 @@ int SetSSL_CTX(WOLFSSL* ssl, WOLFSSL_CTX* ctx, int writeDup)
69226922 /* If we are setting the ctx on an already initialized SSL object
69236923 * then we possibly already have a side defined. Don't overwrite unless
69246924 * the context has a well defined role. */
6925- if (newSSL || ctx->method->side != WOLFSSL_NEITHER_END)
6926- ssl->options.side = (word16)(ctx->method->side);
6927- ssl->options.downgrade = (word16)(ctx->method->downgrade);
6928- ssl->options.minDowngrade = ctx->minDowngrade ;
6929-
6925+ if (newSSL || ctx->method->side != WOLFSSL_NEITHER_END) {
6926+ ssl->options.side = (word16)(ctx->method->side);
6927+ }
6928+ ssl->options.downgrade = (word16)( ctx->method->downgrade) ;
6929+ ssl->options.minDowngrade = ctx->minDowngrade;
69306930 ssl->options.haveRSA = ctx->haveRSA;
69316931 ssl->options.haveDH = ctx->haveDH;
6932+ /* Its possible that algorithm parameters were set in the ctx (ie: DH),
6933+ * recalculate cipher suites. */
6934+ if (ssl->options.haveDH) {
6935+ if (ssl->suites == NULL) {
6936+ if (AllocateSuites(ssl) != 0) {
6937+ return MEMORY_E;
6938+ }
6939+ }
6940+ InitSuites(ssl->suites, ssl->version, ssl->buffers.keySz,
6941+ ssl->options.haveRSA,
6942+ #ifdef NO_PSK
6943+ 0,
6944+ #else
6945+ ctx->havePSK,
6946+ #endif
6947+ ssl->options.haveDH,
6948+ ssl->options.haveECDSAsig, ssl->options.haveECC, TRUE,
6949+ ssl->options.haveStaticECC, ssl->options.useAnon,
6950+ TRUE, TRUE, TRUE, TRUE, ssl->options.side);
6951+ }
69326952 ssl->options.haveECDSAsig = ctx->haveECDSAsig;
69336953 ssl->options.haveECC = ctx->haveECC;
69346954 ssl->options.haveStaticECC = ctx->haveStaticECC;
0 commit comments