mirror of https://github.com/wolfSSL/wolfssl.git
add get cipher iana list and parse iana list
parent
db1fabbdd4
commit
083183e3b1
|
@ -16632,7 +16632,11 @@ int SetCipherList(WOLFSSL_CTX* ctx, Suites* suites, const char* list)
|
||||||
name[(length == sizeof(name)) ? length - 1 : length] = 0;
|
name[(length == sizeof(name)) ? length - 1 : length] = 0;
|
||||||
|
|
||||||
for (i = 0; i < suiteSz; i++) {
|
for (i = 0; i < suiteSz; i++) {
|
||||||
if (XSTRNCMP(name, cipher_names[i].name, sizeof(name)) == 0) {
|
if (XSTRNCMP(name, cipher_names[i].name, sizeof(name)) == 0
|
||||||
|
#ifndef NO_ERROR_STRINGS
|
||||||
|
|| XSTRNCMP(name, cipher_names[i].name_iana, sizeof(name)) == 0
|
||||||
|
#endif
|
||||||
|
) {
|
||||||
#ifdef WOLFSSL_DTLS
|
#ifdef WOLFSSL_DTLS
|
||||||
/* don't allow stream ciphers with DTLS */
|
/* don't allow stream ciphers with DTLS */
|
||||||
if (ctx->method->version.major == DTLS_MAJOR) {
|
if (ctx->method->version.major == DTLS_MAJOR) {
|
||||||
|
|
33
src/ssl.c
33
src/ssl.c
|
@ -720,6 +720,39 @@ int wolfSSL_get_ciphers(char* buf, int len)
|
||||||
return WOLFSSL_SUCCESS;
|
return WOLFSSL_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* places a list of all supported cipher suites in TLS_* format into "buf"
|
||||||
|
* return WOLFSSL_SUCCESS on success */
|
||||||
|
int wolfSSL_get_ciphers_iana(char* buf, int len)
|
||||||
|
{
|
||||||
|
const CipherSuiteInfo* ciphers = GetCipherNames();
|
||||||
|
int ciphersSz = GetCipherNamesSize();
|
||||||
|
int i;
|
||||||
|
int cipherNameSz;
|
||||||
|
|
||||||
|
if (buf == NULL || len <= 0)
|
||||||
|
return BAD_FUNC_ARG;
|
||||||
|
|
||||||
|
/* Add each member to the buffer delimited by a : */
|
||||||
|
for (i = 0; i < ciphersSz; i++) {
|
||||||
|
cipherNameSz = (int)XSTRLEN(ciphers[i].name_iana);
|
||||||
|
if (cipherNameSz + 1 < len) {
|
||||||
|
XSTRNCPY(buf, ciphers[i].name_iana, len);
|
||||||
|
buf += cipherNameSz;
|
||||||
|
|
||||||
|
if (i < ciphersSz - 1)
|
||||||
|
*buf++ = ':';
|
||||||
|
*buf = 0;
|
||||||
|
|
||||||
|
len -= cipherNameSz + 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return BUFFER_E;
|
||||||
|
}
|
||||||
|
return WOLFSSL_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
const char* wolfSSL_get_shared_ciphers(WOLFSSL* ssl, char* buf, int len)
|
const char* wolfSSL_get_shared_ciphers(WOLFSSL* ssl, char* buf, int len)
|
||||||
{
|
{
|
||||||
const char* cipher;
|
const char* cipher;
|
||||||
|
|
|
@ -579,6 +579,7 @@ WOLFSSL_API int wolfSSL_set_read_fd (WOLFSSL*, int);
|
||||||
WOLFSSL_API char* wolfSSL_get_cipher_list(int priority);
|
WOLFSSL_API char* wolfSSL_get_cipher_list(int priority);
|
||||||
WOLFSSL_API char* wolfSSL_get_cipher_list_ex(WOLFSSL* ssl, int priority);
|
WOLFSSL_API char* wolfSSL_get_cipher_list_ex(WOLFSSL* ssl, int priority);
|
||||||
WOLFSSL_API int wolfSSL_get_ciphers(char*, int);
|
WOLFSSL_API int wolfSSL_get_ciphers(char*, int);
|
||||||
|
WOLFSSL_API int wolfSSL_get_ciphers_iana(char*, int);
|
||||||
WOLFSSL_API const char* wolfSSL_get_cipher_name(WOLFSSL* ssl);
|
WOLFSSL_API const char* wolfSSL_get_cipher_name(WOLFSSL* ssl);
|
||||||
WOLFSSL_API const char* wolfSSL_get_cipher_name_from_suite(const unsigned char,
|
WOLFSSL_API const char* wolfSSL_get_cipher_name_from_suite(const unsigned char,
|
||||||
const unsigned char);
|
const unsigned char);
|
||||||
|
|
Loading…
Reference in New Issue