Commit 434b2682 authored by Niels Möller's avatar Niels Möller
Browse files

* base64.h (BASE64_ENCODE_LENGTH, BASE64_DECODE_LENGTH): Fixed and

documented macros.

Rev: src/nettle/base64.h:1.9
parent c0042966
......@@ -35,9 +35,9 @@
/* Base64 encoding */
/* Maximum length of output for base64_encode_update. NOTE: Doesn't
* include any padding that base64_encode_final may add. */
/* FIXME: Rewrite to only evaluate LENGTH once. */
#define BASE64_ENCODE_LENGTH(length) ((length) + ((length) + 2)/3)
* include any padding that base64_encode_final may add. */
/* We have at most 4 buffered bits, and a total of (4 + length * 8) bits. */
#define BASE64_ENCODE_LENGTH(length) (((length) * 8 + 4)/6)
/* Maximum lengbth of output generated by base64_encode_final. */
#define BASE64_ENCODE_FINAL_LENGTH 3
......@@ -89,9 +89,9 @@ base64_encode_group(uint8_t *dst, uint32_t group);
/* Base64 decoding */
/* FIXME: Think more about this definition. */
#define BASE64_DECODE_LENGTH(length) \
((length) * BASE64_BINARY_BLOCK_SIZE / BASE64_TEXT_BLOCK_SIZE)
/* Maximum length of output for base64_decode_update. */
/* We have at most 6 buffered bits, and a total of (length + 1) * 6 bits. */
#define BASE64_DECODE_LENGTH(length) ((((length) + 1) * 6) / 8)
struct base64_decode_ctx
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment