forked from wolfSSL/wolfssl
wolfcrypt/src/pkcs12.c: fix non-portable casts;
wolfcrypt/src/sp_int.c: use unsigned int, not word32, for sign variables, to match type in header file.
This commit is contained in:
@ -213,7 +213,7 @@ static int GetSafeContent(WC_PKCS12* pkcs12, const byte* input,
|
||||
word32 oid;
|
||||
word32 localIdx = *idx;
|
||||
int ret;
|
||||
word32 size = 0;
|
||||
int size = 0;
|
||||
byte tag;
|
||||
|
||||
safe = (AuthenticatedSafe*)XMALLOC(sizeof(AuthenticatedSafe), pkcs12->heap,
|
||||
@ -242,7 +242,7 @@ static int GetSafeContent(WC_PKCS12* pkcs12, const byte* input,
|
||||
freeSafe(safe, pkcs12->heap);
|
||||
return ASN_PARSE_E;
|
||||
}
|
||||
if (GetLength(input, &localIdx, (int *)&size, maxIdx) <= 0) {
|
||||
if (GetLength(input, &localIdx, &size, maxIdx) <= 0) {
|
||||
freeSafe(safe, pkcs12->heap);
|
||||
return ASN_PARSE_E;
|
||||
}
|
||||
@ -265,7 +265,7 @@ static int GetSafeContent(WC_PKCS12* pkcs12, const byte* input,
|
||||
freeSafe(safe, pkcs12->heap);
|
||||
return ASN_PARSE_E;
|
||||
}
|
||||
if (GetLength(input, &localIdx, (int *)&size, maxIdx) <= 0) {
|
||||
if (GetLength(input, &localIdx, &size, maxIdx) <= 0) {
|
||||
freeSafe(safe, pkcs12->heap);
|
||||
return ASN_PARSE_E;
|
||||
}
|
||||
@ -273,18 +273,18 @@ static int GetSafeContent(WC_PKCS12* pkcs12, const byte* input,
|
||||
break;
|
||||
}
|
||||
|
||||
safe->dataSz = size;
|
||||
safe->data = (byte*)XMALLOC(size, pkcs12->heap, DYNAMIC_TYPE_PKCS);
|
||||
safe->dataSz = (word32)size;
|
||||
safe->data = (byte*)XMALLOC((size_t)size, pkcs12->heap, DYNAMIC_TYPE_PKCS);
|
||||
if (safe->data == NULL) {
|
||||
freeSafe(safe, pkcs12->heap);
|
||||
return MEMORY_E;
|
||||
}
|
||||
XMEMCPY(safe->data, input + localIdx, size);
|
||||
XMEMCPY(safe->data, input + localIdx, (size_t)size);
|
||||
*idx = localIdx;
|
||||
|
||||
localIdx = 0;
|
||||
input = safe->data;
|
||||
size = safe->dataSz;
|
||||
size = (int)safe->dataSz;
|
||||
|
||||
#ifdef ASN_BER_TO_DER
|
||||
if (pkcs12->indefinite) {
|
||||
@ -316,15 +316,15 @@ static int GetSafeContent(WC_PKCS12* pkcs12, const byte* input,
|
||||
* through the ContentInfo's and add them to our
|
||||
* AuthenticatedSafe struct */
|
||||
{
|
||||
word32 CISz;
|
||||
ret = GetSequence(input, &localIdx, (int *)&CISz, size);
|
||||
int CISz;
|
||||
ret = GetSequence(input, &localIdx, &CISz, (word32)size);
|
||||
if (ret < 0) {
|
||||
freeSafe(safe, pkcs12->heap);
|
||||
return ASN_PARSE_E;
|
||||
}
|
||||
CISz += localIdx;
|
||||
while (localIdx < CISz) {
|
||||
word32 curSz = 0;
|
||||
CISz += (int)localIdx;
|
||||
while (localIdx < (word32)CISz) {
|
||||
int curSz = 0;
|
||||
word32 curIdx;
|
||||
ContentInfo* ci = NULL;
|
||||
|
||||
@ -332,7 +332,7 @@ static int GetSafeContent(WC_PKCS12* pkcs12, const byte* input,
|
||||
printf("\t\tlooking for Content Info.... ");
|
||||
#endif
|
||||
|
||||
if ((ret = GetSequence(input, &localIdx, (int *)&curSz, size)) < 0) {
|
||||
if ((ret = GetSequence(input, &localIdx, &curSz, (word32)size)) < 0) {
|
||||
freeSafe(safe, pkcs12->heap);
|
||||
return ret;
|
||||
}
|
||||
@ -345,7 +345,7 @@ static int GetSafeContent(WC_PKCS12* pkcs12, const byte* input,
|
||||
|
||||
curIdx = localIdx;
|
||||
if ((ret = GetObjectId(input, &localIdx, &oid, oidIgnoreType,
|
||||
size)) < 0) {
|
||||
(word32)size)) < 0) {
|
||||
WOLFSSL_LEAVE("Get object id failed", ret);
|
||||
freeSafe(safe, pkcs12->heap);
|
||||
return ret;
|
||||
@ -360,7 +360,7 @@ static int GetSafeContent(WC_PKCS12* pkcs12, const byte* input,
|
||||
}
|
||||
|
||||
ci->type = (int)oid;
|
||||
ci->dataSz = curSz - (localIdx-curIdx);
|
||||
ci->dataSz = (word32)curSz - (localIdx-curIdx);
|
||||
ci->data = (byte*)input + localIdx;
|
||||
localIdx += ci->dataSz;
|
||||
|
||||
|
@ -8157,8 +8157,8 @@ int sp_div(const sp_int* a, const sp_int* d, sp_int* r, sp_int* rem)
|
||||
sp_int* tr = NULL;
|
||||
sp_int* trial = NULL;
|
||||
#ifdef WOLFSSL_SP_INT_NEGATIVE
|
||||
word32 signA = MP_ZPOS;
|
||||
word32 signD = MP_ZPOS;
|
||||
unsigned int signA = MP_ZPOS;
|
||||
unsigned int signD = MP_ZPOS;
|
||||
#endif /* WOLFSSL_SP_INT_NEGATIVE */
|
||||
/* Intermediates will always be less than or equal to dividend. */
|
||||
DECL_SP_INT_ARRAY(td, (a == NULL) ? 1 : a->used + 1, 4);
|
||||
@ -11320,7 +11320,7 @@ int sp_mul(const sp_int* a, const sp_int* b, sp_int* r)
|
||||
{
|
||||
int err = MP_OKAY;
|
||||
#ifdef WOLFSSL_SP_INT_NEGATIVE
|
||||
word32 sign = MP_ZPOS;
|
||||
unsigned int sign = MP_ZPOS;
|
||||
#endif
|
||||
|
||||
if ((a == NULL) || (b == NULL) || (r == NULL)) {
|
||||
@ -17321,7 +17321,7 @@ int sp_read_radix(sp_int* a, const char* in, int radix)
|
||||
{
|
||||
int err = MP_OKAY;
|
||||
#ifdef WOLFSSL_SP_INT_NEGATIVE
|
||||
word32 sign = MP_ZPOS;
|
||||
unsigned int sign = MP_ZPOS;
|
||||
#endif
|
||||
|
||||
if ((a == NULL) || (in == NULL)) {
|
||||
@ -18538,7 +18538,7 @@ int sp_lcm(const sp_int* a, const sp_int* b, sp_int* r)
|
||||
{
|
||||
int err = MP_OKAY;
|
||||
/* Determine maximum digit length numbers will reach. */
|
||||
word32 used = ((a == NULL) || (b == NULL)) ? 1 :
|
||||
unsigned int used = ((a == NULL) || (b == NULL)) ? 1 :
|
||||
(a->used >= b->used ? a->used + 1: b->used + 1);
|
||||
DECL_SP_INT_ARRAY(t, used, 2);
|
||||
|
||||
|
Reference in New Issue
Block a user