mirror of https://github.com/wolfSSL/wolfssl
Code review
This commit is contained in:
parent
3edfcfe162
commit
fbe79d7317
|
@ -14865,10 +14865,13 @@ int wolfSSL_dtls_cid_get_tx(WOLFSSL* ssl, unsigned char* buffer,
|
|||
ciphersuites and signature algorithms.
|
||||
|
||||
\param [in] ssl The WOLFSSL object to extract the lists from.
|
||||
\param [out] suites Raw and unfiltered list of client ciphersuites
|
||||
\param [out] suiteSz Size of suites in bytes
|
||||
\param [out] hashSigAlgo Raw and unfiltered list of client signature algorithms
|
||||
\param [out] hashSigAlgoSz Size of hashSigAlgo in bytes
|
||||
\param [out] optional suites Raw and unfiltered list of client ciphersuites
|
||||
\param [out] optional suiteSz Size of suites in bytes
|
||||
\param [out] optional hashSigAlgo Raw and unfiltered list of client
|
||||
signature algorithms
|
||||
\param [out] optional hashSigAlgoSz Size of hashSigAlgo in bytes
|
||||
\return WOLFSSL_SUCCESS when suites available
|
||||
\return WOLFSSL_FAILURE when suites not available
|
||||
|
||||
_Example_
|
||||
\code
|
||||
|
@ -14893,7 +14896,7 @@ int wolfSSL_dtls_cid_get_tx(WOLFSSL* ssl, unsigned char* buffer,
|
|||
\sa wolfSSL_get_ciphersuite_info
|
||||
\sa wolfSSL_get_sigalg_info
|
||||
*/
|
||||
void wolfSSL_get_client_suites_sigalgs(const WOLFSSL* ssl,
|
||||
int wolfSSL_get_client_suites_sigalgs(const WOLFSSL* ssl,
|
||||
const byte** suites, word16* suiteSz,
|
||||
const byte** hashSigAlgo, word16* hashSigAlgoSz);
|
||||
|
||||
|
@ -14936,6 +14939,10 @@ WOLFSSL_CIPHERSUITE_INFO wolfSSL_get_ciphersuite_info(byte first,
|
|||
\param [out] hashAlgo The enum wc_HashType of the MAC algorithm
|
||||
\param [out] sigAlgo The enum Key_Sum of the authentication algorithm
|
||||
|
||||
\return 0 when info was correctly set
|
||||
\return BAD_FUNC_ARG when either input paramters are NULL or the bytes
|
||||
are not a recognized sigalg suite
|
||||
|
||||
_Example_
|
||||
\code
|
||||
enum wc_HashType hashAlgo;
|
||||
|
@ -14953,5 +14960,5 @@ WOLFSSL_CIPHERSUITE_INFO wolfSSL_get_ciphersuite_info(byte first,
|
|||
\sa wolfSSL_get_client_suites_sigalgs
|
||||
\sa wolfSSL_get_ciphersuite_info
|
||||
*/
|
||||
void wolfSSL_get_sigalg_info(byte first, byte second,
|
||||
int wolfSSL_get_sigalg_info(byte first, byte second,
|
||||
int* hashAlgo, int* sigAlgo);
|
||||
|
|
13
src/ssl.c
13
src/ssl.c
|
@ -16296,7 +16296,7 @@ int wolfSSL_set_compression(WOLFSSL* ssl)
|
|||
ctx->certSetupCbArg = arg;
|
||||
}
|
||||
|
||||
void wolfSSL_get_client_suites_sigalgs(const WOLFSSL* ssl,
|
||||
int wolfSSL_get_client_suites_sigalgs(const WOLFSSL* ssl,
|
||||
const byte** suites, word16* suiteSz,
|
||||
const byte** hashSigAlgo, word16* hashSigAlgoSz)
|
||||
{
|
||||
|
@ -16320,7 +16320,9 @@ int wolfSSL_set_compression(WOLFSSL* ssl)
|
|||
*hashSigAlgo = ssl->clSuites->hashSigAlgo;
|
||||
*hashSigAlgoSz = ssl->clSuites->hashSigAlgoSz;
|
||||
}
|
||||
return WOLFSSL_SUCCESS;
|
||||
}
|
||||
return WOLFSSL_FAILURE;
|
||||
}
|
||||
WOLFSSL_CIPHERSUITE_INFO wolfSSL_get_ciphersuite_info(byte first,
|
||||
byte second)
|
||||
|
@ -16344,7 +16346,7 @@ int wolfSSL_set_compression(WOLFSSL* ssl)
|
|||
* @param hashAlgo The enum wc_HashType of the MAC algorithm
|
||||
* @param sigAlgo The enum Key_Sum of the authentication algorithm
|
||||
*/
|
||||
void wolfSSL_get_sigalg_info(byte first, byte second,
|
||||
int wolfSSL_get_sigalg_info(byte first, byte second,
|
||||
int* hashAlgo, int* sigAlgo)
|
||||
{
|
||||
byte input[2];
|
||||
|
@ -16352,7 +16354,7 @@ int wolfSSL_set_compression(WOLFSSL* ssl)
|
|||
byte sigType;
|
||||
|
||||
if (hashAlgo == NULL || sigAlgo == NULL)
|
||||
return;
|
||||
return BAD_FUNC_ARG;
|
||||
|
||||
input[0] = first;
|
||||
input[1] = second;
|
||||
|
@ -16406,7 +16408,7 @@ int wolfSSL_set_compression(WOLFSSL* ssl)
|
|||
default:
|
||||
*hashAlgo = WC_HASH_TYPE_NONE;
|
||||
*sigAlgo = 0;
|
||||
return;
|
||||
return BAD_FUNC_ARG;
|
||||
}
|
||||
|
||||
/* cast so that compiler reminds us of unimplemented values */
|
||||
|
@ -16446,8 +16448,9 @@ int wolfSSL_set_compression(WOLFSSL* ssl)
|
|||
default:
|
||||
*hashAlgo = WC_HASH_TYPE_NONE;
|
||||
*sigAlgo = 0;
|
||||
return;
|
||||
return BAD_FUNC_ARG;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
18
tests/api.c
18
tests/api.c
|
@ -44843,8 +44843,9 @@ static int test_wolfSSL_cert_cb_dyn_ciphers_certCB(WOLFSSL* ssl, void* arg)
|
|||
|
||||
(void)arg;
|
||||
|
||||
wolfSSL_get_client_suites_sigalgs(ssl, &suites, &suiteSz, &hashSigAlgo,
|
||||
&hashSigAlgoSz);
|
||||
if (wolfSSL_get_client_suites_sigalgs(ssl, &suites, &suiteSz, &hashSigAlgo,
|
||||
&hashSigAlgoSz) != WOLFSSL_SUCCESS)
|
||||
return 0;
|
||||
if (suites == NULL || suiteSz == 0 || hashSigAlgo == NULL ||
|
||||
hashSigAlgoSz == 0)
|
||||
return 0;
|
||||
|
@ -44868,8 +44869,9 @@ static int test_wolfSSL_cert_cb_dyn_ciphers_certCB(WOLFSSL* ssl, void* arg)
|
|||
int hashAlgo;
|
||||
int sigAlgo;
|
||||
|
||||
wolfSSL_get_sigalg_info(hashSigAlgo[idx+0], hashSigAlgo[idx+1],
|
||||
&hashAlgo, &sigAlgo);
|
||||
if (wolfSSL_get_sigalg_info(hashSigAlgo[idx+0], hashSigAlgo[idx+1],
|
||||
&hashAlgo, &sigAlgo) != 0)
|
||||
return 0;
|
||||
|
||||
if (sigAlgo == RSAk || sigAlgo == RSAPSSk)
|
||||
haveRSA = 1;
|
||||
|
@ -45081,8 +45083,8 @@ static int test_wolfSSL_sigalg_info(void)
|
|||
int hashAlgo;
|
||||
int sigAlgo;
|
||||
|
||||
wolfSSL_get_sigalg_info(hashSigAlgo[idx+0], hashSigAlgo[idx+1],
|
||||
&hashAlgo, &sigAlgo);
|
||||
ExpectIntEQ(wolfSSL_get_sigalg_info(hashSigAlgo[idx+0],
|
||||
hashSigAlgo[idx+1], &hashAlgo, &sigAlgo), 0);
|
||||
|
||||
ExpectIntNE(hashAlgo, 0);
|
||||
ExpectIntNE(sigAlgo, 0);
|
||||
|
@ -45094,8 +45096,8 @@ static int test_wolfSSL_sigalg_info(void)
|
|||
int hashAlgo;
|
||||
int sigAlgo;
|
||||
|
||||
wolfSSL_get_sigalg_info(hashSigAlgo[idx+0], hashSigAlgo[idx+1],
|
||||
&hashAlgo, &sigAlgo);
|
||||
ExpectIntEQ(wolfSSL_get_sigalg_info(hashSigAlgo[idx+0],
|
||||
hashSigAlgo[idx+1], &hashAlgo, &sigAlgo), 0);
|
||||
|
||||
ExpectIntNE(hashAlgo, 0);
|
||||
}
|
||||
|
|
|
@ -2121,7 +2121,7 @@ WOLFSSL_API void wolfSSL_CTX_set_client_cert_cb(WOLFSSL_CTX *ctx, client_cert_cb
|
|||
typedef int (*CertSetupCallback)(WOLFSSL* ssl, void*);
|
||||
WOLFSSL_API void wolfSSL_CTX_set_cert_cb(WOLFSSL_CTX* ctx,
|
||||
CertSetupCallback cb, void *arg);
|
||||
WOLFSSL_API void wolfSSL_get_client_suites_sigalgs(const WOLFSSL* ssl,
|
||||
WOLFSSL_API int wolfSSL_get_client_suites_sigalgs(const WOLFSSL* ssl,
|
||||
const byte** suites, word16* suiteSz,
|
||||
const byte** hashSigAlgo, word16* hashSigAlgoSz);
|
||||
typedef struct WOLFSSL_CIPHERSUITE_INFO {
|
||||
|
@ -2132,7 +2132,7 @@ typedef struct WOLFSSL_CIPHERSUITE_INFO {
|
|||
} WOLFSSL_CIPHERSUITE_INFO;
|
||||
WOLFSSL_API WOLFSSL_CIPHERSUITE_INFO wolfSSL_get_ciphersuite_info(byte first,
|
||||
byte second);
|
||||
WOLFSSL_API void wolfSSL_get_sigalg_info(byte first,
|
||||
WOLFSSL_API int wolfSSL_get_sigalg_info(byte first,
|
||||
byte second, int* hashAlgo, int* sigAlgo);
|
||||
WOLFSSL_LOCAL int CertSetupCbWrapper(WOLFSSL* ssl);
|
||||
|
||||
|
|
Loading…
Reference in New Issue