diff options
author | Paul Selkirk <paul@psgd.org> | 2018-07-24 22:17:28 -0400 |
---|---|---|
committer | Paul Selkirk <paul@psgd.org> | 2018-07-24 22:17:28 -0400 |
commit | 653d6b406c82848875f3581da41f095aade30338 (patch) | |
tree | d1ae39e964a87e5a986c0a5e9bfca46b04e88b8c /hashsig.c | |
parent | 222ec2b0d1ab78b142ad00d5969975c64801eeab (diff) |
Change the rest of the hashsig ASN.1 wrapper functions to static inline, for consistency.
Diffstat (limited to 'hashsig.c')
-rw-r--r-- | hashsig.c | 55 |
1 files changed, 36 insertions, 19 deletions
@@ -94,8 +94,10 @@ static inline hal_error_t hal_xdr_decode_bytestring16(const uint8_t ** const inb * ASN.1 extensions */ -#define hal_asn1_encode_size_t(n, der, der_len, der_max) \ - hal_asn1_encode_uint32((const uint32_t)n, der, der_len, der_max) +static inline hal_error_t hal_asn1_encode_size_t(const size_t n, uint8_t *der, size_t *der_len, const size_t der_max) +{ + return hal_asn1_encode_uint32((const uint32_t)n, der, der_len, der_max); +} static inline hal_error_t hal_asn1_decode_size_t(size_t *np, const uint8_t * const der, size_t *der_len, const size_t der_max) { @@ -114,8 +116,10 @@ static inline hal_error_t hal_asn1_decode_size_t(size_t *np, const uint8_t * con } } -#define hal_asn1_encode_lms_algorithm(type, der, der_len, der_max) \ - hal_asn1_encode_uint32((const uint32_t)type, der, der_len, der_max) +static inline hal_error_t hal_asn1_encode_lms_algorithm(const lms_algorithm_t type, uint8_t *der, size_t *der_len, const size_t der_max) +{ + return hal_asn1_encode_uint32((const uint32_t)type, der, der_len, der_max); +} static inline hal_error_t hal_asn1_decode_lms_algorithm(lms_algorithm_t *type, const uint8_t * const der, size_t *der_len, const size_t der_max) { @@ -128,8 +132,10 @@ static inline hal_error_t hal_asn1_decode_lms_algorithm(lms_algorithm_t *type, c return err; } -#define hal_asn1_encode_lmots_algorithm(type, der, der_len, der_max) \ - hal_asn1_encode_uint32((const uint32_t)type, der, der_len, der_max) +static inline hal_error_t hal_asn1_encode_lmots_algorithm(const lmots_algorithm_t type, uint8_t *der, size_t *der_len, const size_t der_max) +{ + return hal_asn1_encode_uint32((const uint32_t)type, der, der_len, der_max); +} static inline hal_error_t hal_asn1_decode_lmots_algorithm(lmots_algorithm_t *type, const uint8_t * const der, size_t *der_len, const size_t der_max) { @@ -142,24 +148,35 @@ static inline hal_error_t hal_asn1_decode_lmots_algorithm(lmots_algorithm_t *typ return err; } -#define hal_asn1_encode_uuid(data, der, der_len, der_max) \ - hal_asn1_encode_octet_string((const uint8_t * const)data, sizeof(hal_uuid_t), der, der_len, der_max) - -#define hal_asn1_decode_uuid(data, der, der_len, der_max) \ - hal_asn1_decode_octet_string((uint8_t *)data, sizeof(hal_uuid_t), der, der_len, der_max) +static inline hal_error_t hal_asn1_encode_uuid(const hal_uuid_t * const data, uint8_t *der, size_t *der_len, const size_t der_max) +{ + return hal_asn1_encode_octet_string((const uint8_t * const)data, sizeof(hal_uuid_t), der, der_len, der_max); +} -#define hal_asn1_encode_bytestring16(data, der, der_len, der_max) \ - hal_asn1_encode_octet_string((const uint8_t * const)data, sizeof(bytestring16), der, der_len, der_max) +static inline hal_error_t hal_asn1_decode_uuid(hal_uuid_t *data, const uint8_t * const der, size_t *der_len, const size_t der_max) +{ + return hal_asn1_decode_octet_string((uint8_t *)data, sizeof(hal_uuid_t), der, der_len, der_max); +} -#define hal_asn1_decode_bytestring16(data, der, der_len, der_max) \ - hal_asn1_decode_octet_string((uint8_t *)data, sizeof(bytestring16), der, der_len, der_max) +static inline hal_error_t hal_asn1_encode_bytestring16(const bytestring16 * const data, uint8_t *der, size_t *der_len, const size_t der_max) +{ + return hal_asn1_encode_octet_string((const uint8_t * const)data, sizeof(bytestring16), der, der_len, der_max); +} -#define hal_asn1_encode_bytestring32(data, der, der_len, der_max) \ - hal_asn1_encode_octet_string((const uint8_t * const)data, sizeof(bytestring32), der, der_len, der_max) +static inline hal_error_t hal_asn1_decode_bytestring16(bytestring16 *data, const uint8_t * const der, size_t *der_len, const size_t der_max) +{ + return hal_asn1_decode_octet_string((uint8_t *)data, sizeof(bytestring16), der, der_len, der_max); +} -#define hal_asn1_decode_bytestring32(data, der, der_len, der_max) \ - hal_asn1_decode_octet_string((uint8_t *)data, sizeof(bytestring32), der, der_len, der_max) +static inline hal_error_t hal_asn1_encode_bytestring32(const bytestring32 * const data, uint8_t *der, size_t *der_len, const size_t der_max) +{ + return hal_asn1_encode_octet_string((const uint8_t * const)data, sizeof(bytestring32), der, der_len, der_max); +} +static inline hal_error_t hal_asn1_decode_bytestring32(bytestring32 *data, const uint8_t * const der, size_t *der_len, const size_t der_max) +{ + return hal_asn1_decode_octet_string((uint8_t *)data, sizeof(bytestring32), der, der_len, der_max); +} /* ---------------------------------------------------------------- */ |