forked from wolfSSL/wolfssl
make suites at context level on demand only
This commit is contained in:
@@ -410,10 +410,6 @@ int InitSSL_Ctx(WOLFSSL_CTX* ctx, WOLFSSL_METHOD* method)
|
||||
}
|
||||
#endif
|
||||
|
||||
/* remove DH later if server didn't set, add psk later */
|
||||
InitSuites(&ctx->suites, method->version, TRUE, FALSE, TRUE, ctx->haveNTRU,
|
||||
ctx->haveECDSAsig, ctx->haveStaticECC, method->side);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -422,6 +418,8 @@ int InitSSL_Ctx(WOLFSSL_CTX* ctx, WOLFSSL_METHOD* method)
|
||||
void SSL_CtxResourceFree(WOLFSSL_CTX* ctx)
|
||||
{
|
||||
XFREE(ctx->method, ctx->heap, DYNAMIC_TYPE_METHOD);
|
||||
if (ctx->suites)
|
||||
XFREE(ctx->suites, ctx->heap, DYNAMIC_TYPE_SUITES);
|
||||
|
||||
#ifndef NO_CERTS
|
||||
XFREE(ctx->serverDH_G.buffer, ctx->heap, DYNAMIC_TYPE_DH);
|
||||
@@ -1658,7 +1656,10 @@ int InitSSL(WOLFSSL* ssl, WOLFSSL_CTX* ctx)
|
||||
WOLFSSL_MSG("Suites Memory error");
|
||||
return MEMORY_E;
|
||||
}
|
||||
*ssl->suites = ctx->suites;
|
||||
if (ctx->suites)
|
||||
*ssl->suites = *ctx->suites;
|
||||
else
|
||||
XMEMSET(ssl->suites, 0, sizeof(Suites));
|
||||
|
||||
|
||||
#ifndef NO_CERTS
|
||||
|
14
src/ssl.c
14
src/ssl.c
@@ -4898,7 +4898,19 @@ int CM_GetCertCacheMemSize(WOLFSSL_CERT_MANAGER* cm)
|
||||
int wolfSSL_CTX_set_cipher_list(WOLFSSL_CTX* ctx, const char* list)
|
||||
{
|
||||
WOLFSSL_ENTER("wolfSSL_CTX_set_cipher_list");
|
||||
return (SetCipherList(&ctx->suites, list)) ? SSL_SUCCESS : SSL_FAILURE;
|
||||
|
||||
/* alloc/init on demand only */
|
||||
if (ctx->suites == NULL) {
|
||||
ctx->suites = (Suites*)XMALLOC(sizeof(Suites), ctx->heap,
|
||||
DYNAMIC_TYPE_SUITES);
|
||||
if (ctx->suites == NULL) {
|
||||
WOLFSSL_MSG("Memory alloc for Suites failed");
|
||||
return SSL_FAILURE;
|
||||
}
|
||||
XMEMSET(ctx->suites, 0, sizeof(Suites));
|
||||
}
|
||||
|
||||
return (SetCipherList(ctx->suites, list)) ? SSL_SUCCESS : SSL_FAILURE;
|
||||
}
|
||||
|
||||
|
||||
|
@@ -1425,7 +1425,7 @@ struct WOLFSSL_CTX {
|
||||
buffer serverDH_G;
|
||||
WOLFSSL_CERT_MANAGER* cm; /* our cert manager, ctx owns SSL will use */
|
||||
#endif
|
||||
Suites suites;
|
||||
Suites* suites; /* make dynamic, user may not need/set */
|
||||
void* heap; /* for user memory overrides */
|
||||
byte verifyPeer;
|
||||
byte verifyNone;
|
||||
|
Reference in New Issue
Block a user