Fixes for ./configure CC="g++" --enable-all && make
. Resolves issues with implicit casts and use of reserved template
keyword.
This commit is contained in:
parent
6132176715
commit
b07dfa425d
46
src/ssl.c
46
src/ssl.c
@ -24965,13 +24965,13 @@ void wolfSSL_ASN1_TYPE_set(WOLFSSL_ASN1_TYPE *a, int type, void *value)
|
||||
}
|
||||
switch (type) {
|
||||
case V_ASN1_OBJECT:
|
||||
a->value.object = value;
|
||||
a->value.object = (WOLFSSL_ASN1_OBJECT*)value;
|
||||
break;
|
||||
case V_ASN1_UTCTIME:
|
||||
a->value.utctime = value;
|
||||
a->value.utctime = (WOLFSSL_ASN1_TIME*)value;
|
||||
break;
|
||||
case V_ASN1_GENERALIZEDTIME:
|
||||
a->value.generalizedtime = value;
|
||||
a->value.generalizedtime = (WOLFSSL_ASN1_TIME*)value;
|
||||
break;
|
||||
default:
|
||||
WOLFSSL_MSG("Unknown or unsupported ASN1_TYPE");
|
||||
@ -28202,20 +28202,20 @@ WOLFSSL_ASN1_INTEGER* wolfSSL_BN_to_ASN1_INTEGER(const WOLFSSL_BIGNUM *bn, WOLFS
|
||||
}
|
||||
|
||||
#ifdef OPENSSL_ALL
|
||||
void *wolfSSL_ASN1_item_new(const WOLFSSL_ASN1_ITEM *template)
|
||||
void *wolfSSL_ASN1_item_new(const WOLFSSL_ASN1_ITEM *tpl)
|
||||
{
|
||||
void *ret = NULL;
|
||||
const WOLFSSL_ASN1_TEMPLATE *member = NULL;
|
||||
size_t i;
|
||||
WOLFSSL_ENTER("wolfSSL_ASN1_item_new");
|
||||
if (!template) {
|
||||
if (!tpl) {
|
||||
return NULL;
|
||||
}
|
||||
if (!(ret = XMALLOC(template->size, NULL, DYNAMIC_TYPE_OPENSSL))) {
|
||||
if (!(ret = XMALLOC(tpl->size, NULL, DYNAMIC_TYPE_OPENSSL))) {
|
||||
return NULL;
|
||||
}
|
||||
XMEMSET(ret, 0, template->size);
|
||||
for (member = template->members, i = 0; i < template->mcount;
|
||||
XMEMSET(ret, 0, tpl->size);
|
||||
for (member = tpl->members, i = 0; i < tpl->mcount;
|
||||
member++, i++) {
|
||||
switch (member->type) {
|
||||
case WOLFSSL_X509_ALGOR_ASN1:
|
||||
@ -28243,17 +28243,17 @@ void *wolfSSL_ASN1_item_new(const WOLFSSL_ASN1_ITEM *template)
|
||||
}
|
||||
return ret;
|
||||
error:
|
||||
wolfSSL_ASN1_item_free(ret, template);
|
||||
wolfSSL_ASN1_item_free(ret, tpl);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void wolfSSL_ASN1_item_free(void *val, const WOLFSSL_ASN1_ITEM *template)
|
||||
void wolfSSL_ASN1_item_free(void *val, const WOLFSSL_ASN1_ITEM *tpl)
|
||||
{
|
||||
const WOLFSSL_ASN1_TEMPLATE *member = NULL;
|
||||
size_t i;
|
||||
WOLFSSL_ENTER("wolfSSL_ASN1_item_free");
|
||||
if (val) {
|
||||
for (member = template->members, i = 0; i < template->mcount;
|
||||
for (member = tpl->members, i = 0; i < tpl->mcount;
|
||||
member++, i++) {
|
||||
switch (member->type) {
|
||||
case WOLFSSL_X509_ALGOR_ASN1:
|
||||
@ -28341,20 +28341,20 @@ static int i2dProcessMembers(const void *src, byte *buf,
|
||||
}
|
||||
|
||||
int wolfSSL_ASN1_item_i2d(const void *src, byte **dest,
|
||||
const WOLFSSL_ASN1_ITEM *template)
|
||||
const WOLFSSL_ASN1_ITEM *tpl)
|
||||
{
|
||||
int len = 0;
|
||||
byte *buf = NULL;
|
||||
|
||||
WOLFSSL_ENTER("wolfSSL_ASN1_item_i2d");
|
||||
|
||||
if (!src || !template) {
|
||||
if (!src || !tpl) {
|
||||
WOLFSSL_LEAVE("wolfSSL_ASN1_item_i2d", WOLFSSL_FAILURE);
|
||||
return WOLFSSL_FAILURE;
|
||||
}
|
||||
|
||||
if (dest && !*dest) {
|
||||
len = wolfSSL_ASN1_item_i2d(src, NULL, template);
|
||||
len = wolfSSL_ASN1_item_i2d(src, NULL, tpl);
|
||||
if (!len) {
|
||||
goto error;
|
||||
}
|
||||
@ -28365,18 +28365,18 @@ int wolfSSL_ASN1_item_i2d(const void *src, byte **dest,
|
||||
len = 0;
|
||||
}
|
||||
|
||||
switch (template->type) {
|
||||
switch (tpl->type) {
|
||||
case ASN_SEQUENCE:
|
||||
{
|
||||
int seq_len = i2dProcessMembers(src, NULL, template->members,
|
||||
template->mcount);
|
||||
int seq_len = i2dProcessMembers(src, NULL, tpl->members,
|
||||
tpl->mcount);
|
||||
if (!seq_len) {
|
||||
goto error;
|
||||
}
|
||||
len += SetSequence(seq_len, bufLenOrNull(buf, len));
|
||||
if (buf &&
|
||||
i2dProcessMembers(src, bufLenOrNull(buf, len), template->members,
|
||||
template->mcount) != seq_len) {
|
||||
i2dProcessMembers(src, bufLenOrNull(buf, len), tpl->members,
|
||||
tpl->mcount) != seq_len) {
|
||||
WOLFSSL_MSG("Inconsistent sequence length");
|
||||
goto error;
|
||||
}
|
||||
@ -34996,7 +34996,7 @@ int wolfSSL_RSA_padding_add_PKCS1_PSS(WOLFSSL_RSA *rsa, unsigned char *EM,
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
hashType = wolfSSL_EVP_md2macType(hashAlg);
|
||||
hashType = (enum wc_HashType)wolfSSL_EVP_md2macType(hashAlg);
|
||||
if (hashType < WC_HASH_TYPE_NONE || hashType > WC_HASH_TYPE_MAX) {
|
||||
WOLFSSL_MSG("wolfSSL_EVP_md2macType error");
|
||||
goto cleanup;
|
||||
@ -35034,9 +35034,9 @@ int wolfSSL_RSA_padding_add_PKCS1_PSS(WOLFSSL_RSA *rsa, unsigned char *EM,
|
||||
}
|
||||
}
|
||||
|
||||
if (wc_RsaPad_ex(mHash, wolfSSL_EVP_MD_size(hashAlg), EM, emLen,
|
||||
if (wc_RsaPad_ex(mHash, hashLen, EM, emLen,
|
||||
RSA_BLOCK_TYPE_1, rng, WC_RSA_PSS_PAD,
|
||||
wolfSSL_EVP_md2macType(hashAlg), mgf, NULL, 0, saltLen,
|
||||
hashType, mgf, NULL, 0, saltLen,
|
||||
wolfSSL_BN_num_bits(rsa->n), NULL) != MP_OKAY) {
|
||||
WOLFSSL_MSG("wc_RsaPad_ex error");
|
||||
goto cleanup;
|
||||
@ -35103,7 +35103,7 @@ int wolfSSL_RSA_verify_PKCS1_PSS(WOLFSSL_RSA *rsa, const unsigned char *mHash,
|
||||
return WOLFSSL_FAILURE;
|
||||
}
|
||||
|
||||
hashType = wolfSSL_EVP_md2macType(hashAlg);
|
||||
hashType = (enum wc_HashType)wolfSSL_EVP_md2macType(hashAlg);
|
||||
if (hashType < WC_HASH_TYPE_NONE || hashType > WC_HASH_TYPE_MAX) {
|
||||
WOLFSSL_MSG("wolfSSL_EVP_md2macType error");
|
||||
return WOLFSSL_FAILURE;
|
||||
|
@ -28619,7 +28619,7 @@ static void test_wolfSSL_EVP_PKEY_derive(void)
|
||||
AssertIntEQ(EVP_PKEY_derive_init(ctx), 1);
|
||||
AssertIntEQ(EVP_PKEY_derive_set_peer(ctx, peerkey), 1);
|
||||
AssertIntEQ(EVP_PKEY_derive(ctx, NULL, &skeylen), 1);
|
||||
AssertNotNull(skey = XMALLOC(skeylen, NULL, DYNAMIC_TYPE_OPENSSL));
|
||||
AssertNotNull(skey = (unsigned char*)XMALLOC(skeylen, NULL, DYNAMIC_TYPE_OPENSSL));
|
||||
AssertIntEQ(EVP_PKEY_derive(ctx, skey, &skeylen), 1);
|
||||
|
||||
EVP_PKEY_CTX_free(ctx);
|
||||
@ -28639,7 +28639,7 @@ static void test_wolfSSL_EVP_PKEY_derive(void)
|
||||
AssertIntEQ(EVP_PKEY_derive_init(ctx), 1);
|
||||
AssertIntEQ(EVP_PKEY_derive_set_peer(ctx, peerkey), 1);
|
||||
AssertIntEQ(EVP_PKEY_derive(ctx, NULL, &skeylen), 1);
|
||||
AssertNotNull(skey = XMALLOC(skeylen, NULL, DYNAMIC_TYPE_OPENSSL));
|
||||
AssertNotNull(skey = (unsigned char*)XMALLOC(skeylen, NULL, DYNAMIC_TYPE_OPENSSL));
|
||||
AssertIntEQ(EVP_PKEY_derive(ctx, skey, &skeylen), 1);
|
||||
|
||||
EVP_PKEY_CTX_free(ctx);
|
||||
@ -31063,7 +31063,7 @@ static void test_wolfSSL_IMPLEMENT_ASN1_FUNCTIONS()
|
||||
AssertIntGT((len = EC_POINT_point2oct(group, point, POINT_CONVERSION_UNCOMPRESSED,
|
||||
NULL, 0, NULL)), 0);
|
||||
#endif
|
||||
AssertNotNull(der = XMALLOC(len, NULL, DYNAMIC_TYPE_ASN1));
|
||||
AssertNotNull(der = (unsigned char*)XMALLOC(len, NULL, DYNAMIC_TYPE_ASN1));
|
||||
#ifdef HAVE_COMP_KEY
|
||||
AssertIntEQ(EC_POINT_point2oct(group, point, POINT_CONVERSION_COMPRESSED,
|
||||
der, len, NULL), len);
|
||||
|
@ -123,10 +123,10 @@ typedef enum {
|
||||
sizeof(type) \
|
||||
};
|
||||
|
||||
WOLFSSL_API void *wolfSSL_ASN1_item_new(const WOLFSSL_ASN1_ITEM *template);
|
||||
WOLFSSL_API void wolfSSL_ASN1_item_free(void *val, const WOLFSSL_ASN1_ITEM *template);
|
||||
WOLFSSL_API void *wolfSSL_ASN1_item_new(const WOLFSSL_ASN1_ITEM *tpl);
|
||||
WOLFSSL_API void wolfSSL_ASN1_item_free(void *val, const WOLFSSL_ASN1_ITEM *tpl);
|
||||
WOLFSSL_API int wolfSSL_ASN1_item_i2d(const void *src, byte **dest,
|
||||
const WOLFSSL_ASN1_ITEM *template);
|
||||
const WOLFSSL_ASN1_ITEM *tpl);
|
||||
|
||||
/* Need function declaration otherwise compiler complains */
|
||||
#define IMPLEMENT_ASN1_FUNCTIONS(type) \
|
||||
|
Loading…
Reference in New Issue
Block a user