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) {
|
switch (type) {
|
||||||
case V_ASN1_OBJECT:
|
case V_ASN1_OBJECT:
|
||||||
a->value.object = value;
|
a->value.object = (WOLFSSL_ASN1_OBJECT*)value;
|
||||||
break;
|
break;
|
||||||
case V_ASN1_UTCTIME:
|
case V_ASN1_UTCTIME:
|
||||||
a->value.utctime = value;
|
a->value.utctime = (WOLFSSL_ASN1_TIME*)value;
|
||||||
break;
|
break;
|
||||||
case V_ASN1_GENERALIZEDTIME:
|
case V_ASN1_GENERALIZEDTIME:
|
||||||
a->value.generalizedtime = value;
|
a->value.generalizedtime = (WOLFSSL_ASN1_TIME*)value;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
WOLFSSL_MSG("Unknown or unsupported ASN1_TYPE");
|
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
|
#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;
|
void *ret = NULL;
|
||||||
const WOLFSSL_ASN1_TEMPLATE *member = NULL;
|
const WOLFSSL_ASN1_TEMPLATE *member = NULL;
|
||||||
size_t i;
|
size_t i;
|
||||||
WOLFSSL_ENTER("wolfSSL_ASN1_item_new");
|
WOLFSSL_ENTER("wolfSSL_ASN1_item_new");
|
||||||
if (!template) {
|
if (!tpl) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if (!(ret = XMALLOC(template->size, NULL, DYNAMIC_TYPE_OPENSSL))) {
|
if (!(ret = XMALLOC(tpl->size, NULL, DYNAMIC_TYPE_OPENSSL))) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
XMEMSET(ret, 0, template->size);
|
XMEMSET(ret, 0, tpl->size);
|
||||||
for (member = template->members, i = 0; i < template->mcount;
|
for (member = tpl->members, i = 0; i < tpl->mcount;
|
||||||
member++, i++) {
|
member++, i++) {
|
||||||
switch (member->type) {
|
switch (member->type) {
|
||||||
case WOLFSSL_X509_ALGOR_ASN1:
|
case WOLFSSL_X509_ALGOR_ASN1:
|
||||||
@ -28243,17 +28243,17 @@ void *wolfSSL_ASN1_item_new(const WOLFSSL_ASN1_ITEM *template)
|
|||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
error:
|
error:
|
||||||
wolfSSL_ASN1_item_free(ret, template);
|
wolfSSL_ASN1_item_free(ret, tpl);
|
||||||
return NULL;
|
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;
|
const WOLFSSL_ASN1_TEMPLATE *member = NULL;
|
||||||
size_t i;
|
size_t i;
|
||||||
WOLFSSL_ENTER("wolfSSL_ASN1_item_free");
|
WOLFSSL_ENTER("wolfSSL_ASN1_item_free");
|
||||||
if (val) {
|
if (val) {
|
||||||
for (member = template->members, i = 0; i < template->mcount;
|
for (member = tpl->members, i = 0; i < tpl->mcount;
|
||||||
member++, i++) {
|
member++, i++) {
|
||||||
switch (member->type) {
|
switch (member->type) {
|
||||||
case WOLFSSL_X509_ALGOR_ASN1:
|
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,
|
int wolfSSL_ASN1_item_i2d(const void *src, byte **dest,
|
||||||
const WOLFSSL_ASN1_ITEM *template)
|
const WOLFSSL_ASN1_ITEM *tpl)
|
||||||
{
|
{
|
||||||
int len = 0;
|
int len = 0;
|
||||||
byte *buf = NULL;
|
byte *buf = NULL;
|
||||||
|
|
||||||
WOLFSSL_ENTER("wolfSSL_ASN1_item_i2d");
|
WOLFSSL_ENTER("wolfSSL_ASN1_item_i2d");
|
||||||
|
|
||||||
if (!src || !template) {
|
if (!src || !tpl) {
|
||||||
WOLFSSL_LEAVE("wolfSSL_ASN1_item_i2d", WOLFSSL_FAILURE);
|
WOLFSSL_LEAVE("wolfSSL_ASN1_item_i2d", WOLFSSL_FAILURE);
|
||||||
return WOLFSSL_FAILURE;
|
return WOLFSSL_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dest && !*dest) {
|
if (dest && !*dest) {
|
||||||
len = wolfSSL_ASN1_item_i2d(src, NULL, template);
|
len = wolfSSL_ASN1_item_i2d(src, NULL, tpl);
|
||||||
if (!len) {
|
if (!len) {
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
@ -28365,18 +28365,18 @@ int wolfSSL_ASN1_item_i2d(const void *src, byte **dest,
|
|||||||
len = 0;
|
len = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (template->type) {
|
switch (tpl->type) {
|
||||||
case ASN_SEQUENCE:
|
case ASN_SEQUENCE:
|
||||||
{
|
{
|
||||||
int seq_len = i2dProcessMembers(src, NULL, template->members,
|
int seq_len = i2dProcessMembers(src, NULL, tpl->members,
|
||||||
template->mcount);
|
tpl->mcount);
|
||||||
if (!seq_len) {
|
if (!seq_len) {
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
len += SetSequence(seq_len, bufLenOrNull(buf, len));
|
len += SetSequence(seq_len, bufLenOrNull(buf, len));
|
||||||
if (buf &&
|
if (buf &&
|
||||||
i2dProcessMembers(src, bufLenOrNull(buf, len), template->members,
|
i2dProcessMembers(src, bufLenOrNull(buf, len), tpl->members,
|
||||||
template->mcount) != seq_len) {
|
tpl->mcount) != seq_len) {
|
||||||
WOLFSSL_MSG("Inconsistent sequence length");
|
WOLFSSL_MSG("Inconsistent sequence length");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
@ -34996,7 +34996,7 @@ int wolfSSL_RSA_padding_add_PKCS1_PSS(WOLFSSL_RSA *rsa, unsigned char *EM,
|
|||||||
goto cleanup;
|
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) {
|
if (hashType < WC_HASH_TYPE_NONE || hashType > WC_HASH_TYPE_MAX) {
|
||||||
WOLFSSL_MSG("wolfSSL_EVP_md2macType error");
|
WOLFSSL_MSG("wolfSSL_EVP_md2macType error");
|
||||||
goto cleanup;
|
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,
|
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_BN_num_bits(rsa->n), NULL) != MP_OKAY) {
|
||||||
WOLFSSL_MSG("wc_RsaPad_ex error");
|
WOLFSSL_MSG("wc_RsaPad_ex error");
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@ -35103,7 +35103,7 @@ int wolfSSL_RSA_verify_PKCS1_PSS(WOLFSSL_RSA *rsa, const unsigned char *mHash,
|
|||||||
return WOLFSSL_FAILURE;
|
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) {
|
if (hashType < WC_HASH_TYPE_NONE || hashType > WC_HASH_TYPE_MAX) {
|
||||||
WOLFSSL_MSG("wolfSSL_EVP_md2macType error");
|
WOLFSSL_MSG("wolfSSL_EVP_md2macType error");
|
||||||
return WOLFSSL_FAILURE;
|
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_init(ctx), 1);
|
||||||
AssertIntEQ(EVP_PKEY_derive_set_peer(ctx, peerkey), 1);
|
AssertIntEQ(EVP_PKEY_derive_set_peer(ctx, peerkey), 1);
|
||||||
AssertIntEQ(EVP_PKEY_derive(ctx, NULL, &skeylen), 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);
|
AssertIntEQ(EVP_PKEY_derive(ctx, skey, &skeylen), 1);
|
||||||
|
|
||||||
EVP_PKEY_CTX_free(ctx);
|
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_init(ctx), 1);
|
||||||
AssertIntEQ(EVP_PKEY_derive_set_peer(ctx, peerkey), 1);
|
AssertIntEQ(EVP_PKEY_derive_set_peer(ctx, peerkey), 1);
|
||||||
AssertIntEQ(EVP_PKEY_derive(ctx, NULL, &skeylen), 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);
|
AssertIntEQ(EVP_PKEY_derive(ctx, skey, &skeylen), 1);
|
||||||
|
|
||||||
EVP_PKEY_CTX_free(ctx);
|
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,
|
AssertIntGT((len = EC_POINT_point2oct(group, point, POINT_CONVERSION_UNCOMPRESSED,
|
||||||
NULL, 0, NULL)), 0);
|
NULL, 0, NULL)), 0);
|
||||||
#endif
|
#endif
|
||||||
AssertNotNull(der = XMALLOC(len, NULL, DYNAMIC_TYPE_ASN1));
|
AssertNotNull(der = (unsigned char*)XMALLOC(len, NULL, DYNAMIC_TYPE_ASN1));
|
||||||
#ifdef HAVE_COMP_KEY
|
#ifdef HAVE_COMP_KEY
|
||||||
AssertIntEQ(EC_POINT_point2oct(group, point, POINT_CONVERSION_COMPRESSED,
|
AssertIntEQ(EC_POINT_point2oct(group, point, POINT_CONVERSION_COMPRESSED,
|
||||||
der, len, NULL), len);
|
der, len, NULL), len);
|
||||||
|
@ -123,10 +123,10 @@ typedef enum {
|
|||||||
sizeof(type) \
|
sizeof(type) \
|
||||||
};
|
};
|
||||||
|
|
||||||
WOLFSSL_API void *wolfSSL_ASN1_item_new(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 *template);
|
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,
|
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 */
|
/* Need function declaration otherwise compiler complains */
|
||||||
#define IMPLEMENT_ASN1_FUNCTIONS(type) \
|
#define IMPLEMENT_ASN1_FUNCTIONS(type) \
|
||||||
|
Loading…
Reference in New Issue
Block a user