forked from wolfSSL/wolfssl
Old Compiler Warning Cleanup (GCC 4.0.2)
Fixed a lot of shadowed global values. Some were prototype and function declaration parameter name conflicts. Some conflicted with typenames. Some conflicted with globals in libc.
This commit is contained in:
@@ -11536,7 +11536,7 @@ int LoadCertByIssuer(WOLFSSL_X509_STORE* store, X509_NAME* issuer, int type)
|
|||||||
char* filename = NULL;
|
char* filename = NULL;
|
||||||
const char* post = "";
|
const char* post = "";
|
||||||
byte* pbuf = NULL;
|
byte* pbuf = NULL;
|
||||||
int len, num, i, index;
|
int len, num, i, idx;
|
||||||
byte suffix = 0;
|
byte suffix = 0;
|
||||||
int retHash = NOT_COMPILED_IN;
|
int retHash = NOT_COMPILED_IN;
|
||||||
byte dgt[WC_MAX_DIGEST_SIZE];
|
byte dgt[WC_MAX_DIGEST_SIZE];
|
||||||
@@ -11592,10 +11592,10 @@ int LoadCertByIssuer(WOLFSSL_X509_STORE* store, X509_NAME* issuer, int type)
|
|||||||
}
|
}
|
||||||
|
|
||||||
hash_tmp.hash_value = hash;
|
hash_tmp.hash_value = hash;
|
||||||
index = wolfSSL_sk_BY_DIR_HASH_find(entry->hashes, &hash_tmp);
|
idx = wolfSSL_sk_BY_DIR_HASH_find(entry->hashes, &hash_tmp);
|
||||||
if (index >= 0) {
|
if (idx >= 0) {
|
||||||
WOLFSSL_MSG("find hashed CRL in list");
|
WOLFSSL_MSG("find hashed CRL in list");
|
||||||
ph = wolfSSL_sk_BY_DIR_HASH_value(entry->hashes, index);
|
ph = wolfSSL_sk_BY_DIR_HASH_value(entry->hashes, idx);
|
||||||
suffix = ph->last_suffix;
|
suffix = ph->last_suffix;
|
||||||
} else {
|
} else {
|
||||||
ph = NULL;
|
ph = NULL;
|
||||||
|
108
src/ssl.c
108
src/ssl.c
@@ -1439,7 +1439,7 @@ int wolfSSL_set_secret(WOLFSSL* ssl, word16 epoch,
|
|||||||
|
|
||||||
#ifdef WOLFSSL_DTLS
|
#ifdef WOLFSSL_DTLS
|
||||||
|
|
||||||
int wolfSSL_mcast_peer_add(WOLFSSL* ssl, word16 peerId, int remove)
|
int wolfSSL_mcast_peer_add(WOLFSSL* ssl, word16 peerId, int sub)
|
||||||
{
|
{
|
||||||
WOLFSSL_DTLS_PEERSEQ* p = NULL;
|
WOLFSSL_DTLS_PEERSEQ* p = NULL;
|
||||||
int ret = WOLFSSL_SUCCESS;
|
int ret = WOLFSSL_SUCCESS;
|
||||||
@@ -1449,7 +1449,7 @@ int wolfSSL_mcast_peer_add(WOLFSSL* ssl, word16 peerId, int remove)
|
|||||||
if (ssl == NULL || peerId > 255)
|
if (ssl == NULL || peerId > 255)
|
||||||
return BAD_FUNC_ARG;
|
return BAD_FUNC_ARG;
|
||||||
|
|
||||||
if (!remove) {
|
if (!sub) {
|
||||||
/* Make sure it isn't already present, while keeping the first
|
/* Make sure it isn't already present, while keeping the first
|
||||||
* open spot. */
|
* open spot. */
|
||||||
for (i = 0; i < WOLFSSL_DTLS_PEERSEQ_SZ; i++) {
|
for (i = 0; i < WOLFSSL_DTLS_PEERSEQ_SZ; i++) {
|
||||||
@@ -21427,11 +21427,11 @@ int wolfSSL_sk_X509_CRL_num(WOLF_STACK_OF(WOLFSSL_X509)* sk)
|
|||||||
#if defined(OPENSSL_ALL) || defined(WOLFSSL_QT)
|
#if defined(OPENSSL_ALL) || defined(WOLFSSL_QT)
|
||||||
/* return 1 on success 0 on fail */
|
/* return 1 on success 0 on fail */
|
||||||
int wolfSSL_sk_ACCESS_DESCRIPTION_push(WOLF_STACK_OF(ACCESS_DESCRIPTION)* sk,
|
int wolfSSL_sk_ACCESS_DESCRIPTION_push(WOLF_STACK_OF(ACCESS_DESCRIPTION)* sk,
|
||||||
WOLFSSL_ACCESS_DESCRIPTION* access)
|
WOLFSSL_ACCESS_DESCRIPTION* a)
|
||||||
{
|
{
|
||||||
WOLFSSL_ENTER("wolfSSL_sk_ACCESS_DESCRIPTION_push");
|
WOLFSSL_ENTER("wolfSSL_sk_ACCESS_DESCRIPTION_push");
|
||||||
|
|
||||||
return wolfSSL_sk_push(sk, access);
|
return wolfSSL_sk_push(sk, a);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Frees all nodes in ACCESS_DESCRIPTION stack
|
/* Frees all nodes in ACCESS_DESCRIPTION stack
|
||||||
@@ -21471,19 +21471,19 @@ void wolfSSL_AUTHORITY_INFO_ACCESS_pop_free(
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void wolfSSL_ACCESS_DESCRIPTION_free(WOLFSSL_ACCESS_DESCRIPTION* access)
|
void wolfSSL_ACCESS_DESCRIPTION_free(WOLFSSL_ACCESS_DESCRIPTION* a)
|
||||||
{
|
{
|
||||||
WOLFSSL_ENTER("wolfSSL_ACCESS_DESCRIPTION_free");
|
WOLFSSL_ENTER("wolfSSL_ACCESS_DESCRIPTION_free");
|
||||||
if (access == NULL)
|
if (a == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (access->method)
|
if (a->method)
|
||||||
wolfSSL_ASN1_OBJECT_free(access->method);
|
wolfSSL_ASN1_OBJECT_free(a->method);
|
||||||
if (access->location)
|
if (a->location)
|
||||||
wolfSSL_GENERAL_NAME_free(access->location);
|
wolfSSL_GENERAL_NAME_free(a->location);
|
||||||
XFREE(access, NULL, DYNAMIC_TYPE_X509_EXT);
|
XFREE(a, NULL, DYNAMIC_TYPE_X509_EXT);
|
||||||
|
|
||||||
/* access = NULL, don't try to access or double free it */
|
/* a = NULL, don't try to a or double free it */
|
||||||
}
|
}
|
||||||
#endif /* OPENSSL_ALL || WOLFSSL_QT */
|
#endif /* OPENSSL_ALL || WOLFSSL_QT */
|
||||||
|
|
||||||
@@ -22405,7 +22405,7 @@ void wolfSSL_sk_X509_EXTENSION_pop_free(
|
|||||||
*/
|
*/
|
||||||
WOLFSSL_EC_KEY *wolfSSL_EC_KEY_dup(const WOLFSSL_EC_KEY *src)
|
WOLFSSL_EC_KEY *wolfSSL_EC_KEY_dup(const WOLFSSL_EC_KEY *src)
|
||||||
{
|
{
|
||||||
WOLFSSL_EC_KEY *dup;
|
WOLFSSL_EC_KEY *newKey;
|
||||||
ecc_key *key, *srcKey;
|
ecc_key *key, *srcKey;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
@@ -22418,16 +22418,16 @@ WOLFSSL_EC_KEY *wolfSSL_EC_KEY_dup(const WOLFSSL_EC_KEY *src)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
dup = wolfSSL_EC_KEY_new();
|
newKey = wolfSSL_EC_KEY_new();
|
||||||
if (dup == NULL) {
|
if (newKey == NULL) {
|
||||||
WOLFSSL_MSG("wolfSSL_EC_KEY_new error");
|
WOLFSSL_MSG("wolfSSL_EC_KEY_new error");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
key = (ecc_key*)dup->internal;
|
key = (ecc_key*)newKey->internal;
|
||||||
if (key == NULL) {
|
if (key == NULL) {
|
||||||
WOLFSSL_MSG("ecc_key NULL error");
|
WOLFSSL_MSG("ecc_key NULL error");
|
||||||
wolfSSL_EC_KEY_free(dup);
|
wolfSSL_EC_KEY_free(newKey);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
srcKey = (ecc_key*)src->internal;
|
srcKey = (ecc_key*)src->internal;
|
||||||
@@ -22437,7 +22437,7 @@ WOLFSSL_EC_KEY *wolfSSL_EC_KEY_dup(const WOLFSSL_EC_KEY *src)
|
|||||||
ret = wc_ecc_copy_point(&srcKey->pubkey, &key->pubkey);
|
ret = wc_ecc_copy_point(&srcKey->pubkey, &key->pubkey);
|
||||||
if (ret != MP_OKAY) {
|
if (ret != MP_OKAY) {
|
||||||
WOLFSSL_MSG("wc_ecc_copy_point error");
|
WOLFSSL_MSG("wc_ecc_copy_point error");
|
||||||
wolfSSL_EC_KEY_free(dup);
|
wolfSSL_EC_KEY_free(newKey);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -22445,7 +22445,7 @@ WOLFSSL_EC_KEY *wolfSSL_EC_KEY_dup(const WOLFSSL_EC_KEY *src)
|
|||||||
ret = mp_copy(&srcKey->k, &key->k);
|
ret = mp_copy(&srcKey->k, &key->k);
|
||||||
if (ret != MP_OKAY) {
|
if (ret != MP_OKAY) {
|
||||||
WOLFSSL_MSG("mp_copy error");
|
WOLFSSL_MSG("mp_copy error");
|
||||||
wolfSSL_EC_KEY_free(dup);
|
wolfSSL_EC_KEY_free(newKey);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -22464,73 +22464,73 @@ WOLFSSL_EC_KEY *wolfSSL_EC_KEY_dup(const WOLFSSL_EC_KEY *src)
|
|||||||
key->flags = srcKey->flags;
|
key->flags = srcKey->flags;
|
||||||
|
|
||||||
/* Copy group */
|
/* Copy group */
|
||||||
if (dup->group == NULL) {
|
if (newKey->group == NULL) {
|
||||||
WOLFSSL_MSG("EC_GROUP_new_by_curve_name error");
|
WOLFSSL_MSG("EC_GROUP_new_by_curve_name error");
|
||||||
wolfSSL_EC_KEY_free(dup);
|
wolfSSL_EC_KEY_free(newKey);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
dup->group->curve_idx = src->group->curve_idx;
|
newKey->group->curve_idx = src->group->curve_idx;
|
||||||
dup->group->curve_nid = src->group->curve_nid;
|
newKey->group->curve_nid = src->group->curve_nid;
|
||||||
dup->group->curve_oid = src->group->curve_oid;
|
newKey->group->curve_oid = src->group->curve_oid;
|
||||||
|
|
||||||
/* Copy public key */
|
/* Copy public key */
|
||||||
if (src->pub_key->internal == NULL || dup->pub_key->internal == NULL) {
|
if (src->pub_key->internal == NULL || newKey->pub_key->internal == NULL) {
|
||||||
WOLFSSL_MSG("NULL pub_key error");
|
WOLFSSL_MSG("NULL pub_key error");
|
||||||
wolfSSL_EC_KEY_free(dup);
|
wolfSSL_EC_KEY_free(newKey);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Copy public key internal */
|
/* Copy public key internal */
|
||||||
ret = wc_ecc_copy_point((ecc_point*)src->pub_key->internal, \
|
ret = wc_ecc_copy_point((ecc_point*)src->pub_key->internal, \
|
||||||
(ecc_point*)dup->pub_key->internal);
|
(ecc_point*)newKey->pub_key->internal);
|
||||||
if (ret != MP_OKAY) {
|
if (ret != MP_OKAY) {
|
||||||
WOLFSSL_MSG("ecc_copy_point error");
|
WOLFSSL_MSG("ecc_copy_point error");
|
||||||
wolfSSL_EC_KEY_free(dup);
|
wolfSSL_EC_KEY_free(newKey);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Copy X, Y, Z */
|
/* Copy X, Y, Z */
|
||||||
dup->pub_key->X = wolfSSL_BN_dup(src->pub_key->X);
|
newKey->pub_key->X = wolfSSL_BN_dup(src->pub_key->X);
|
||||||
if (!dup->pub_key->X && src->pub_key->X) {
|
if (!newKey->pub_key->X && src->pub_key->X) {
|
||||||
WOLFSSL_MSG("Error copying EC_POINT");
|
WOLFSSL_MSG("Error copying EC_POINT");
|
||||||
wolfSSL_EC_KEY_free(dup);
|
wolfSSL_EC_KEY_free(newKey);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
dup->pub_key->Y = wolfSSL_BN_dup(src->pub_key->Y);
|
newKey->pub_key->Y = wolfSSL_BN_dup(src->pub_key->Y);
|
||||||
if (!dup->pub_key->Y && src->pub_key->Y) {
|
if (!newKey->pub_key->Y && src->pub_key->Y) {
|
||||||
WOLFSSL_MSG("Error copying EC_POINT");
|
WOLFSSL_MSG("Error copying EC_POINT");
|
||||||
wolfSSL_EC_KEY_free(dup);
|
wolfSSL_EC_KEY_free(newKey);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
dup->pub_key->Z = wolfSSL_BN_dup(src->pub_key->Z);
|
newKey->pub_key->Z = wolfSSL_BN_dup(src->pub_key->Z);
|
||||||
if (!dup->pub_key->Z && src->pub_key->Z) {
|
if (!newKey->pub_key->Z && src->pub_key->Z) {
|
||||||
WOLFSSL_MSG("Error copying EC_POINT");
|
WOLFSSL_MSG("Error copying EC_POINT");
|
||||||
wolfSSL_EC_KEY_free(dup);
|
wolfSSL_EC_KEY_free(newKey);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
dup->pub_key->inSet = src->pub_key->inSet;
|
newKey->pub_key->inSet = src->pub_key->inSet;
|
||||||
dup->pub_key->exSet = src->pub_key->exSet;
|
newKey->pub_key->exSet = src->pub_key->exSet;
|
||||||
dup->pkcs8HeaderSz = src->pkcs8HeaderSz;
|
newKey->pkcs8HeaderSz = src->pkcs8HeaderSz;
|
||||||
|
|
||||||
/* Copy private key */
|
/* Copy private key */
|
||||||
if (src->priv_key->internal == NULL || dup->priv_key->internal == NULL) {
|
if (src->priv_key->internal == NULL || newKey->priv_key->internal == NULL) {
|
||||||
WOLFSSL_MSG("NULL priv_key error");
|
WOLFSSL_MSG("NULL priv_key error");
|
||||||
wolfSSL_EC_KEY_free(dup);
|
wolfSSL_EC_KEY_free(newKey);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Free priv_key before call to dup function */
|
/* Free priv_key before call to newKey function */
|
||||||
wolfSSL_BN_free(dup->priv_key);
|
wolfSSL_BN_free(newKey->priv_key);
|
||||||
dup->priv_key = wolfSSL_BN_dup(src->priv_key);
|
newKey->priv_key = wolfSSL_BN_dup(src->priv_key);
|
||||||
if (dup->priv_key == NULL) {
|
if (newKey->priv_key == NULL) {
|
||||||
WOLFSSL_MSG("BN_dup error");
|
WOLFSSL_MSG("BN_newKey error");
|
||||||
wolfSSL_EC_KEY_free(dup);
|
wolfSSL_EC_KEY_free(newKey);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return dup;
|
return newKey;
|
||||||
|
|
||||||
}
|
}
|
||||||
#endif /* HAVE_ECC */
|
#endif /* HAVE_ECC */
|
||||||
@@ -46359,17 +46359,17 @@ static int get_ex_new_index(int class_index)
|
|||||||
static int ssl_idx = 0;
|
static int ssl_idx = 0;
|
||||||
static int x509_idx = 0;
|
static int x509_idx = 0;
|
||||||
|
|
||||||
int index = -1;
|
int idx = -1;
|
||||||
|
|
||||||
switch(class_index) {
|
switch(class_index) {
|
||||||
case CRYPTO_EX_INDEX_SSL:
|
case CRYPTO_EX_INDEX_SSL:
|
||||||
index = ssl_idx++;
|
idx = ssl_idx++;
|
||||||
break;
|
break;
|
||||||
case CRYPTO_EX_INDEX_SSL_CTX:
|
case CRYPTO_EX_INDEX_SSL_CTX:
|
||||||
index = ctx_idx++;
|
idx = ctx_idx++;
|
||||||
break;
|
break;
|
||||||
case CRYPTO_EX_INDEX_X509:
|
case CRYPTO_EX_INDEX_X509:
|
||||||
index = x509_idx++;
|
idx = x509_idx++;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* following class indexes are not supoprted */
|
/* following class indexes are not supoprted */
|
||||||
@@ -46389,7 +46389,7 @@ static int get_ex_new_index(int class_index)
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return index;
|
return idx;
|
||||||
}
|
}
|
||||||
#endif /* HAVE_EX_DATA || WOLFSSL_WPAS_SMALL */
|
#endif /* HAVE_EX_DATA || WOLFSSL_WPAS_SMALL */
|
||||||
|
|
||||||
|
32
tests/api.c
32
tests/api.c
@@ -9170,12 +9170,12 @@ static int test_wc_InitBlake2b (void)
|
|||||||
int ret = 0;
|
int ret = 0;
|
||||||
#ifdef HAVE_BLAKE2
|
#ifdef HAVE_BLAKE2
|
||||||
|
|
||||||
Blake2b blake2b;
|
Blake2b blake;
|
||||||
|
|
||||||
printf(testingFmt, "wc_InitBlake2B()");
|
printf(testingFmt, "wc_InitBlake2B()");
|
||||||
|
|
||||||
/* Test good arg. */
|
/* Test good arg. */
|
||||||
ret = wc_InitBlake2b(&blake2b, 64);
|
ret = wc_InitBlake2b(&blake, 64);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
ret = WOLFSSL_FATAL_ERROR;
|
ret = WOLFSSL_FATAL_ERROR;
|
||||||
}
|
}
|
||||||
@@ -9200,7 +9200,7 @@ static int test_wc_InitBlake2b (void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!ret) {
|
if (!ret) {
|
||||||
ret = wc_InitBlake2b(&blake2b, 128);
|
ret = wc_InitBlake2b(&blake, 128);
|
||||||
if (ret == 0) {
|
if (ret == 0) {
|
||||||
ret = WOLFSSL_FATAL_ERROR;
|
ret = WOLFSSL_FATAL_ERROR;
|
||||||
} else {
|
} else {
|
||||||
@@ -9218,7 +9218,7 @@ static int test_wc_InitBlake2b (void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!ret) {
|
if (!ret) {
|
||||||
ret = wc_InitBlake2b(&blake2b, 0);
|
ret = wc_InitBlake2b(&blake, 0);
|
||||||
if (ret == 0) {
|
if (ret == 0) {
|
||||||
ret = WOLFSSL_FATAL_ERROR;
|
ret = WOLFSSL_FATAL_ERROR;
|
||||||
} else {
|
} else {
|
||||||
@@ -9239,7 +9239,7 @@ static int test_wc_InitBlake2b_WithKey (void)
|
|||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
#ifdef HAVE_BLAKE2
|
#ifdef HAVE_BLAKE2
|
||||||
Blake2b blake2b;
|
Blake2b blake;
|
||||||
word32 digestSz = BLAKE2B_KEYBYTES;
|
word32 digestSz = BLAKE2B_KEYBYTES;
|
||||||
byte key[BLAKE2B_KEYBYTES];
|
byte key[BLAKE2B_KEYBYTES];
|
||||||
word32 keylen = BLAKE2B_KEYBYTES;
|
word32 keylen = BLAKE2B_KEYBYTES;
|
||||||
@@ -9249,7 +9249,7 @@ static int test_wc_InitBlake2b_WithKey (void)
|
|||||||
printf(testingFmt, "wc_InitBlake2b_WithKey()");
|
printf(testingFmt, "wc_InitBlake2b_WithKey()");
|
||||||
|
|
||||||
/* Test good arg. */
|
/* Test good arg. */
|
||||||
ret = wc_InitBlake2b_WithKey(&blake2b, digestSz, key, keylen);
|
ret = wc_InitBlake2b_WithKey(&blake, digestSz, key, keylen);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
ret = WOLFSSL_FATAL_ERROR;
|
ret = WOLFSSL_FATAL_ERROR;
|
||||||
}
|
}
|
||||||
@@ -9261,13 +9261,13 @@ static int test_wc_InitBlake2b_WithKey (void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ret == 0) {
|
if (ret == 0) {
|
||||||
ret = wc_InitBlake2b_WithKey(&blake2b, digestSz, key, 256);
|
ret = wc_InitBlake2b_WithKey(&blake, digestSz, key, 256);
|
||||||
if (ret == BAD_FUNC_ARG) {
|
if (ret == BAD_FUNC_ARG) {
|
||||||
ret = 0;
|
ret = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ret == 0) {
|
if (ret == 0) {
|
||||||
ret = wc_InitBlake2b_WithKey(&blake2b, digestSz, NULL, keylen);
|
ret = wc_InitBlake2b_WithKey(&blake, digestSz, NULL, keylen);
|
||||||
}
|
}
|
||||||
|
|
||||||
printf(resultFmt, ret == 0 ? passed : failed);
|
printf(resultFmt, ret == 0 ? passed : failed);
|
||||||
@@ -9283,7 +9283,7 @@ static int test_wc_InitBlake2s_WithKey (void)
|
|||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
#ifdef HAVE_BLAKE2S
|
#ifdef HAVE_BLAKE2S
|
||||||
Blake2s blake2s;
|
Blake2s blake;
|
||||||
word32 digestSz = BLAKE2S_KEYBYTES;
|
word32 digestSz = BLAKE2S_KEYBYTES;
|
||||||
byte *key = (byte*)"01234567890123456789012345678901";
|
byte *key = (byte*)"01234567890123456789012345678901";
|
||||||
word32 keylen = BLAKE2S_KEYBYTES;
|
word32 keylen = BLAKE2S_KEYBYTES;
|
||||||
@@ -9291,7 +9291,7 @@ static int test_wc_InitBlake2s_WithKey (void)
|
|||||||
printf(testingFmt, "wc_InitBlake2s_WithKey()");
|
printf(testingFmt, "wc_InitBlake2s_WithKey()");
|
||||||
|
|
||||||
/* Test good arg. */
|
/* Test good arg. */
|
||||||
ret = wc_InitBlake2s_WithKey(&blake2s, digestSz, key, keylen);
|
ret = wc_InitBlake2s_WithKey(&blake, digestSz, key, keylen);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
ret = WOLFSSL_FATAL_ERROR;
|
ret = WOLFSSL_FATAL_ERROR;
|
||||||
}
|
}
|
||||||
@@ -9303,13 +9303,13 @@ static int test_wc_InitBlake2s_WithKey (void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ret == 0) {
|
if (ret == 0) {
|
||||||
ret = wc_InitBlake2s_WithKey(&blake2s, digestSz, key, 256);
|
ret = wc_InitBlake2s_WithKey(&blake, digestSz, key, 256);
|
||||||
if (ret == BAD_FUNC_ARG) {
|
if (ret == BAD_FUNC_ARG) {
|
||||||
ret = 0;
|
ret = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ret == 0) {
|
if (ret == 0) {
|
||||||
ret = wc_InitBlake2s_WithKey(&blake2s, digestSz, NULL, keylen);
|
ret = wc_InitBlake2s_WithKey(&blake, digestSz, NULL, keylen);
|
||||||
}
|
}
|
||||||
|
|
||||||
printf(resultFmt, ret == 0 ? passed : failed);
|
printf(resultFmt, ret == 0 ? passed : failed);
|
||||||
@@ -35140,7 +35140,7 @@ static void test_wolfSSL_sk_SSL_CIPHER(void)
|
|||||||
!defined(NO_FILESYSTEM) && !defined(NO_RSA)
|
!defined(NO_FILESYSTEM) && !defined(NO_RSA)
|
||||||
SSL* ssl;
|
SSL* ssl;
|
||||||
SSL_CTX* ctx;
|
SSL_CTX* ctx;
|
||||||
STACK_OF(SSL_CIPHER) *sk, *dup;
|
STACK_OF(SSL_CIPHER) *sk, *dupSk;
|
||||||
|
|
||||||
printf(testingFmt, "wolfSSL_sk_SSL_CIPHER_*()");
|
printf(testingFmt, "wolfSSL_sk_SSL_CIPHER_*()");
|
||||||
|
|
||||||
@@ -35153,13 +35153,13 @@ static void test_wolfSSL_sk_SSL_CIPHER(void)
|
|||||||
AssertTrue(SSL_CTX_use_PrivateKey_file(ctx, svrKeyFile, SSL_FILETYPE_PEM));
|
AssertTrue(SSL_CTX_use_PrivateKey_file(ctx, svrKeyFile, SSL_FILETYPE_PEM));
|
||||||
AssertNotNull(ssl = SSL_new(ctx));
|
AssertNotNull(ssl = SSL_new(ctx));
|
||||||
AssertNotNull(sk = SSL_get_ciphers(ssl));
|
AssertNotNull(sk = SSL_get_ciphers(ssl));
|
||||||
AssertNotNull(dup = sk_SSL_CIPHER_dup(sk));
|
AssertNotNull(dupSk = sk_SSL_CIPHER_dup(sk));
|
||||||
AssertIntGT(sk_SSL_CIPHER_num(sk), 0);
|
AssertIntGT(sk_SSL_CIPHER_num(sk), 0);
|
||||||
AssertIntEQ(sk_SSL_CIPHER_num(sk), sk_SSL_CIPHER_num(dup));
|
AssertIntEQ(sk_SSL_CIPHER_num(sk), sk_SSL_CIPHER_num(dupSk));
|
||||||
|
|
||||||
/* error case because connection has not been established yet */
|
/* error case because connection has not been established yet */
|
||||||
AssertIntEQ(sk_SSL_CIPHER_find(sk, SSL_get_current_cipher(ssl)), -1);
|
AssertIntEQ(sk_SSL_CIPHER_find(sk, SSL_get_current_cipher(ssl)), -1);
|
||||||
sk_SSL_CIPHER_free(dup);
|
sk_SSL_CIPHER_free(dupSk);
|
||||||
|
|
||||||
/* sk is pointer to internal struct that should be free'd in SSL_free */
|
/* sk is pointer to internal struct that should be free'd in SSL_free */
|
||||||
SSL_free(ssl);
|
SSL_free(ssl);
|
||||||
|
@@ -1707,17 +1707,17 @@ int wc_SetEccsiPair(EccsiKey* key, const mp_int* ssk, const ecc_point* pvt)
|
|||||||
*
|
*
|
||||||
* @param [in] a MP integer to fix.
|
* @param [in] a MP integer to fix.
|
||||||
* @param [in] order MP integer representing order of curve.
|
* @param [in] order MP integer representing order of curve.
|
||||||
* @param [in] max Maximum number of bytes to encode into.
|
* @param [in] m Maximum number of bytes to encode into.
|
||||||
* @param [out] r MP integer that is the result after fixing.
|
* @param [out] r MP integer that is the result after fixing.
|
||||||
* @return 0 on success.
|
* @return 0 on success.
|
||||||
* @return MEMORY_E when dynamic memory allocation fails.
|
* @return MEMORY_E when dynamic memory allocation fails.
|
||||||
*/
|
*/
|
||||||
static int eccsi_fit_to_octets(const mp_int* a, mp_int* order, int max,
|
static int eccsi_fit_to_octets(const mp_int* a, mp_int* order, int m,
|
||||||
mp_int* r)
|
mp_int* r)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
if (mp_count_bits(a) > max * 8) {
|
if (mp_count_bits(a) > m * 8) {
|
||||||
err = mp_sub(order, (mp_int*)a, r);
|
err = mp_sub(order, (mp_int*)a, r);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -1737,16 +1737,16 @@ static int eccsi_fit_to_octets(const mp_int* a, mp_int* order, int max,
|
|||||||
*
|
*
|
||||||
* @param [in] a MP integer to fix.
|
* @param [in] a MP integer to fix.
|
||||||
* @param [in] order MP integer representing order of curve.
|
* @param [in] order MP integer representing order of curve.
|
||||||
* @param [in] max Maximum number of bytes to encode into.
|
* @param [in] m Maximum number of bytes to encode into.
|
||||||
* @param [out] r MP integer that is the result after fixing.
|
* @param [out] r MP integer that is the result after fixing.
|
||||||
* @return 0 on success.
|
* @return 0 on success.
|
||||||
* @return MEMORY_E when dynamic memory allocation fails.
|
* @return MEMORY_E when dynamic memory allocation fails.
|
||||||
*/
|
*/
|
||||||
static int eccsi_fit_to_octets(const mp_int* a, const mp_int* order, int max,
|
static int eccsi_fit_to_octets(const mp_int* a, const mp_int* order, int m,
|
||||||
mp_int* r)
|
mp_int* r)
|
||||||
{
|
{
|
||||||
(void)order;
|
(void)order;
|
||||||
(void)max;
|
(void)m;
|
||||||
|
|
||||||
/* Duplicate line to stop static analyzer complaining. */
|
/* Duplicate line to stop static analyzer complaining. */
|
||||||
return mp_copy(a, r);
|
return mp_copy(a, r);
|
||||||
|
@@ -1769,7 +1769,7 @@ WOLFSSL_LOCAL int CheckVersion(WOLFSSL *ssl, ProtocolVersion pv);
|
|||||||
WOLFSSL_LOCAL int PickHashSigAlgo(WOLFSSL* ssl, const byte* hashSigAlgo,
|
WOLFSSL_LOCAL int PickHashSigAlgo(WOLFSSL* ssl, const byte* hashSigAlgo,
|
||||||
word32 hashSigAlgoSz);
|
word32 hashSigAlgoSz);
|
||||||
#ifdef WOLF_CRYPTO_CB
|
#ifdef WOLF_CRYPTO_CB
|
||||||
WOLFSSL_LOCAL int CreateDevPrivateKey(void** pkey, byte* buffer, word32 length,
|
WOLFSSL_LOCAL int CreateDevPrivateKey(void** pkey, byte* data, word32 length,
|
||||||
int hsType, int label, int id,
|
int hsType, int label, int id,
|
||||||
void* heap, int devId);
|
void* heap, int devId);
|
||||||
#endif
|
#endif
|
||||||
@@ -2389,8 +2389,8 @@ WOLFSSL_LOCAL word16 TLSX_SNI_GetRequest(TLSX* extensions, byte type,
|
|||||||
#ifndef NO_WOLFSSL_SERVER
|
#ifndef NO_WOLFSSL_SERVER
|
||||||
WOLFSSL_LOCAL void TLSX_SNI_SetOptions(TLSX* extensions, byte type,
|
WOLFSSL_LOCAL void TLSX_SNI_SetOptions(TLSX* extensions, byte type,
|
||||||
byte options);
|
byte options);
|
||||||
WOLFSSL_LOCAL int TLSX_SNI_GetFromBuffer(const byte* buffer, word32 bufferSz,
|
WOLFSSL_LOCAL int TLSX_SNI_GetFromBuffer(const byte* clientHello,
|
||||||
byte type, byte* sni, word32* inOutSz);
|
word32 helloSz, byte type, byte* sni, word32* inOutSz);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* HAVE_SNI */
|
#endif /* HAVE_SNI */
|
||||||
@@ -2489,7 +2489,7 @@ WOLFSSL_LOCAL int TLSX_CSR2_InitRequests(TLSX* extensions, DecodedCert* cert,
|
|||||||
byte isPeer, void* heap);
|
byte isPeer, void* heap);
|
||||||
#endif
|
#endif
|
||||||
WOLFSSL_LOCAL void* TLSX_CSR2_GetRequest(TLSX* extensions, byte status_type,
|
WOLFSSL_LOCAL void* TLSX_CSR2_GetRequest(TLSX* extensions, byte status_type,
|
||||||
byte index);
|
byte idx);
|
||||||
WOLFSSL_LOCAL int TLSX_CSR2_ForceRequest(WOLFSSL* ssl);
|
WOLFSSL_LOCAL int TLSX_CSR2_ForceRequest(WOLFSSL* ssl);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -4659,7 +4659,7 @@ WOLFSSL_API void SSL_ResourceFree(WOLFSSL*); /* Micrium uses */
|
|||||||
void FreeTimeoutInfo(TimeoutInfo*, void*);
|
void FreeTimeoutInfo(TimeoutInfo*, void*);
|
||||||
WOLFSSL_LOCAL
|
WOLFSSL_LOCAL
|
||||||
void AddPacketInfo(WOLFSSL* ssl, const char* name, int type,
|
void AddPacketInfo(WOLFSSL* ssl, const char* name, int type,
|
||||||
const byte* data, int sz, int write, void* heap);
|
const byte* data, int sz, int written, void* heap);
|
||||||
WOLFSSL_LOCAL
|
WOLFSSL_LOCAL
|
||||||
void AddLateName(const char*, TimeoutInfo*);
|
void AddLateName(const char*, TimeoutInfo*);
|
||||||
WOLFSSL_LOCAL
|
WOLFSSL_LOCAL
|
||||||
|
@@ -1339,7 +1339,7 @@ WOLFSSL_API int wolfSSL_sk_push(WOLFSSL_STACK *st, const void *data);
|
|||||||
#if defined(OPENSSL_ALL) || defined(WOLFSSL_QT)
|
#if defined(OPENSSL_ALL) || defined(WOLFSSL_QT)
|
||||||
WOLFSSL_API int wolfSSL_sk_ACCESS_DESCRIPTION_push(
|
WOLFSSL_API int wolfSSL_sk_ACCESS_DESCRIPTION_push(
|
||||||
WOLF_STACK_OF(ACCESS_DESCRIPTION)* sk,
|
WOLF_STACK_OF(ACCESS_DESCRIPTION)* sk,
|
||||||
WOLFSSL_ACCESS_DESCRIPTION* access);
|
WOLFSSL_ACCESS_DESCRIPTION* a);
|
||||||
#endif /* defined(OPENSSL_ALL) || defined(WOLFSSL_QT) */
|
#endif /* defined(OPENSSL_ALL) || defined(WOLFSSL_QT) */
|
||||||
|
|
||||||
typedef WOLF_STACK_OF(WOLFSSL_GENERAL_NAME) WOLFSSL_GENERAL_NAMES;
|
typedef WOLF_STACK_OF(WOLFSSL_GENERAL_NAME) WOLFSSL_GENERAL_NAMES;
|
||||||
@@ -1401,7 +1401,7 @@ WOLFSSL_API WOLFSSL_ACCESS_DESCRIPTION* wolfSSL_sk_ACCESS_DESCRIPTION_value(
|
|||||||
WOLFSSL_API void wolfSSL_sk_ACCESS_DESCRIPTION_free(WOLFSSL_STACK* sk);
|
WOLFSSL_API void wolfSSL_sk_ACCESS_DESCRIPTION_free(WOLFSSL_STACK* sk);
|
||||||
WOLFSSL_API void wolfSSL_sk_ACCESS_DESCRIPTION_pop_free(WOLFSSL_STACK* sk,
|
WOLFSSL_API void wolfSSL_sk_ACCESS_DESCRIPTION_pop_free(WOLFSSL_STACK* sk,
|
||||||
void (*f) (WOLFSSL_ACCESS_DESCRIPTION*));
|
void (*f) (WOLFSSL_ACCESS_DESCRIPTION*));
|
||||||
WOLFSSL_API void wolfSSL_ACCESS_DESCRIPTION_free(WOLFSSL_ACCESS_DESCRIPTION* access);
|
WOLFSSL_API void wolfSSL_ACCESS_DESCRIPTION_free(WOLFSSL_ACCESS_DESCRIPTION* a);
|
||||||
WOLFSSL_API void wolfSSL_sk_X509_EXTENSION_pop_free(
|
WOLFSSL_API void wolfSSL_sk_X509_EXTENSION_pop_free(
|
||||||
WOLF_STACK_OF(WOLFSSL_X509_EXTENSION)* sk,
|
WOLF_STACK_OF(WOLFSSL_X509_EXTENSION)* sk,
|
||||||
void (*f) (WOLFSSL_X509_EXTENSION*));
|
void (*f) (WOLFSSL_X509_EXTENSION*));
|
||||||
|
@@ -530,7 +530,7 @@ WOLFSSL_API int wc_GetDateInfo(const byte* certDate, int certDateSz,
|
|||||||
const byte** date, byte* format, int* length);
|
const byte** date, byte* format, int* length);
|
||||||
#ifndef NO_ASN_TIME
|
#ifndef NO_ASN_TIME
|
||||||
WOLFSSL_API int wc_GetDateAsCalendarTime(const byte* date, int length,
|
WOLFSSL_API int wc_GetDateAsCalendarTime(const byte* date, int length,
|
||||||
byte format, struct tm* time);
|
byte format, struct tm* timearg);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(WOLFSSL_PEM_TO_DER) || defined(WOLFSSL_DER_TO_PEM)
|
#if defined(WOLFSSL_PEM_TO_DER) || defined(WOLFSSL_DER_TO_PEM)
|
||||||
|
@@ -621,10 +621,10 @@ int wc_ecc_sign_set_k(const byte* k, word32 klen, ecc_key* key);
|
|||||||
#ifdef HAVE_ECC_VERIFY
|
#ifdef HAVE_ECC_VERIFY
|
||||||
WOLFSSL_API
|
WOLFSSL_API
|
||||||
int wc_ecc_verify_hash(const byte* sig, word32 siglen, const byte* hash,
|
int wc_ecc_verify_hash(const byte* sig, word32 siglen, const byte* hash,
|
||||||
word32 hashlen, int* stat, ecc_key* key);
|
word32 hashlen, int* res, ecc_key* key);
|
||||||
WOLFSSL_API
|
WOLFSSL_API
|
||||||
int wc_ecc_verify_hash_ex(mp_int *r, mp_int *s, const byte* hash,
|
int wc_ecc_verify_hash_ex(mp_int *r, mp_int *s, const byte* hash,
|
||||||
word32 hashlen, int* stat, ecc_key* key);
|
word32 hashlen, int* res, ecc_key* key);
|
||||||
#endif /* HAVE_ECC_VERIFY */
|
#endif /* HAVE_ECC_VERIFY */
|
||||||
|
|
||||||
WOLFSSL_API
|
WOLFSSL_API
|
||||||
|
@@ -140,18 +140,18 @@ int wc_ed25519_sign_msg_ex(const byte* in, word32 inLen, byte* out,
|
|||||||
#ifdef HAVE_ED25519_VERIFY
|
#ifdef HAVE_ED25519_VERIFY
|
||||||
WOLFSSL_API
|
WOLFSSL_API
|
||||||
int wc_ed25519_verify_msg(const byte* sig, word32 sigLen, const byte* msg,
|
int wc_ed25519_verify_msg(const byte* sig, word32 sigLen, const byte* msg,
|
||||||
word32 msgLen, int* stat, ed25519_key* key);
|
word32 msgLen, int* res, ed25519_key* key);
|
||||||
WOLFSSL_API
|
WOLFSSL_API
|
||||||
int wc_ed25519ctx_verify_msg(const byte* sig, word32 sigLen, const byte* msg,
|
int wc_ed25519ctx_verify_msg(const byte* sig, word32 sigLen, const byte* msg,
|
||||||
word32 msgLen, int* stat, ed25519_key* key,
|
word32 msgLen, int* res, ed25519_key* key,
|
||||||
const byte* context, byte contextLen);
|
const byte* context, byte contextLen);
|
||||||
WOLFSSL_API
|
WOLFSSL_API
|
||||||
int wc_ed25519ph_verify_hash(const byte* sig, word32 sigLen, const byte* hash,
|
int wc_ed25519ph_verify_hash(const byte* sig, word32 sigLen, const byte* hash,
|
||||||
word32 hashLen, int* stat, ed25519_key* key,
|
word32 hashLen, int* res, ed25519_key* key,
|
||||||
const byte* context, byte contextLen);
|
const byte* context, byte contextLen);
|
||||||
WOLFSSL_API
|
WOLFSSL_API
|
||||||
int wc_ed25519ph_verify_msg(const byte* sig, word32 sigLen, const byte* msg,
|
int wc_ed25519ph_verify_msg(const byte* sig, word32 sigLen, const byte* msg,
|
||||||
word32 msgLen, int* stat, ed25519_key* key,
|
word32 msgLen, int* res, ed25519_key* key,
|
||||||
const byte* context, byte contextLen);
|
const byte* context, byte contextLen);
|
||||||
WOLFSSL_API
|
WOLFSSL_API
|
||||||
int wc_ed25519_verify_msg_ex(const byte* sig, word32 sigLen, const byte* msg,
|
int wc_ed25519_verify_msg_ex(const byte* sig, word32 sigLen, const byte* msg,
|
||||||
|
@@ -137,19 +137,19 @@ int wc_ed448_verify_msg_update(const byte* msgSegment, word32 msgSegmentLen,
|
|||||||
ed448_key* key);
|
ed448_key* key);
|
||||||
WOLFSSL_API
|
WOLFSSL_API
|
||||||
int wc_ed448_verify_msg_final(const byte* sig, word32 sigLen,
|
int wc_ed448_verify_msg_final(const byte* sig, word32 sigLen,
|
||||||
int* stat, ed448_key* key);
|
int* res, ed448_key* key);
|
||||||
#endif /* WOLFSSL_ED448_STREAMING_VERIFY */
|
#endif /* WOLFSSL_ED448_STREAMING_VERIFY */
|
||||||
WOLFSSL_API
|
WOLFSSL_API
|
||||||
int wc_ed448_verify_msg(const byte* sig, word32 sigLen, const byte* msg,
|
int wc_ed448_verify_msg(const byte* sig, word32 sigLen, const byte* msg,
|
||||||
word32 msgLen, int* stat, ed448_key* key,
|
word32 msgLen, int* res, ed448_key* key,
|
||||||
const byte* context, byte contextLen);
|
const byte* context, byte contextLen);
|
||||||
WOLFSSL_API
|
WOLFSSL_API
|
||||||
int wc_ed448ph_verify_hash(const byte* sig, word32 sigLen, const byte* hash,
|
int wc_ed448ph_verify_hash(const byte* sig, word32 sigLen, const byte* hash,
|
||||||
word32 hashLen, int* stat, ed448_key* key,
|
word32 hashLen, int* res, ed448_key* key,
|
||||||
const byte* context, byte contextLen);
|
const byte* context, byte contextLen);
|
||||||
WOLFSSL_API
|
WOLFSSL_API
|
||||||
int wc_ed448ph_verify_msg(const byte* sig, word32 sigLen, const byte* msg,
|
int wc_ed448ph_verify_msg(const byte* sig, word32 sigLen, const byte* msg,
|
||||||
word32 msgLen, int* stat, ed448_key* key,
|
word32 msgLen, int* res, ed448_key* key,
|
||||||
const byte* context, byte contextLen);
|
const byte* context, byte contextLen);
|
||||||
#endif /* HAVE_ED448_VERIFY */
|
#endif /* HAVE_ED448_VERIFY */
|
||||||
WOLFSSL_API
|
WOLFSSL_API
|
||||||
|
@@ -116,9 +116,9 @@ WOLFSSL_API void wolfSSL_Debugging_OFF(void);
|
|||||||
WOLFSSL_LOCAL int wc_LoggingCleanup(void);
|
WOLFSSL_LOCAL int wc_LoggingCleanup(void);
|
||||||
WOLFSSL_LOCAL int wc_AddErrorNode(int error, int line, char* buf,
|
WOLFSSL_LOCAL int wc_AddErrorNode(int error, int line, char* buf,
|
||||||
char* file);
|
char* file);
|
||||||
WOLFSSL_LOCAL int wc_PeekErrorNode(int index, const char **file,
|
WOLFSSL_LOCAL int wc_PeekErrorNode(int idx, const char **file,
|
||||||
const char **reason, int *line);
|
const char **reason, int *line);
|
||||||
WOLFSSL_LOCAL void wc_RemoveErrorNode(int index);
|
WOLFSSL_LOCAL void wc_RemoveErrorNode(int idx);
|
||||||
WOLFSSL_LOCAL void wc_ClearErrorNodes(void);
|
WOLFSSL_LOCAL void wc_ClearErrorNodes(void);
|
||||||
WOLFSSL_LOCAL int wc_PullErrorNode(const char **file, const char **reason,
|
WOLFSSL_LOCAL int wc_PullErrorNode(const char **file, const char **reason,
|
||||||
int *line);
|
int *line);
|
||||||
|
Reference in New Issue
Block a user