forked from wolfSSL/wolfssl
Wrap some long lines.
This commit is contained in:
16
tests/api.c
16
tests/api.c
@@ -2598,7 +2598,7 @@ static void test_wolfSSL_EVP_EncodeUpdate(void)
|
||||
total += outl;
|
||||
|
||||
AssertIntNE(outl, 0); /* some output is expected this time*/
|
||||
AssertIntEQ(outl, BASE64_ENCODED_BLOCK_SIZE +1); /* 64 bytes and LF */
|
||||
AssertIntEQ(outl, BASE64_ENCODE_RESULT_BLOCK_SIZE +1); /* 64 bytes and LF */
|
||||
AssertIntEQ(
|
||||
XSTRNCMP((const char*)encOutBuff,(const char*)enc1,sizeof(enc1) ),0);
|
||||
|
||||
@@ -2669,7 +2669,8 @@ static void test_wolfSSL_EVP_DecodeUpdate(void)
|
||||
WOLFSSL_EVP_ENCODE_CTX* ctx = wolfSSL_EVP_ENCODE_CTX_new();
|
||||
wolfSSL_EVP_DecodeInit(ctx);
|
||||
|
||||
const unsigned char enc1[] = {"VGhpcyBpcyBhIGJhc2U2NCBkZWNvZGluZyB0ZXN0Lg==\n"};
|
||||
const unsigned char enc1[] =
|
||||
{"VGhpcyBpcyBhIGJhc2U2NCBkZWNvZGluZyB0ZXN0Lg==\n"};
|
||||
/* const unsigned char plain1[] =
|
||||
{"This is a base64 decoding test."} */
|
||||
|
||||
@@ -2736,7 +2737,8 @@ static void test_wolfSSL_EVP_DecodeUpdate(void)
|
||||
|
||||
/* decode correct base64 string */
|
||||
|
||||
const unsigned char enc2[] = {"VGhpcyBpcyBhIGJhc2U2NCBkZWNvZGluZyB0ZXN0Lg==\n"};
|
||||
const unsigned char enc2[] =
|
||||
{"VGhpcyBpcyBhIGJhc2U2NCBkZWNvZGluZyB0ZXN0Lg==\n"};
|
||||
const unsigned char plain2[] =
|
||||
{"This is a base64 decoding test."};
|
||||
|
||||
@@ -2768,7 +2770,8 @@ static void test_wolfSSL_EVP_DecodeUpdate(void)
|
||||
|
||||
/* decode correct base64 string which does not have '\n' in its last*/
|
||||
|
||||
const unsigned char enc3[] = {"VGhpcyBpcyBhIGJhc2U2NCBkZWNvZGluZyB0ZXN0Lg=="}; /* 44 chars */
|
||||
const unsigned char enc3[] =
|
||||
{"VGhpcyBpcyBhIGJhc2U2NCBkZWNvZGluZyB0ZXN0Lg=="}; /* 44 chars */
|
||||
const unsigned char plain3[] =
|
||||
{"This is a base64 decoding test."}; /* 31 chars */
|
||||
|
||||
@@ -2801,8 +2804,9 @@ static void test_wolfSSL_EVP_DecodeUpdate(void)
|
||||
|
||||
/* decode string which has a padding char ('=') in the illegal position*/
|
||||
|
||||
const unsigned char enc4[] = {"VGhpcyBpcyBhIGJhc2U2N=CBkZWNvZGluZyB0ZXN0Lg==\n"};
|
||||
/* ^-- illegal padding */
|
||||
const unsigned char enc4[] =
|
||||
{"VGhpcyBpcyBhIGJhc2U2N=CBkZWNvZGluZyB0ZXN0Lg==\n"};
|
||||
|
||||
|
||||
wolfSSL_EVP_EncodeInit(ctx);
|
||||
|
||||
|
@@ -6955,7 +6955,7 @@ int wolfSSL_EVP_EncodeUpdate(WOLFSSL_EVP_ENCODE_CTX* ctx,
|
||||
/* check if a block for encoding exists in ctx.data, if so encode it */
|
||||
if (ctx->remaining >= BASE64_ENCODE_BLOCK_SIZE) {
|
||||
/* Base64_Encode asks the out buff size via the 4th param*/
|
||||
outsz = BASE64_ENCODED_BLOCK_SIZE + 1;
|
||||
outsz = BASE64_ENCODE_RESULT_BLOCK_SIZE + 1;
|
||||
res = Base64_Encode(ctx->data, BASE64_ENCODE_BLOCK_SIZE, out,
|
||||
&outsz);
|
||||
if (res == 0)
|
||||
@@ -6974,7 +6974,7 @@ int wolfSSL_EVP_EncodeUpdate(WOLFSSL_EVP_ENCODE_CTX* ctx,
|
||||
*/
|
||||
|
||||
while (inl >= BASE64_ENCODE_BLOCK_SIZE) {
|
||||
outsz = BASE64_ENCODED_BLOCK_SIZE + 1; /* 64 byte and one for LF*/
|
||||
outsz = BASE64_ENCODE_RESULT_BLOCK_SIZE + 1;/* 64 byte and one for LF*/
|
||||
res = Base64_Encode(in, BASE64_ENCODE_BLOCK_SIZE,out,&outsz);
|
||||
if (res == 0) {
|
||||
in += BASE64_ENCODE_BLOCK_SIZE;
|
||||
@@ -7015,7 +7015,7 @@ void wolfSSL_EVP_EncodeFinal(WOLFSSL_EVP_ENCODE_CTX* ctx,
|
||||
return;
|
||||
}
|
||||
/* process remaining data in ctx */
|
||||
outsz = BASE64_ENCODED_BLOCK_SIZE + 1; /* 64 byte and one for LF*/
|
||||
outsz = BASE64_ENCODE_RESULT_BLOCK_SIZE + 1; /* 64 byte and one for LF*/
|
||||
res = Base64_Encode(ctx->data, ctx->remaining ,out, &outsz);
|
||||
if (res == 0)
|
||||
*outl = outsz;
|
||||
|
@@ -379,7 +379,7 @@ struct WOLFSSL_EVP_PKEY_CTX {
|
||||
#if defined(WOLFSSL_BASE64_ENCODE) || defined(WOLFSSL_BASE64_DECODE)
|
||||
|
||||
#define BASE64_ENCODE_BLOCK_SIZE 48
|
||||
#define BASE64_ENCODED_BLOCK_SIZE 64
|
||||
#define BASE64_ENCODE_RESULT_BLOCK_SIZE 64
|
||||
#define BASE64_DECODE_BLOCK_SIZE 4
|
||||
|
||||
struct WOLFSSL_EVP_ENCODE_CTX {
|
||||
|
Reference in New Issue
Block a user