From c83763bd46103b4f131017b9b498950dce307a09 Mon Sep 17 00:00:00 2001 From: zeromus Date: Sat, 9 Jul 2016 19:20:33 -0500 Subject: [PATCH] fix tiny compile error in tomcrypt_pk.h macro An ARM compiler gives me this: libtomcrypt\pk\asn1\der\sequence\der_decode_subject_public_key_info.c(65,4): error #188-D: enumerated type mixed with another type Since der_decode_subject_public_key_info's parameters_type is of type 'unsigned long', an attempt to assign it to ltc_asn1_list's member 'ltc_asn1_type type' fails. My fix solves this in a simple way by casting it at the point of assignment. But while studying this I noticed there's no use of enum in the codebase other than a few PK-related things. Perhaps a more appropriate solution would be to remove these enums. I mean, enums seem like an OK enough idea, but I don't know anything about the practicality of using enums in archaic C dialects like libtomcrypt conforms (thankfully!) to... --- src/headers/tomcrypt_pk.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/headers/tomcrypt_pk.h b/src/headers/tomcrypt_pk.h index 5b3525e..95e3080 100644 --- a/src/headers/tomcrypt_pk.h +++ b/src/headers/tomcrypt_pk.h @@ -487,7 +487,7 @@ typedef struct ltc_asn1_list_ { do { \ int LTC_MACRO_temp = (index); \ ltc_asn1_list *LTC_MACRO_list = (list); \ - LTC_MACRO_list[LTC_MACRO_temp].type = (Type); \ + LTC_MACRO_list[LTC_MACRO_temp].type = (ltc_asn1_type)(Type); \ LTC_MACRO_list[LTC_MACRO_temp].data = (void*)(Data); \ LTC_MACRO_list[LTC_MACRO_temp].size = (Size); \ LTC_MACRO_list[LTC_MACRO_temp].used = 0; \