Skip to content
Snippets Groups Projects
Commit 23e3c11d authored by Niels Möller's avatar Niels Möller
Browse files

(test_main): Fixed overlap test to not

change the base64 before decoding. Updated to new base64
conventions.

Rev: src/nettle/testsuite/base64-test.c:1.4
parent da0c74b6
No related branches found
No related tags found
No related merge requests found
...@@ -32,16 +32,19 @@ test_main(void) ...@@ -32,16 +32,19 @@ test_main(void)
/* Test overlapping areas */ /* Test overlapping areas */
uint8_t buffer[] = "Helloxxxx"; uint8_t buffer[] = "Helloxxxx";
struct base64_decode_ctx ctx; struct base64_decode_ctx ctx;
unsigned dst_length;
ASSERT(BASE64_ENCODE_RAW_LENGTH(5) == 8); ASSERT(BASE64_ENCODE_RAW_LENGTH(5) == 8);
base64_encode_raw(buffer, 5, buffer); base64_encode_raw(buffer, 5, buffer);
ASSERT(MEMEQ(9, buffer, "SGVsbG8=x")); ASSERT(MEMEQ(9, buffer, "SGVsbG8=x"));
buffer[6] = '=';
base64_decode_init(&ctx); base64_decode_init(&ctx);
ASSERT(4 == base64_decode_update(&ctx, buffer, 8, buffer)); dst_length = 8;
ASSERT(MEMEQ(9, buffer, "HellbG==x")); ASSERT(base64_decode_update(&ctx, &dst_length, buffer, 8, buffer));
} ASSERT(dst_length == 5);
ASSERT(MEMEQ(9, buffer, "HelloG8=x"));
}
SUCCESS(); SUCCESS();
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment