mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-07-31 19:24:42 +02:00
Fix such as "for loop initial declaration"
This commit is contained in:
@@ -2610,6 +2610,7 @@ static void test_wolfSSL_EVP_EncodeUpdate(void)
|
|||||||
|
|
||||||
total += outl;
|
total += outl;
|
||||||
|
|
||||||
|
AssertIntNE(total,0);
|
||||||
AssertIntNE(outl,0);
|
AssertIntNE(outl,0);
|
||||||
AssertIntEQ(XSTRNCMP(
|
AssertIntEQ(XSTRNCMP(
|
||||||
(const char*)encOutBuff,(const char*)enc2,sizeof(enc2) ),0);
|
(const char*)encOutBuff,(const char*)enc2,sizeof(enc2) ),0);
|
||||||
|
@@ -6880,12 +6880,12 @@ int wolfSSL_EVP_get_hashinfo(const WOLFSSL_EVP_MD* evp,
|
|||||||
|
|
||||||
/* Base64 encoding APIs */
|
/* Base64 encoding APIs */
|
||||||
#if defined(WOLFSSL_BASE64_ENCODE) || defined(WOLFSSL_BASE64_DECODE)
|
#if defined(WOLFSSL_BASE64_ENCODE) || defined(WOLFSSL_BASE64_DECODE)
|
||||||
static WOLFSSL_EVP_ENCODE_CTX* wolfSSL_EVP_ENCODE_CTX_new_ex(void* heap);
|
static struct WOLFSSL_EVP_ENCODE_CTX* wolfSSL_EVP_ENCODE_CTX_new_ex(void* heap);
|
||||||
WOLFSSL_EVP_ENCODE_CTX* wolfSSL_EVP_ENCODE_CTX_new(void)
|
struct WOLFSSL_EVP_ENCODE_CTX* wolfSSL_EVP_ENCODE_CTX_new(void)
|
||||||
{
|
{
|
||||||
return wolfSSL_EVP_ENCODE_CTX_new_ex(NULL);
|
return wolfSSL_EVP_ENCODE_CTX_new_ex(NULL);
|
||||||
}
|
}
|
||||||
static WOLFSSL_EVP_ENCODE_CTX* wolfSSL_EVP_ENCODE_CTX_new_ex(void* heap)
|
static struct WOLFSSL_EVP_ENCODE_CTX* wolfSSL_EVP_ENCODE_CTX_new_ex(void* heap)
|
||||||
{
|
{
|
||||||
WOLFSSL_ENTER("wolfSSL_EVP_ENCODE_CTX_new");
|
WOLFSSL_ENTER("wolfSSL_EVP_ENCODE_CTX_new");
|
||||||
WOLFSSL_EVP_ENCODE_CTX* ctx = (WOLFSSL_EVP_ENCODE_CTX*)XMALLOC( sizeof(WOLFSSL_EVP_ENCODE_CTX),heap,DYNAMIC_TYPE_OPENSSL );
|
WOLFSSL_EVP_ENCODE_CTX* ctx = (WOLFSSL_EVP_ENCODE_CTX*)XMALLOC( sizeof(WOLFSSL_EVP_ENCODE_CTX),heap,DYNAMIC_TYPE_OPENSSL );
|
||||||
@@ -7058,6 +7058,7 @@ int wolfSSL_EVP_DecodeUpdate(WOLFSSL_EVP_ENCODE_CTX* ctx,
|
|||||||
word32 inLen;
|
word32 inLen;
|
||||||
int res;
|
int res;
|
||||||
int pad = 0;
|
int pad = 0;
|
||||||
|
int i;
|
||||||
|
|
||||||
WOLFSSL_ENTER("wolfSSL_EVP_DecodeUpdate");
|
WOLFSSL_ENTER("wolfSSL_EVP_DecodeUpdate");
|
||||||
|
|
||||||
@@ -7081,21 +7082,21 @@ int wolfSSL_EVP_DecodeUpdate(WOLFSSL_EVP_ENCODE_CTX* ctx,
|
|||||||
a block(4bytes) for decoding*/
|
a block(4bytes) for decoding*/
|
||||||
if( ctx->remaining > 0 && inl > 0) {
|
if( ctx->remaining > 0 && inl > 0) {
|
||||||
int cpysz;
|
int cpysz;
|
||||||
unsigned char e;
|
unsigned char e0;
|
||||||
|
|
||||||
cpysz = min( (BASE64_DECODE_BLOCK_SIZE - ctx->remaining), inl );
|
cpysz = min( (BASE64_DECODE_BLOCK_SIZE - ctx->remaining), inl );
|
||||||
|
|
||||||
for (int i = 0; cpysz > 0 && inLen > 0;i++) {
|
for ( i = 0; cpysz > 0 && inLen > 0;i++) {
|
||||||
if ((res = Base64_SkipNewline(in, &inLen, &j))
|
if ((res = Base64_SkipNewline(in, &inLen, &j))
|
||||||
== ASN_INPUT_E) {
|
== ASN_INPUT_E) {
|
||||||
return -1; /* detected an illegal char in input */
|
return -1; /* detected an illegal char in input */
|
||||||
}
|
}
|
||||||
e = in[j++];
|
e0 = in[j++];
|
||||||
|
|
||||||
if (e == '=')
|
if (e0 == '=')
|
||||||
pad = 1;
|
pad = 1;
|
||||||
|
|
||||||
*(ctx->data + ctx->remaining + i) = e;
|
*(ctx->data + ctx->remaining + i) = e0;
|
||||||
inLen--;
|
inLen--;
|
||||||
cpysz--;
|
cpysz--;
|
||||||
}
|
}
|
||||||
@@ -7202,18 +7203,18 @@ int wolfSSL_EVP_DecodeUpdate(WOLFSSL_EVP_ENCODE_CTX* ctx,
|
|||||||
if (inLen > 0) {
|
if (inLen > 0) {
|
||||||
XMEMSET(ctx->data, 0, sizeof(ctx->data));
|
XMEMSET(ctx->data, 0, sizeof(ctx->data));
|
||||||
|
|
||||||
int i = 0;
|
i = 0;
|
||||||
unsigned char e;
|
unsigned char el;
|
||||||
while ( inLen > 0) {
|
while ( inLen > 0) {
|
||||||
e = in[j++];
|
el = in[j++];
|
||||||
if (e== '\n' || e == '\r' || e == ' ') {
|
if (el== '\n' || el == '\r' || el == ' ') {
|
||||||
inLen--;
|
inLen--;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (e == '=') {
|
if (el == '=') {
|
||||||
pad = 1;
|
pad = 1;
|
||||||
}
|
}
|
||||||
ctx->data[i++] = e;
|
ctx->data[i++] = el;
|
||||||
ctx->remaining++;
|
ctx->remaining++;
|
||||||
inLen--;
|
inLen--;
|
||||||
}
|
}
|
||||||
@@ -7225,15 +7226,15 @@ int wolfSSL_EVP_DecodeUpdate(WOLFSSL_EVP_ENCODE_CTX* ctx,
|
|||||||
|
|
||||||
}
|
}
|
||||||
/* if the last data is '\n', remove it */
|
/* if the last data is '\n', remove it */
|
||||||
char e = in[j - 1];
|
char es = in[j - 1];
|
||||||
if (e == '\n') {
|
if (es == '\n') {
|
||||||
e = (in[j - 2]);
|
es = (in[j - 2]);
|
||||||
if (e == '=')
|
if (es == '=')
|
||||||
return 0;
|
return 0;
|
||||||
else
|
else
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if (e == '=')
|
if (es == '=')
|
||||||
return 0;
|
return 0;
|
||||||
else
|
else
|
||||||
return 1;
|
return 1;
|
||||||
|
@@ -382,14 +382,14 @@ struct WOLFSSL_EVP_PKEY_CTX {
|
|||||||
#define BASE64_ENCODED_BLOCK_SIZE 64
|
#define BASE64_ENCODED_BLOCK_SIZE 64
|
||||||
#define BASE64_DECODE_BLOCK_SIZE 4
|
#define BASE64_DECODE_BLOCK_SIZE 4
|
||||||
|
|
||||||
typedef struct WOLFSSL_EVP_ENCODE_CTX
|
struct WOLFSSL_EVP_ENCODE_CTX {
|
||||||
{
|
|
||||||
void* heap;
|
void* heap;
|
||||||
int remaining; /* num of bytes in data[] */
|
int remaining; /* num of bytes in data[] */
|
||||||
byte data[128]; /* storage for unprocessed raw data */
|
byte data[128]; /* storage for unprocessed raw data */
|
||||||
}WOLFSSL_EVP_ENCODE_CTX;
|
};
|
||||||
|
typedef struct WOLFSSL_EVP_ENCODE_CTX WOLFSSL_EVP_ENCODE_CTX;
|
||||||
|
|
||||||
WOLFSSL_API WOLFSSL_EVP_ENCODE_CTX* wolfSSL_EVP_ENCODE_CTX_new(void);
|
WOLFSSL_API struct WOLFSSL_EVP_ENCODE_CTX* wolfSSL_EVP_ENCODE_CTX_new(void);
|
||||||
WOLFSSL_API void wolfSSL_EVP_ENCODE_CTX_free(WOLFSSL_EVP_ENCODE_CTX* ctx);
|
WOLFSSL_API void wolfSSL_EVP_ENCODE_CTX_free(WOLFSSL_EVP_ENCODE_CTX* ctx);
|
||||||
#endif /* WOLFSSL_BASE64_ENCODE || WOLFSSL_BASE64_DECODE */
|
#endif /* WOLFSSL_BASE64_ENCODE || WOLFSSL_BASE64_DECODE */
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user