Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Nettle
nettle
Commits
07cb0b62
Commit
07cb0b62
authored
Feb 07, 2014
by
Niels Möller
Browse files
Base64 and base16 decoding: Use *dst_length as output only.
parent
d055d0e5
Changes
5
Hide whitespace changes
Inline
Side-by-side
ChangeLog
View file @
07cb0b62
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.
...
...
base16-decode.c
View file @
07cb0b62
...
...
@@ -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
]))
{
...
...
base16.h
View file @
07cb0b62
...
...
@@ -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
,
...
...
base64-decode.c
View file @
07cb0b62
...
...
@@ -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
]))
{
...
...
base64.h
View file @
07cb0b62
...
...
@@ -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
,
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment