fix for g++ build

This commit is contained in:
Jacob Barthelmeh
2021-02-12 23:26:54 +07:00
parent 7e72fafd44
commit 1c852f60ab
3 changed files with 15 additions and 12 deletions

View File

@ -11957,11 +11957,8 @@ int wolfSSL_export_keying_material(WOLFSSL *ssl,
const unsigned char *context, size_t contextLen,
int use_context)
{
byte* seed = NULL;
/* clientRandom + serverRandom
* OR
* clientRandom + serverRandom + ctx len encoding + ctx */
word32 seedLen = !use_context ? SEED_LEN : SEED_LEN + 2 + (word32)contextLen;
byte* seed = NULL;
word32 seedLen;
const struct ForbiddenLabels* fl;
WOLFSSL_ENTER("wolfSSL_export_keying_material");
@ -11972,6 +11969,12 @@ int wolfSSL_export_keying_material(WOLFSSL *ssl,
return WOLFSSL_FAILURE;
}
/* clientRandom + serverRandom
* OR
* clientRandom + serverRandom + ctx len encoding + ctx */
seedLen = !use_context ? (word32)SEED_LEN :
(word32)SEED_LEN + 2 + (word32)contextLen;
if (ssl->options.saveArrays == 0 || ssl->arrays == NULL) {
WOLFSSL_MSG("To export keying material wolfSSL needs to keep handshake "
"data. Call wolfSSL_KeepArrays before attempting to "

View File

@ -777,24 +777,24 @@ int Tls13_Exporter(WOLFSSL* ssl, unsigned char *out, size_t outLen,
switch (ssl->specs.mac_algorithm) {
#ifndef NO_SHA256
case sha256_mac:
hashType = WC_SHA256;
hashLen = WC_SHA256_DIGEST_SIZE;
hashType = WC_HASH_TYPE_SHA256;
hashLen = WC_SHA256_DIGEST_SIZE;
emptyHash = emptySHA256Hash;
break;
#endif
#ifdef WOLFSSL_SHA384
case sha384_mac:
hashType = WC_SHA384;
hashLen = WC_SHA384_DIGEST_SIZE;
hashType = WC_HASH_TYPE_SHA384;
hashLen = WC_SHA384_DIGEST_SIZE;
emptyHash = emptySHA384Hash;
break;
#endif
#ifdef WOLFSSL_TLS13_SHA512
case sha512_mac:
hashType = WC_SHA512;
hashLen = WC_SHA512_DIGEST_SIZE;
hashType = WC_HASH_TYPE_SHA512;
hashLen = WC_SHA512_DIGEST_SIZE;
emptyHash = emptySHA512Hash;
break;
#endif

View File

@ -40234,7 +40234,7 @@ static void test_export_keying_material(void)
start_thread(test_server_nofail, &server_args, &serverThread);
wait_tcp_ready(&server_args);
test_client_nofail(&client_args, test_export_keying_material_cb);
test_client_nofail(&client_args, (void*)test_export_keying_material_cb);
join_thread(serverThread);
AssertTrue(client_args.return_code);