Sorry for the delay in review. This is a fairly large change, and I think it has to wait until after the Nettle-3.6 release. Maybe it could be split into smaller pieces, e.g, a separate patch to introduce blowfish-internal.h and move needed declaratinos there.
Only one comment for now:
--- a/base64-decode.c +++ b/base64-decode.c @@ -45,7 +45,7 @@ void base64_decode_init(struct base64_decode_ctx *ctx) {
- static const signed char base64_decode_table[0x100] =
- static const signed char base64_decode_table[0x80] = { /* White space is HT, VT, FF, CR, LF and SPC */ -1, -1, -1, -1, -1, -1, -1, -1, -1, -2, -2, -2, -2, -2, -1, -1,
@@ -56,14 +56,6 @@ base64_decode_init(struct base64_decode_ctx *ctx) 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1, -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
};
ctx->word = ctx->bits = ctx->padding = 0;
@@ -75,7 +67,12 @@ base64_decode_single(struct base64_decode_ctx *ctx, uint8_t *dst, char src) {
- int data = ctx->table[(uint8_t) src];
- int data;
- if ((uint8_t) src > 0x7f)
- return -1;
- data = ctx->table[(uint8_t) src];
I'm not entirely sure halving the table size is a good tradeoff. If we want to do it, that should be a separete change. And base64url_decode_init should be updated too.
Regards, /Niels