+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.
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]))
{
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,
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]))
{
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,