forked from wolfSSL/wolfssl
Minor cleanups. Gate these API's on OPENSSL_EXTRA
or WOLFSSL_SET_CIPHER_BYTES
to keep code size reduced.
This commit is contained in:
@@ -24086,7 +24086,7 @@ int SetCipherList(WOLFSSL_CTX* ctx, Suites* suites, const char* list)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(OPENSSL_EXTRA) || defined(WOLFSSL_SET_CIPHER_BYTES)
|
||||||
int SetCipherListFromBytes(WOLFSSL_CTX* ctx, Suites* suites, const byte* list,
|
int SetCipherListFromBytes(WOLFSSL_CTX* ctx, Suites* suites, const byte* list,
|
||||||
const int listSz)
|
const int listSz)
|
||||||
{
|
{
|
||||||
@@ -24100,7 +24100,6 @@ int SetCipherListFromBytes(WOLFSSL_CTX* ctx, Suites* suites, const byte* list,
|
|||||||
int haveDilithiumSig = 0;
|
int haveDilithiumSig = 0;
|
||||||
int haveAnon = 0;
|
int haveAnon = 0;
|
||||||
|
|
||||||
|
|
||||||
if (suites == NULL || list == NULL) {
|
if (suites == NULL || list == NULL) {
|
||||||
WOLFSSL_MSG("SetCipherListFromBytes parameter error");
|
WOLFSSL_MSG("SetCipherListFromBytes parameter error");
|
||||||
return 0;
|
return 0;
|
||||||
@@ -24194,6 +24193,8 @@ int SetCipherListFromBytes(WOLFSSL_CTX* ctx, Suites* suites, const byte* list,
|
|||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
#endif /* OPENSSL_EXTRA */
|
||||||
|
|
||||||
|
|
||||||
#ifdef OPENSSL_EXTRA
|
#ifdef OPENSSL_EXTRA
|
||||||
|
|
||||||
|
30
src/ssl.c
30
src/ssl.c
@@ -11655,11 +11655,12 @@ int wolfSSL_CTX_set_cipher_list(WOLFSSL_CTX* ctx, const char* list)
|
|||||||
#ifdef OPENSSL_EXTRA
|
#ifdef OPENSSL_EXTRA
|
||||||
return wolfSSL_parse_cipher_list(ctx, ctx->suites, list);
|
return wolfSSL_parse_cipher_list(ctx, ctx->suites, list);
|
||||||
#else
|
#else
|
||||||
return (SetCipherList(ctx, ctx->suites, list)) ? WOLFSSL_SUCCESS : WOLFSSL_FAILURE;
|
return (SetCipherList(ctx, ctx->suites, list)) ?
|
||||||
|
WOLFSSL_SUCCESS : WOLFSSL_FAILURE;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(OPENSSL_EXTRA) || defined(WOLFSSL_SET_CIPHER_BYTES)
|
||||||
int wolfSSL_CTX_set_cipher_list_bytes(WOLFSSL_CTX* ctx, const byte* list,
|
int wolfSSL_CTX_set_cipher_list_bytes(WOLFSSL_CTX* ctx, const byte* list,
|
||||||
const int listSz)
|
const int listSz)
|
||||||
{
|
{
|
||||||
@@ -11679,15 +11680,19 @@ int wolfSSL_CTX_set_cipher_list_bytes(WOLFSSL_CTX* ctx, const byte* list,
|
|||||||
XMEMSET(ctx->suites, 0, sizeof(Suites));
|
XMEMSET(ctx->suites, 0, sizeof(Suites));
|
||||||
}
|
}
|
||||||
|
|
||||||
return (SetCipherListFromBytes(ctx, ctx->suites, list, listSz))
|
return (SetCipherListFromBytes(ctx, ctx->suites, list, listSz)) ?
|
||||||
? WOLFSSL_SUCCESS
|
WOLFSSL_SUCCESS : WOLFSSL_FAILURE;
|
||||||
: WOLFSSL_FAILURE;
|
|
||||||
}
|
}
|
||||||
|
#endif /* OPENSSL_EXTRA || WOLFSSL_SET_CIPHER_BYTES */
|
||||||
|
|
||||||
int wolfSSL_set_cipher_list(WOLFSSL* ssl, const char* list)
|
int wolfSSL_set_cipher_list(WOLFSSL* ssl, const char* list)
|
||||||
{
|
{
|
||||||
WOLFSSL_ENTER("wolfSSL_set_cipher_list");
|
WOLFSSL_ENTER("wolfSSL_set_cipher_list");
|
||||||
|
|
||||||
|
if (ssl == NULL || ssl->ctx == NULL) {
|
||||||
|
return WOLFSSL_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef SINGLE_THREADED
|
#ifdef SINGLE_THREADED
|
||||||
if (ssl->ctx->suites == ssl->suites) {
|
if (ssl->ctx->suites == ssl->suites) {
|
||||||
ssl->suites = (Suites*)XMALLOC(sizeof(Suites), ssl->heap,
|
ssl->suites = (Suites*)XMALLOC(sizeof(Suites), ssl->heap,
|
||||||
@@ -11704,15 +11709,22 @@ int wolfSSL_set_cipher_list(WOLFSSL* ssl, const char* list)
|
|||||||
#ifdef OPENSSL_EXTRA
|
#ifdef OPENSSL_EXTRA
|
||||||
return wolfSSL_parse_cipher_list(ssl->ctx, ssl->suites, list);
|
return wolfSSL_parse_cipher_list(ssl->ctx, ssl->suites, list);
|
||||||
#else
|
#else
|
||||||
return (SetCipherList(ssl->ctx, ssl->suites, list)) ? WOLFSSL_SUCCESS : WOLFSSL_FAILURE;
|
return (SetCipherList(ssl->ctx, ssl->suites, list)) ?
|
||||||
|
WOLFSSL_SUCCESS :
|
||||||
|
WOLFSSL_FAILURE;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(OPENSSL_EXTRA) || defined(WOLFSSL_SET_CIPHER_BYTES)
|
||||||
int wolfSSL_set_cipher_list_bytes(WOLFSSL* ssl, const byte* list,
|
int wolfSSL_set_cipher_list_bytes(WOLFSSL* ssl, const byte* list,
|
||||||
const int listSz)
|
const int listSz)
|
||||||
{
|
{
|
||||||
WOLFSSL_ENTER("wolfSSL_set_cipher_list_bytes");
|
WOLFSSL_ENTER("wolfSSL_set_cipher_list_bytes");
|
||||||
|
|
||||||
|
if (ssl == NULL || ssl->ctx == NULL) {
|
||||||
|
return WOLFSSL_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef SINGLE_THREADED
|
#ifdef SINGLE_THREADED
|
||||||
if (ssl->ctx->suites == ssl->suites) {
|
if (ssl->ctx->suites == ssl->suites) {
|
||||||
ssl->suites = (Suites*)XMALLOC(sizeof(Suites), ssl->heap,
|
ssl->suites = (Suites*)XMALLOC(sizeof(Suites), ssl->heap,
|
||||||
@@ -11730,6 +11742,8 @@ int wolfSSL_set_cipher_list_bytes(WOLFSSL* ssl, const byte* list,
|
|||||||
? WOLFSSL_SUCCESS
|
? WOLFSSL_SUCCESS
|
||||||
: WOLFSSL_FAILURE;
|
: WOLFSSL_FAILURE;
|
||||||
}
|
}
|
||||||
|
#endif /* OPENSSL_EXTRA || WOLFSSL_SET_CIPHER_BYTES */
|
||||||
|
|
||||||
|
|
||||||
#ifdef HAVE_KEYING_MATERIAL
|
#ifdef HAVE_KEYING_MATERIAL
|
||||||
|
|
||||||
|
@@ -841,7 +841,8 @@ static int test_for_double_Free(void)
|
|||||||
|
|
||||||
static int test_wolfSSL_CTX_set_cipher_list_bytes(void)
|
static int test_wolfSSL_CTX_set_cipher_list_bytes(void)
|
||||||
{
|
{
|
||||||
#if (!defined(NO_WOLFSSL_CLIENT) || !defined(NO_WOLFSSL_SERVER)) && \
|
#if (defined(OPENSSL_EXTRA) || defined(WOLFSSL_SET_CIPHER_BYTES)) && \
|
||||||
|
(!defined(NO_WOLFSSL_CLIENT) || !defined(NO_WOLFSSL_SERVER)) && \
|
||||||
(!defined(NO_RSA) || defined(HAVE_ECC))
|
(!defined(NO_RSA) || defined(HAVE_ECC))
|
||||||
const char* testCertFile;
|
const char* testCertFile;
|
||||||
const char* testKeyFile;
|
const char* testKeyFile;
|
||||||
@@ -1033,7 +1034,8 @@ static int test_wolfSSL_CTX_set_cipher_list_bytes(void)
|
|||||||
wolfSSL_free(ssl);
|
wolfSSL_free(ssl);
|
||||||
wolfSSL_CTX_free(ctx);
|
wolfSSL_CTX_free(ctx);
|
||||||
|
|
||||||
#endif /* (!NO_WOLFSSL_CLIENT || !NO_WOLFSSL_SERVER) && (!NO_RSA || HAVE_ECC) */
|
#endif /* (OPENSSL_EXTRA || WOLFSSL_SET_CIPHER_BYTES) &&
|
||||||
|
(!NO_WOLFSSL_CLIENT || !NO_WOLFSSL_SERVER) && (!NO_RSA || HAVE_ECC) */
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user