Commit 07cb0b62 authored by Niels Möller's avatar Niels Möller

Base64 and base16 decoding: Use *dst_length as output only.

parent d055d0e5
2014-02-07 Niels Möller <nisse@lysator.liu.se>
* base64-decode.c (base64_decode_update): Use *dst_length for
output only. Don't require callers to pass a sane value.
* base16-decode.c (base16_decode_update): Likewise.
2014-02-06 Niels Möller <nisse@lysator.liu.se>
* NEWS: List _set_key incompatibilities.
......
......@@ -101,8 +101,6 @@ base16_decode_update(struct base16_decode_ctx *ctx,
size_t done;
size_t i;
assert(*dst_length >= BASE16_DECODE_LENGTH(src_length));
for (i = done = 0; i<src_length; i++)
switch(base16_decode_single(ctx, dst + done, src[i]))
{
......
......@@ -81,13 +81,9 @@ base16_decode_single(struct base16_decode_ctx *ctx,
uint8_t src);
/* Returns 1 on success, 0 on error. DST should point to an area of
* size at least BASE16_DECODE_LENGTH(length), and for sanity
* checking, *DST_LENGTH should be initialized to the size of that
* area before the call. *DST_LENGTH is updated to the amount of
* decoded output. */
* size at least BASE16_DECODE_LENGTH(length). The amount of data
* generated is returned in *DST_LENGTH. */
/* Currently results in an assertion failure if *DST_LENGTH is
* too small. FIXME: Return some error instead? */
int
base16_decode_update(struct base16_decode_ctx *ctx,
size_t *dst_length,
......
......@@ -122,8 +122,6 @@ base64_decode_update(struct base64_decode_ctx *ctx,
size_t done;
size_t i;
assert(*dst_length >= BASE64_DECODE_LENGTH(src_length));
for (i = 0, done = 0; i<src_length; i++)
switch(base64_decode_single(ctx, dst + done, src[i]))
{
......
......@@ -128,13 +128,8 @@ base64_decode_single(struct base64_decode_ctx *ctx,
uint8_t src);
/* Returns 1 on success, 0 on error. DST should point to an area of
* size at least BASE64_DECODE_LENGTH(length), and for sanity
* checking, *DST_LENGTH should be initialized to the size of that
* area before the call. *DST_LENGTH is updated to the amount of
* decoded output. */
/* Currently results in an assertion failure if *DST_LENGTH is
* too small. FIXME: Return some error instead? */
* size at least BASE64_DECODE_LENGTH(length). The amount of data
* generated is returned in *DST_LENGTH. */
int
base64_decode_update(struct base64_decode_ctx *ctx,
size_t *dst_length,
......
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