From 8ff9d4131bf79b36551c2ed995881a88fb9c0a61 Mon Sep 17 00:00:00 2001 From: Rob Austein Date: Tue, 12 Sep 2017 10:04:55 -0400 Subject: Untested ASN.1 support for ModExpA7 private speedup factors. --- asn1_internal.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'asn1_internal.h') diff --git a/asn1_internal.h b/asn1_internal.h index fe2f293..3de8bd6 100644 --- a/asn1_internal.h +++ b/asn1_internal.h @@ -151,6 +151,16 @@ extern hal_error_t hal_asn1_decode_pkcs8_encryptedprivatekeyinfo(const uint8_t * extern hal_error_t hal_asn1_guess_key_type(hal_key_type_t *type, hal_curve_name_t *curve, const uint8_t *const der, const size_t der_len); +/* + * Peek ahead for an OPTIONAL attribute. + */ + +static inline int hal_asn1_peek(const uint8_t tag, + const uint8_t * const der, size_t der_max) +{ + return der != NULL && der_max > 0 && der[0] == tag; +} + #endif /* _HAL_ASN1_INTERNAL_H_ */ /* -- cgit v1.2.3