summaryrefslogtreecommitdiffstats
path: root/src/crypto
diff options
context:
space:
mode:
authorMichael Brown2015-04-24 15:34:32 +0200
committerMichael Brown2015-04-24 15:41:32 +0200
commit9aa8090d069eb0b36769f33544faf0e7e429e844 (patch)
tree02dd0bdc5afca6e625f2f6c73fd85244ab020093 /src/crypto
parent[test] Include IPv6 support when performing settings self-tests (diff)
downloadipxe-9aa8090d069eb0b36769f33544faf0e7e429e844.tar.gz
ipxe-9aa8090d069eb0b36769f33544faf0e7e429e844.tar.xz
ipxe-9aa8090d069eb0b36769f33544faf0e7e429e844.zip
[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>
Diffstat (limited to 'src/crypto')
-rw-r--r--src/crypto/x509.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/crypto/x509.c b/src/crypto/x509.c
index 49a1bce7..00eb226e 100644
--- a/src/crypto/x509.c
+++ b/src/crypto/x509.c
@@ -143,7 +143,8 @@ const char * x509_name ( struct x509_certificate *cert ) {
} else {
/* Certificate has no commonName: use SHA-1 fingerprint */
x509_fingerprint ( cert, digest, fingerprint );
- base16_encode ( fingerprint, sizeof ( fingerprint ), buf );
+ base16_encode ( fingerprint, sizeof ( fingerprint ),
+ buf, sizeof ( buf ) );
}
return buf;
}