Merge pull request #6900 from julek-wolfssl/zd/16868
EVP_EncodeBlock should not append a newline
This commit is contained in:
commit
96977d1480
@ -4888,6 +4888,7 @@ static int test_wolfSSL_EVP_EncodeUpdate(void)
|
||||
const unsigned char plain1[] = {"This is a base64 encodeing test."};
|
||||
const unsigned char plain2[] = {"This is additional data."};
|
||||
|
||||
const unsigned char encBlock0[] = {"VGg="};
|
||||
const unsigned char enc0[] = {"VGg=\n"};
|
||||
/* expected encoded result for the first output 64 chars plus trailing LF*/
|
||||
const unsigned char enc1[] = {"VGhpcyBpcyBhIGJhc2U2NCBlbmNvZGVpbmcgdGVzdC5UaGlzIGlzIGFkZGl0aW9u\n"};
|
||||
@ -4989,12 +4990,8 @@ static int test_wolfSSL_EVP_EncodeUpdate(void)
|
||||
|
||||
XMEMSET( encOutBuff,0, sizeof(encOutBuff));
|
||||
ExpectIntEQ(EVP_EncodeBlock(encOutBuff, plain0, sizeof(plain0)-1),
|
||||
sizeof(enc0)-1);
|
||||
ExpectIntEQ(
|
||||
XSTRNCMP(
|
||||
(const char*)encOutBuff,
|
||||
(const char*)enc0,sizeof(enc0) ),
|
||||
0);
|
||||
sizeof(encBlock0)-1);
|
||||
ExpectStrEQ(encOutBuff, encBlock0);
|
||||
|
||||
/* pass small size( < 48bytes ) input, then make sure they are not
|
||||
* encoded and just stored in ctx
|
||||
|
@ -12028,7 +12028,7 @@ int wolfSSL_EVP_EncodeBlock(unsigned char *out, const unsigned char *in,
|
||||
if (out == NULL || in == NULL)
|
||||
return WOLFSSL_FATAL_ERROR;
|
||||
|
||||
if (Base64_Encode(in, (word32)inLen, out, &ret) == 0)
|
||||
if (Base64_Encode_NoNl(in, (word32)inLen, out, &ret) == 0)
|
||||
return (int)ret;
|
||||
else
|
||||
return WOLFSSL_FATAL_ERROR;
|
||||
|
Loading…
Reference in New Issue
Block a user