mirror of https://github.com/wolfSSL/wolfssl.git
Remove get cipher list bytes
parent
4ec07bb5a8
commit
7b089f548e
29
src/ssl.c
29
src/ssl.c
|
@ -1641,35 +1641,6 @@ int wolfSSL_get_ciphers(char* buf, int len)
|
||||||
return WOLFSSL_SUCCESS;
|
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
|
#ifndef NO_ERROR_STRINGS
|
||||||
/* places a list of all supported cipher suites in TLS_* format into "buf"
|
/* places a list of all supported cipher suites in TLS_* format into "buf"
|
||||||
* return WOLFSSL_SUCCESS on success */
|
* return WOLFSSL_SUCCESS on success */
|
||||||
|
|
37
tests/api.c
37
tests/api.c
|
@ -1730,42 +1730,6 @@ static int test_wolfSSL_CTX_set_cipher_list_bytes(void)
|
||||||
return EXPECT_RESULT();
|
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)
|
static int test_wolfSSL_CTX_use_certificate_file(void)
|
||||||
{
|
{
|
||||||
EXPECT_DECLS;
|
EXPECT_DECLS;
|
||||||
|
@ -83836,7 +83800,6 @@ TEST_CASE testCases[] = {
|
||||||
TEST_DECL(test_SSL_CIPHER_get_xxx),
|
TEST_DECL(test_SSL_CIPHER_get_xxx),
|
||||||
TEST_DECL(test_wolfSSL_ERR_strings),
|
TEST_DECL(test_wolfSSL_ERR_strings),
|
||||||
TEST_DECL(test_wolfSSL_CTX_set_cipher_list_bytes),
|
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_file),
|
||||||
TEST_DECL(test_wolfSSL_CTX_use_certificate_buffer),
|
TEST_DECL(test_wolfSSL_CTX_use_certificate_buffer),
|
||||||
TEST_DECL(test_wolfSSL_CTX_use_PrivateKey_file),
|
TEST_DECL(test_wolfSSL_CTX_use_PrivateKey_file),
|
||||||
|
|
|
@ -158,7 +158,6 @@ extern "C" {
|
||||||
|
|
||||||
#if defined(CONFIG_NET_SOCKETS_SOCKOPT_TLS)
|
#if defined(CONFIG_NET_SOCKETS_SOCKOPT_TLS)
|
||||||
#define WOLFSSL_SET_CIPHER_BYTES
|
#define WOLFSSL_SET_CIPHER_BYTES
|
||||||
#define WOLFSSL_GET_CIPHER_BYTES
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------- */
|
/* ------------------------------------------------------------------------- */
|
||||||
|
|
Loading…
Reference in New Issue