mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2026-05-05 00:54:15 +02:00
Merge pull request #5496 from SKlimaRA/SKlimaRA/SetCipherListBytes
Support for setting cipher list with bytes
This commit is contained in:
@@ -11672,14 +11672,44 @@ int wolfSSL_CTX_set_cipher_list(WOLFSSL_CTX* ctx, const char* list)
|
||||
#ifdef OPENSSL_EXTRA
|
||||
return wolfSSL_parse_cipher_list(ctx, ctx->suites, list);
|
||||
#else
|
||||
return (SetCipherList(ctx, ctx->suites, list)) ? WOLFSSL_SUCCESS : WOLFSSL_FAILURE;
|
||||
return (SetCipherList(ctx, ctx->suites, list)) ?
|
||||
WOLFSSL_SUCCESS : WOLFSSL_FAILURE;
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined(OPENSSL_EXTRA) || defined(WOLFSSL_SET_CIPHER_BYTES)
|
||||
int wolfSSL_CTX_set_cipher_list_bytes(WOLFSSL_CTX* ctx, const byte* list,
|
||||
const int listSz)
|
||||
{
|
||||
WOLFSSL_ENTER("wolfSSL_CTX_set_cipher_list_bytes");
|
||||
|
||||
if (ctx == NULL)
|
||||
return WOLFSSL_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 WOLFSSL_FAILURE;
|
||||
}
|
||||
XMEMSET(ctx->suites, 0, sizeof(Suites));
|
||||
}
|
||||
|
||||
return (SetCipherListFromBytes(ctx, ctx->suites, list, listSz)) ?
|
||||
WOLFSSL_SUCCESS : WOLFSSL_FAILURE;
|
||||
}
|
||||
#endif /* OPENSSL_EXTRA || WOLFSSL_SET_CIPHER_BYTES */
|
||||
|
||||
int wolfSSL_set_cipher_list(WOLFSSL* ssl, const char* list)
|
||||
{
|
||||
WOLFSSL_ENTER("wolfSSL_set_cipher_list");
|
||||
|
||||
if (ssl == NULL || ssl->ctx == NULL) {
|
||||
return WOLFSSL_FAILURE;
|
||||
}
|
||||
|
||||
#ifdef SINGLE_THREADED
|
||||
if (ssl->ctx->suites == ssl->suites) {
|
||||
ssl->suites = (Suites*)XMALLOC(sizeof(Suites), ssl->heap,
|
||||
@@ -11696,10 +11726,42 @@ int wolfSSL_set_cipher_list(WOLFSSL* ssl, const char* list)
|
||||
#ifdef OPENSSL_EXTRA
|
||||
return wolfSSL_parse_cipher_list(ssl->ctx, ssl->suites, list);
|
||||
#else
|
||||
return (SetCipherList(ssl->ctx, ssl->suites, list)) ? WOLFSSL_SUCCESS : WOLFSSL_FAILURE;
|
||||
return (SetCipherList(ssl->ctx, ssl->suites, list)) ?
|
||||
WOLFSSL_SUCCESS :
|
||||
WOLFSSL_FAILURE;
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined(OPENSSL_EXTRA) || defined(WOLFSSL_SET_CIPHER_BYTES)
|
||||
int wolfSSL_set_cipher_list_bytes(WOLFSSL* ssl, const byte* list,
|
||||
const int listSz)
|
||||
{
|
||||
WOLFSSL_ENTER("wolfSSL_set_cipher_list_bytes");
|
||||
|
||||
if (ssl == NULL || ssl->ctx == NULL) {
|
||||
return WOLFSSL_FAILURE;
|
||||
}
|
||||
|
||||
#ifdef SINGLE_THREADED
|
||||
if (ssl->ctx->suites == ssl->suites) {
|
||||
ssl->suites = (Suites*)XMALLOC(sizeof(Suites), ssl->heap,
|
||||
DYNAMIC_TYPE_SUITES);
|
||||
if (ssl->suites == NULL) {
|
||||
WOLFSSL_MSG("Suites Memory error");
|
||||
return MEMORY_E;
|
||||
}
|
||||
*ssl->suites = *ssl->ctx->suites;
|
||||
ssl->options.ownSuites = 1;
|
||||
}
|
||||
#endif
|
||||
|
||||
return (SetCipherListFromBytes(ssl->ctx, ssl->suites, list, listSz))
|
||||
? WOLFSSL_SUCCESS
|
||||
: WOLFSSL_FAILURE;
|
||||
}
|
||||
#endif /* OPENSSL_EXTRA || WOLFSSL_SET_CIPHER_BYTES */
|
||||
|
||||
|
||||
#ifdef HAVE_KEYING_MATERIAL
|
||||
|
||||
#define TLS_PRF_LABEL_CLIENT_FINISHED "client finished"
|
||||
|
||||
Reference in New Issue
Block a user