[base16] Add buffer size parameter to base16_encode() and base16_decode()
authorMichael Brown <mcb30@ipxe.org>
Fri, 24 Apr 2015 13:34:32 +0000 (14:34 +0100)
committerMichael Brown <mcb30@ipxe.org>
Fri, 24 Apr 2015 13:41:32 +0000 (14:41 +0100)
commit9aa8090d069eb0b36769f33544faf0e7e429e844
tree02dd0bdc5afca6e625f2f6c73fd85244ab020093
parentb56b482fa3b48ae99c44cc60a34979f8780b076a
[base16] Add buffer size parameter to base16_encode() and base16_decode()

The current API for Base16 (and Base64) encoding requires the caller
to always provide sufficient buffer space.  This prevents the use of
the generic encoding/decoding functionality in some situations, such
as in formatting the hex setting types.

Implement a generic hex_encode() (based on the existing
format_hex_setting()), implement base16_encode() and base16_decode()
in terms of the more generic hex_encode() and hex_decode(), and update
all callers to provide the additional buffer length parameter.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
12 files changed:
src/core/base16.c
src/core/settings.c
src/crypto/x509.c
src/drivers/net/ecm.c
src/drivers/net/netfront.c
src/include/ipxe/base16.h
src/interface/efi/efi_debug.c
src/net/infiniband/ib_srp.c
src/net/pccrc.c
src/net/tcp/httpcore.c
src/net/tcp/iscsi.c
src/tests/base16_test.c