mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2026-05-03 20:50:48 +02:00
fix warnings and errors with FreeBSD PowerPC
This commit is contained in:
+3
-3
@@ -7746,7 +7746,7 @@ static int DoCertificateStatus(WOLFSSL* ssl, byte* input, word32* inOutIdx,
|
|||||||
case WOLFSSL_CSR2_OCSP_MULTI: {
|
case WOLFSSL_CSR2_OCSP_MULTI: {
|
||||||
OcspRequest* request;
|
OcspRequest* request;
|
||||||
word32 list_length = status_length;
|
word32 list_length = status_length;
|
||||||
byte index = 0;
|
byte idx = 0;
|
||||||
|
|
||||||
#ifdef WOLFSSL_SMALL_STACK
|
#ifdef WOLFSSL_SMALL_STACK
|
||||||
CertStatus* status;
|
CertStatus* status;
|
||||||
@@ -7808,13 +7808,13 @@ static int DoCertificateStatus(WOLFSSL* ssl, byte* input, word32* inOutIdx,
|
|||||||
|
|
||||||
while (ret == 0) {
|
while (ret == 0) {
|
||||||
request = (OcspRequest*)TLSX_CSR2_GetRequest(
|
request = (OcspRequest*)TLSX_CSR2_GetRequest(
|
||||||
ssl->extensions, status_type, index++);
|
ssl->extensions, status_type, idx++);
|
||||||
|
|
||||||
if (request == NULL)
|
if (request == NULL)
|
||||||
ret = BAD_CERTIFICATE_STATUS_ERROR;
|
ret = BAD_CERTIFICATE_STATUS_ERROR;
|
||||||
else if (CompareOcspReqResp(request, response) == 0)
|
else if (CompareOcspReqResp(request, response) == 0)
|
||||||
break;
|
break;
|
||||||
else if (index == 1) /* server cert must be OK */
|
else if (idx == 1) /* server cert must be OK */
|
||||||
ret = BAD_CERTIFICATE_STATUS_ERROR;
|
ret = BAD_CERTIFICATE_STATUS_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -110,9 +110,9 @@ void FreeOCSP(WOLFSSL_OCSP* ocsp, int dynamic)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int xstat2err(int stat)
|
static int xstat2err(int st)
|
||||||
{
|
{
|
||||||
switch (stat) {
|
switch (st) {
|
||||||
case CERT_GOOD:
|
case CERT_GOOD:
|
||||||
return 0;
|
return 0;
|
||||||
case CERT_REVOKED:
|
case CERT_REVOKED:
|
||||||
|
|||||||
@@ -15388,15 +15388,15 @@ int wolfSSL_ASN1_TIME_print(WOLFSSL_BIO* bio, const WOLFSSL_ASN1_TIME* asnTime)
|
|||||||
|
|
||||||
|
|
||||||
#if defined(WOLFSSL_MYSQL_COMPATIBLE) || defined(WOLFSSL_NGINX) || defined(WOLFSSL_HAPROXY)
|
#if defined(WOLFSSL_MYSQL_COMPATIBLE) || defined(WOLFSSL_NGINX) || defined(WOLFSSL_HAPROXY)
|
||||||
char* wolfSSL_ASN1_TIME_to_string(WOLFSSL_ASN1_TIME* time, char* buf, int len)
|
char* wolfSSL_ASN1_TIME_to_string(WOLFSSL_ASN1_TIME* t, char* buf, int len)
|
||||||
{
|
{
|
||||||
int format;
|
int format;
|
||||||
int dateLen;
|
int dateLen;
|
||||||
byte* date = (byte*)time;
|
byte* date = (byte*)t;
|
||||||
|
|
||||||
WOLFSSL_ENTER("wolfSSL_ASN1_TIME_to_string");
|
WOLFSSL_ENTER("wolfSSL_ASN1_TIME_to_string");
|
||||||
|
|
||||||
if (time == NULL || buf == NULL || len < 5) {
|
if (t == NULL || buf == NULL || len < 5) {
|
||||||
WOLFSSL_MSG("Bad argument");
|
WOLFSSL_MSG("Bad argument");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -16324,9 +16324,10 @@ void wolfSSL_DES_set_odd_parity(WOLFSSL_DES_cblock* myDes)
|
|||||||
void wolfSSL_DES_ecb_encrypt(WOLFSSL_DES_cblock* desa,
|
void wolfSSL_DES_ecb_encrypt(WOLFSSL_DES_cblock* desa,
|
||||||
WOLFSSL_DES_cblock* desb, WOLFSSL_DES_key_schedule* key, int enc)
|
WOLFSSL_DES_cblock* desb, WOLFSSL_DES_key_schedule* key, int enc)
|
||||||
{
|
{
|
||||||
|
Des myDes;
|
||||||
|
|
||||||
WOLFSSL_ENTER("wolfSSL_DES_ecb_encrypt");
|
WOLFSSL_ENTER("wolfSSL_DES_ecb_encrypt");
|
||||||
|
|
||||||
Des myDes;
|
|
||||||
if (desa == NULL || key == NULL || desb == NULL ||
|
if (desa == NULL || key == NULL || desb == NULL ||
|
||||||
(enc != DES_ENCRYPT && enc != DES_DECRYPT)) {
|
(enc != DES_ENCRYPT && enc != DES_DECRYPT)) {
|
||||||
WOLFSSL_MSG("Bad argument passed to wolfSSL_DES_ecb_encrypt");
|
WOLFSSL_MSG("Bad argument passed to wolfSSL_DES_ecb_encrypt");
|
||||||
@@ -16338,12 +16339,12 @@ void wolfSSL_DES_ecb_encrypt(WOLFSSL_DES_cblock* desa,
|
|||||||
}
|
}
|
||||||
if (enc){
|
if (enc){
|
||||||
if (wc_Des_EcbEncrypt(&myDes, (byte*) desb,
|
if (wc_Des_EcbEncrypt(&myDes, (byte*) desb,
|
||||||
(const byte*) desa, sizeof(desa)) != 0){
|
(const byte*) desa, sizeof(WOLFSSL_DES_cblock)) != 0){
|
||||||
WOLFSSL_MSG("wc_Des_EcbEncrpyt return error.");
|
WOLFSSL_MSG("wc_Des_EcbEncrpyt return error.");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (wc_Des_EcbDecrypt(&myDes, (byte*) desb,
|
if (wc_Des_EcbDecrypt(&myDes, (byte*) desb,
|
||||||
(const byte*) desa, sizeof(desa)) != 0){
|
(const byte*) desa, sizeof(WOLFSSL_DES_cblock)) != 0){
|
||||||
WOLFSSL_MSG("wc_Des_EcbDecrpyt return error.");
|
WOLFSSL_MSG("wc_Des_EcbDecrpyt return error.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2652,7 +2652,7 @@ int TLSX_CSR2_InitRequests(TLSX* extensions, DecodedCert* cert, byte isPeer,
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void* TLSX_CSR2_GetRequest(TLSX* extensions, byte status_type, byte index)
|
void* TLSX_CSR2_GetRequest(TLSX* extensions, byte status_type, byte idx)
|
||||||
{
|
{
|
||||||
TLSX* extension = TLSX_Find(extensions, TLSX_STATUS_REQUEST_V2);
|
TLSX* extension = TLSX_Find(extensions, TLSX_STATUS_REQUEST_V2);
|
||||||
CertificateStatusRequestItemV2* csr2 = extension ?
|
CertificateStatusRequestItemV2* csr2 = extension ?
|
||||||
@@ -2666,8 +2666,8 @@ void* TLSX_CSR2_GetRequest(TLSX* extensions, byte status_type, byte index)
|
|||||||
|
|
||||||
case WOLFSSL_CSR2_OCSP_MULTI:
|
case WOLFSSL_CSR2_OCSP_MULTI:
|
||||||
/* requests are initialized in the reverse order */
|
/* requests are initialized in the reverse order */
|
||||||
return index < csr2->requests
|
return idx < csr2->requests
|
||||||
? &csr2->request.ocsp[csr2->requests - index - 1]
|
? &csr2->request.ocsp[csr2->requests - idx - 1]
|
||||||
: NULL;
|
: NULL;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
+13
-13
@@ -3883,12 +3883,12 @@ static int ecc_mul2add(ecc_point* A, mp_int* kA,
|
|||||||
siglen The length of the signature (octets)
|
siglen The length of the signature (octets)
|
||||||
hash The hash (message digest) that was signed
|
hash The hash (message digest) that was signed
|
||||||
hashlen The length of the hash (octets)
|
hashlen The length of the hash (octets)
|
||||||
stat Result of signature, 1==valid, 0==invalid
|
res Result of signature, 1==valid, 0==invalid
|
||||||
key The corresponding public ECC key
|
key The corresponding public ECC key
|
||||||
return MP_OKAY if successful (even if the signature is not valid)
|
return MP_OKAY if successful (even if the signature is not valid)
|
||||||
*/
|
*/
|
||||||
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)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
mp_int *r = NULL, *s = NULL;
|
mp_int *r = NULL, *s = NULL;
|
||||||
@@ -3898,7 +3898,7 @@ int wc_ecc_verify_hash(const byte* sig, word32 siglen, const byte* hash,
|
|||||||
s = &s_lcl;
|
s = &s_lcl;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (sig == NULL || hash == NULL || stat == NULL || key == NULL) {
|
if (sig == NULL || hash == NULL || res == NULL || key == NULL) {
|
||||||
return ECC_BAD_ARG_E;
|
return ECC_BAD_ARG_E;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3908,7 +3908,7 @@ int wc_ecc_verify_hash(const byte* sig, word32 siglen, const byte* hash,
|
|||||||
key->state = ECC_STATE_VERIFY_DECODE;
|
key->state = ECC_STATE_VERIFY_DECODE;
|
||||||
|
|
||||||
/* default to invalid signature */
|
/* default to invalid signature */
|
||||||
*stat = 0;
|
*res = 0;
|
||||||
|
|
||||||
/* Note, DecodeECC_DSA_Sig() calls mp_init() on r and s.
|
/* Note, DecodeECC_DSA_Sig() calls mp_init() on r and s.
|
||||||
* If either of those don't allocate correctly, none of
|
* If either of those don't allocate correctly, none of
|
||||||
@@ -3928,7 +3928,7 @@ int wc_ecc_verify_hash(const byte* sig, word32 siglen, const byte* hash,
|
|||||||
case ECC_STATE_VERIFY_DO:
|
case ECC_STATE_VERIFY_DO:
|
||||||
key->state = ECC_STATE_VERIFY_DO;
|
key->state = ECC_STATE_VERIFY_DO;
|
||||||
|
|
||||||
err = wc_ecc_verify_hash_ex(r, s, hash, hashlen, stat, key);
|
err = wc_ecc_verify_hash_ex(r, s, hash, hashlen, res, key);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -3974,12 +3974,12 @@ int wc_ecc_verify_hash(const byte* sig, word32 siglen, const byte* hash,
|
|||||||
s The signature S component to verify
|
s The signature S component to verify
|
||||||
hash The hash (message digest) that was signed
|
hash The hash (message digest) that was signed
|
||||||
hashlen The length of the hash (octets)
|
hashlen The length of the hash (octets)
|
||||||
stat Result of signature, 1==valid, 0==invalid
|
res Result of signature, 1==valid, 0==invalid
|
||||||
key The corresponding public ECC key
|
key The corresponding public ECC key
|
||||||
return MP_OKAY if successful (even if the signature is not valid)
|
return MP_OKAY if successful (even if the signature is not valid)
|
||||||
*/
|
*/
|
||||||
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)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
#ifndef WOLFSSL_ATECC508A
|
#ifndef WOLFSSL_ATECC508A
|
||||||
@@ -3995,11 +3995,11 @@ int wc_ecc_verify_hash_ex(mp_int *r, mp_int *s, const byte* hash,
|
|||||||
byte sigRS[ATECC_KEY_SIZE*2];
|
byte sigRS[ATECC_KEY_SIZE*2];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (r == NULL || s == NULL || hash == NULL || stat == NULL || key == NULL)
|
if (r == NULL || s == NULL || hash == NULL || res == NULL || key == NULL)
|
||||||
return ECC_BAD_ARG_E;
|
return ECC_BAD_ARG_E;
|
||||||
|
|
||||||
/* default to invalid signature */
|
/* default to invalid signature */
|
||||||
*stat = 0;
|
*res = 0;
|
||||||
|
|
||||||
/* is the IDX valid ? */
|
/* is the IDX valid ? */
|
||||||
if (wc_ecc_is_valid_idx(key->idx) != 1) {
|
if (wc_ecc_is_valid_idx(key->idx) != 1) {
|
||||||
@@ -4016,7 +4016,7 @@ int wc_ecc_verify_hash_ex(mp_int *r, mp_int *s, const byte* hash,
|
|||||||
testDev->eccVerify.s = s;
|
testDev->eccVerify.s = s;
|
||||||
testDev->eccVerify.hash = hash;
|
testDev->eccVerify.hash = hash;
|
||||||
testDev->eccVerify.hashlen = hashlen;
|
testDev->eccVerify.hashlen = hashlen;
|
||||||
testDev->eccVerify.stat = stat;
|
testDev->eccVerify.stat = res;
|
||||||
testDev->eccVerify.key = key;
|
testDev->eccVerify.key = key;
|
||||||
return WC_PENDING_E;
|
return WC_PENDING_E;
|
||||||
}
|
}
|
||||||
@@ -4034,7 +4034,7 @@ int wc_ecc_verify_hash_ex(mp_int *r, mp_int *s, const byte* hash,
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
err = atcatls_verify(hash, sigRS, key->pubkey, (bool*)stat);
|
err = atcatls_verify(hash, sigRS, key->pubkey, (bool*)res);
|
||||||
if (err != ATCA_SUCCESS) {
|
if (err != ATCA_SUCCESS) {
|
||||||
return BAD_COND_E;
|
return BAD_COND_E;
|
||||||
}
|
}
|
||||||
@@ -4087,7 +4087,7 @@ int wc_ecc_verify_hash_ex(mp_int *r, mp_int *s, const byte* hash,
|
|||||||
err = IntelQaEcdsaVerify(&key->asyncDev, &e.raw, &key->pubkey.x->raw,
|
err = IntelQaEcdsaVerify(&key->asyncDev, &e.raw, &key->pubkey.x->raw,
|
||||||
&key->pubkey.y->raw, &r->raw, &s->raw, &curve->Af->raw,
|
&key->pubkey.y->raw, &r->raw, &s->raw, &curve->Af->raw,
|
||||||
&curve->Bf->raw, &curve->prime->raw, &curve->order->raw,
|
&curve->Bf->raw, &curve->prime->raw, &curve->order->raw,
|
||||||
&curve->Gx->raw, &curve->Gy->raw, stat);
|
&curve->Gx->raw, &curve->Gy->raw, res);
|
||||||
|
|
||||||
mp_clear(&e);
|
mp_clear(&e);
|
||||||
|
|
||||||
@@ -4187,7 +4187,7 @@ int wc_ecc_verify_hash_ex(mp_int *r, mp_int *s, const byte* hash,
|
|||||||
/* does v == r */
|
/* does v == r */
|
||||||
if (err == MP_OKAY) {
|
if (err == MP_OKAY) {
|
||||||
if (mp_cmp(&v, r) == MP_EQ)
|
if (mp_cmp(&v, r) == MP_EQ)
|
||||||
*stat = 1;
|
*res = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* cleanup */
|
/* cleanup */
|
||||||
|
|||||||
@@ -207,11 +207,11 @@ int wc_ed25519_sign_msg(const byte* in, word32 inlen, byte* out,
|
|||||||
siglen is the length of sig byte array
|
siglen is the length of sig byte array
|
||||||
msg the array of bytes containing the message
|
msg the array of bytes containing the message
|
||||||
msglen length of msg array
|
msglen length of msg array
|
||||||
stat will be 1 on successful verify and 0 on unsuccessful
|
res will be 1 on successful verify and 0 on unsuccessful
|
||||||
return 0 and stat of 1 on success
|
return 0 and res of 1 on success
|
||||||
*/
|
*/
|
||||||
int wc_ed25519_verify_msg(byte* sig, word32 siglen, const byte* msg,
|
int wc_ed25519_verify_msg(byte* sig, word32 siglen, const byte* msg,
|
||||||
word32 msglen, int* stat, ed25519_key* key)
|
word32 msglen, int* res, ed25519_key* key)
|
||||||
{
|
{
|
||||||
byte rcheck[ED25519_KEY_SIZE];
|
byte rcheck[ED25519_KEY_SIZE];
|
||||||
byte h[SHA512_DIGEST_SIZE];
|
byte h[SHA512_DIGEST_SIZE];
|
||||||
@@ -223,11 +223,11 @@ int wc_ed25519_verify_msg(byte* sig, word32 siglen, const byte* msg,
|
|||||||
Sha512 sha;
|
Sha512 sha;
|
||||||
|
|
||||||
/* sanity check on arguments */
|
/* sanity check on arguments */
|
||||||
if (sig == NULL || msg == NULL || stat == NULL || key == NULL)
|
if (sig == NULL || msg == NULL || res == NULL || key == NULL)
|
||||||
return BAD_FUNC_ARG;
|
return BAD_FUNC_ARG;
|
||||||
|
|
||||||
/* set verification failed by default */
|
/* set verification failed by default */
|
||||||
*stat = 0;
|
*res = 0;
|
||||||
|
|
||||||
/* check on basics needed to verify signature */
|
/* check on basics needed to verify signature */
|
||||||
if (siglen < ED25519_SIG_SIZE || (sig[ED25519_SIG_SIZE-1] & 224))
|
if (siglen < ED25519_SIG_SIZE || (sig[ED25519_SIG_SIZE-1] & 224))
|
||||||
@@ -279,7 +279,7 @@ int wc_ed25519_verify_msg(byte* sig, word32 siglen, const byte* msg,
|
|||||||
return SIG_VERIFY_E;
|
return SIG_VERIFY_E;
|
||||||
|
|
||||||
/* set the verification status */
|
/* set the verification status */
|
||||||
*stat = 1;
|
*res = 1;
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -316,7 +316,7 @@ int wc_LoggingCleanup(void)
|
|||||||
#if defined(DEBUG_WOLFSSL) || defined(WOLFSSL_NGINX) || defined(WOLFSSL_HAPROXY)
|
#if defined(DEBUG_WOLFSSL) || defined(WOLFSSL_NGINX) || defined(WOLFSSL_HAPROXY)
|
||||||
/* peek at an error node
|
/* peek at an error node
|
||||||
*
|
*
|
||||||
* index : if -1 then the most recent node is looked at, otherwise search
|
* idx : if -1 then the most recent node is looked at, otherwise search
|
||||||
* through queue for node at the given index
|
* through queue for node at the given index
|
||||||
* file : pointer to internal file string
|
* file : pointer to internal file string
|
||||||
* reason : pointer to internal error reason
|
* reason : pointer to internal error reason
|
||||||
@@ -325,7 +325,7 @@ int wc_LoggingCleanup(void)
|
|||||||
* Returns a negative value in error case, on success returns the nodes error
|
* Returns a negative value in error case, on success returns the nodes error
|
||||||
* value which is positve (absolute value)
|
* value which is positve (absolute value)
|
||||||
*/
|
*/
|
||||||
int wc_PeekErrorNode(int index, const char **file, const char **reason,
|
int wc_PeekErrorNode(int idx, const char **file, const char **reason,
|
||||||
int *line)
|
int *line)
|
||||||
{
|
{
|
||||||
struct wc_error_queue* err;
|
struct wc_error_queue* err;
|
||||||
@@ -335,7 +335,7 @@ int wc_PeekErrorNode(int index, const char **file, const char **reason,
|
|||||||
return BAD_MUTEX_E;
|
return BAD_MUTEX_E;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (index < 0) {
|
if (idx < 0) {
|
||||||
err = wc_last_node;
|
err = wc_last_node;
|
||||||
if (err == NULL) {
|
if (err == NULL) {
|
||||||
WOLFSSL_MSG("No Errors in queue");
|
WOLFSSL_MSG("No Errors in queue");
|
||||||
@@ -347,7 +347,7 @@ int wc_PeekErrorNode(int index, const char **file, const char **reason,
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
err = (struct wc_error_queue*)wc_errors;
|
err = (struct wc_error_queue*)wc_errors;
|
||||||
for (i = 0; i < index; i++) {
|
for (i = 0; i < idx; i++) {
|
||||||
if (err == NULL) {
|
if (err == NULL) {
|
||||||
WOLFSSL_MSG("Error node not found. Bad index?");
|
WOLFSSL_MSG("Error node not found. Bad index?");
|
||||||
wc_UnLockMutex(&debug_mutex);
|
wc_UnLockMutex(&debug_mutex);
|
||||||
@@ -441,10 +441,10 @@ int wc_AddErrorNode(int error, int line, char* buf, char* file)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Removes the error node at the specified index.
|
/* Removes the error node at the specified index.
|
||||||
* index : if -1 then the most recent node is looked at, otherwise search
|
* idx : if -1 then the most recent node is looked at, otherwise search
|
||||||
* through queue for node at the given index
|
* through queue for node at the given index
|
||||||
*/
|
*/
|
||||||
void wc_RemoveErrorNode(int index)
|
void wc_RemoveErrorNode(int idx)
|
||||||
{
|
{
|
||||||
struct wc_error_queue* current;
|
struct wc_error_queue* current;
|
||||||
|
|
||||||
@@ -453,11 +453,11 @@ void wc_RemoveErrorNode(int index)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (index == -1)
|
if (idx == -1)
|
||||||
current = wc_last_node;
|
current = wc_last_node;
|
||||||
else {
|
else {
|
||||||
current = (struct wc_error_queue*)wc_errors;
|
current = (struct wc_error_queue*)wc_errors;
|
||||||
for (; current != NULL && index > 0; index--)
|
for (; current != NULL && idx > 0; idx--)
|
||||||
current = current->next;
|
current = current->next;
|
||||||
}
|
}
|
||||||
if (current != NULL) {
|
if (current != NULL) {
|
||||||
|
|||||||
+13
-13
@@ -1220,7 +1220,7 @@ static int wc_PKCS7_EcdsaVerify(PKCS7* pkcs7, byte* sig, int sigSz,
|
|||||||
byte* hash, word32 hashSz)
|
byte* hash, word32 hashSz)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
int stat = 0;
|
int res = 0;
|
||||||
#ifdef WOLFSSL_SMALL_STACK
|
#ifdef WOLFSSL_SMALL_STACK
|
||||||
byte* digest;
|
byte* digest;
|
||||||
ecc_key* key;
|
ecc_key* key;
|
||||||
@@ -1267,11 +1267,11 @@ static int wc_PKCS7_EcdsaVerify(PKCS7* pkcs7, byte* sig, int sigSz,
|
|||||||
return PUBLIC_KEY_E;
|
return PUBLIC_KEY_E;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = wc_ecc_verify_hash(sig, sigSz, hash, hashSz, &stat, key);
|
ret = wc_ecc_verify_hash(sig, sigSz, hash, hashSz, &res, key);
|
||||||
|
|
||||||
wc_ecc_free(key);
|
wc_ecc_free(key);
|
||||||
|
|
||||||
if (ret == 0 && stat != 1) {
|
if (ret == 0 && res != 1) {
|
||||||
ret = SIG_VERIFY_E;
|
ret = SIG_VERIFY_E;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2807,32 +2807,32 @@ static int wc_PKCS7_DecryptContent(int encryptOID, byte* key, int keySz,
|
|||||||
static int wc_PKCS7_GenerateIV(WC_RNG* rng, byte* iv, word32 ivSz)
|
static int wc_PKCS7_GenerateIV(WC_RNG* rng, byte* iv, word32 ivSz)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
WC_RNG* random = NULL;
|
WC_RNG* rnd = NULL;
|
||||||
|
|
||||||
if (iv == NULL || ivSz == 0)
|
if (iv == NULL || ivSz == 0)
|
||||||
return BAD_FUNC_ARG;
|
return BAD_FUNC_ARG;
|
||||||
|
|
||||||
/* input RNG is optional, init local one if input rng is NULL */
|
/* input RNG is optional, init local one if input rng is NULL */
|
||||||
if (rng == NULL) {
|
if (rnd == NULL) {
|
||||||
random = (WC_RNG*)XMALLOC(sizeof(WC_RNG), NULL, DYNAMIC_TYPE_RNG);
|
rnd = (WC_RNG*)XMALLOC(sizeof(WC_RNG), NULL, DYNAMIC_TYPE_RNG);
|
||||||
if (random == NULL)
|
if (rnd == NULL)
|
||||||
return MEMORY_E;
|
return MEMORY_E;
|
||||||
|
|
||||||
ret = wc_InitRng(random);
|
ret = wc_InitRng(rnd);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
XFREE(random, NULL, DYNAMIC_TYPE_RNG);
|
XFREE(rnd, NULL, DYNAMIC_TYPE_RNG);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
random = rng;
|
rnd = rng;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = wc_RNG_GenerateBlock(random, iv, ivSz);
|
ret = wc_RNG_GenerateBlock(rnd, iv, ivSz);
|
||||||
|
|
||||||
if (rng == NULL) {
|
if (rng == NULL) {
|
||||||
wc_FreeRng(random);
|
wc_FreeRng(rnd);
|
||||||
XFREE(random, NULL, DYNAMIC_TYPE_RNG);
|
XFREE(rnd, NULL, DYNAMIC_TYPE_RNG);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|||||||
@@ -611,7 +611,7 @@ static void scryptSalsa(word32* out, word32* in)
|
|||||||
out[i] = in[i] + x[i];
|
out[i] = in[i] + x[i];
|
||||||
#else
|
#else
|
||||||
for (i = 0; i < 16; i++)
|
for (i = 0; i < 16; i++)
|
||||||
out[i] = ByteReverseWord32(in[i] + x[i]);
|
out[i] = ByteReverseWord32(ByteReverseWord32(in[i]) + x[i]);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -209,7 +209,7 @@ static int Hash_df(DRBG* drbg, byte* out, word32 outSz, byte type,
|
|||||||
const byte* inA, word32 inASz,
|
const byte* inA, word32 inASz,
|
||||||
const byte* inB, word32 inBSz)
|
const byte* inB, word32 inBSz)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret = DRBG_FAILURE;
|
||||||
byte ctr;
|
byte ctr;
|
||||||
int i;
|
int i;
|
||||||
int len;
|
int len;
|
||||||
|
|||||||
Reference in New Issue
Block a user