Skip to content

Commit

Permalink
Remove get cipher list bytes
Browse files Browse the repository at this point in the history
  • Loading branch information
ColtonWilley committed Jul 11, 2024
1 parent 4ec07bb commit 7b089f5
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 67 deletions.
29 changes: 0 additions & 29 deletions src/ssl.c
Original file line number Diff line number Diff line change
Expand Up @@ -1641,35 +1641,6 @@ int wolfSSL_get_ciphers(char* buf, int len)
return WOLFSSL_SUCCESS;
}

#ifdef WOLFSSL_GET_CIPHER_BYTES
int wolfSSL_get_cipher_list_bytes(byte* buf, int *len)
{
const CipherSuiteInfo* ciphers = GetCipherNames();
int ciphersSz = GetCipherNamesSize();
int i;

if (len == NULL)
return BAD_FUNC_ARG;

/* For NULL input buffer and non-NULL len, set len */
if (buf == NULL) {
*len = (ciphersSz * 2);
return WOLFSSL_SUCCESS;
}

if (*len < (ciphersSz * 2))
return BUFFER_E;

/* Add each member to the buffer */
for (i = 0; i < ciphersSz; i++) {
*buf++ = ciphers->cipherSuite0;
*buf++ = ciphers->cipherSuite;
}

return WOLFSSL_SUCCESS;
}
#endif

#ifndef NO_ERROR_STRINGS
/* places a list of all supported cipher suites in TLS_* format into "buf"
* return WOLFSSL_SUCCESS on success */
Expand Down
37 changes: 0 additions & 37 deletions tests/api.c
Original file line number Diff line number Diff line change
Expand Up @@ -1730,42 +1730,6 @@ static int test_wolfSSL_CTX_set_cipher_list_bytes(void)
return EXPECT_RESULT();
}

static int test_wolfSSL_get_cipher_list_bytes(void)
{
EXPECT_DECLS;
#if (defined(WOLFSSL_GET_CIPHER_BYTES)&& \
(!defined(NO_WOLFSSL_CLIENT) || !defined(NO_WOLFSSL_SERVER)))
WOLFSSL_CTX* ctx = NULL;
byte *getCipherList = NULL;
word32 cipherListLen = 0;

#ifndef NO_WOLFSSL_SERVER
ExpectNotNull(ctx = wolfSSL_CTX_new(wolfSSLv23_server_method()));
#else
ExpectNotNull(ctx = wolfSSL_CTX_new(wolfSSLv23_client_method()));
#endif

ExpectTrue(wolfSSL_get_cipher_list_bytes(NULL, (int *)(&cipherListLen)));
ExpectIntGT((int)cipherListLen, 0);
ExpectNotNull(getCipherList =
(byte *)XMALLOC(cipherListLen, NULL, DYNAMIC_TYPE_TMP_BUFFER));
ExpectTrue(wolfSSL_get_cipher_list_bytes(
getCipherList, (int *)(&cipherListLen)));

/* Intentionally minimal verification here. Only way to verify would
* be a comprehensive list of all possible ciphersuites, which would
* break and need to be updated for every addition to the list. That
* is a lot of maintinence overhead for this little used function so
* call this good enough. */

XFREE(getCipherList, NULL, DYNAMIC_TYPE_TMP_BUFFER);
wolfSSL_CTX_free(ctx);
#endif /* (WOLFSSL_GET_CIPHER_BYTES && (!NO_WOLFSSL_CLIENT \
* || !NO_WOLFSSL_SERVER) */

return EXPECT_RESULT();
}

static int test_wolfSSL_CTX_use_certificate_file(void)
{
EXPECT_DECLS;
Expand Down Expand Up @@ -83836,7 +83800,6 @@ TEST_CASE testCases[] = {
TEST_DECL(test_SSL_CIPHER_get_xxx),
TEST_DECL(test_wolfSSL_ERR_strings),
TEST_DECL(test_wolfSSL_CTX_set_cipher_list_bytes),
TEST_DECL(test_wolfSSL_get_cipher_list_bytes),
TEST_DECL(test_wolfSSL_CTX_use_certificate_file),
TEST_DECL(test_wolfSSL_CTX_use_certificate_buffer),
TEST_DECL(test_wolfSSL_CTX_use_PrivateKey_file),
Expand Down
1 change: 0 additions & 1 deletion zephyr/user_settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,6 @@ extern "C" {

#if defined(CONFIG_NET_SOCKETS_SOCKOPT_TLS)
#define WOLFSSL_SET_CIPHER_BYTES
#define WOLFSSL_GET_CIPHER_BYTES
#endif

/* ------------------------------------------------------------------------- */
Expand Down

0 comments on commit 7b089f5

Please sign in to comment.