Skip to content

Commit 9817c6b

Browse files
committed
Fix warnings and errors of amalgam build
Yeah, those functions should be in a header file, but we had problems with some platforms which don't properly support inline functions, so we'll keep it as is for now. Signed-off-by: Steffen Jaeckel <s@jaeckel.eu>
1 parent afab36b commit 9817c6b

File tree

5 files changed

+34
-1
lines changed

5 files changed

+34
-1
lines changed

src/pk/asn1/x509/x509_extensions.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ LTC_INLINE static int s_get_element_(const st_oid_detail* details, unsigned long
5555
#define s_get_element(arr, arc, oid, res) s_get_element_(arr, LTC_ARRAY_SIZE(arr), arc, sizeof(arc) - 1, oid, res)
5656

5757

58+
#ifndef S_IS_CONTEXT_SPECIFIC
59+
#define S_IS_CONTEXT_SPECIFIC
5860
LTC_INLINE static int s_is_context_specific(const ltc_asn1_list *seq)
5961
{
6062
if (seq->type != LTC_ASN1_CUSTOM_TYPE)
@@ -63,7 +65,10 @@ LTC_INLINE static int s_is_context_specific(const ltc_asn1_list *seq)
6365
return 0;
6466
return 1;
6567
}
68+
#endif
6669

70+
#ifndef S_IS_CONTEXT_SPECIFIC_PRIMITIVE
71+
#define S_IS_CONTEXT_SPECIFIC_PRIMITIVE
6772
LTC_INLINE static int s_is_context_specific_primitive(const ltc_asn1_list *seq)
6873
{
6974
if (!s_is_context_specific(seq))
@@ -72,6 +77,7 @@ LTC_INLINE static int s_is_context_specific_primitive(const ltc_asn1_list *seq)
7277
return 0;
7378
return 1;
7479
}
80+
#endif
7581

7682
LTC_INLINE static int s_looks_like_general_name(const ltc_asn1_list *name)
7783
{
@@ -504,14 +510,19 @@ static int s_get_ce_value(const ltc_asn1_list *os, st_ce_value *ce)
504510
return err;
505511
}
506512

513+
#ifndef S_FREE
514+
#define S_FREE
507515
LTC_INLINE static void s_free(const void* p)
508516
{
509517
if (p == NULL) {
510518
return;
511519
}
512520
XFREE((void*)p);
513521
}
522+
#endif
514523

524+
#ifndef S_FREE_X509_STRING_ARRAY
525+
#define S_FREE_X509_STRING_ARRAY
515526
LTC_INLINE static void s_free_x509_string_array(const ltc_x509_string *strings, unsigned long num)
516527
{
517528
unsigned long n;
@@ -520,6 +531,7 @@ LTC_INLINE static void s_free_x509_string_array(const ltc_x509_string *strings,
520531
}
521532
s_free(strings);
522533
}
534+
#endif
523535

524536
LTC_INLINE static void s_free_extension(const ltc_x509_extension *ext)
525537
{

src/pk/asn1/x509/x509_get.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
static LTC_INLINE int s_x509_get_oid(const ltc_asn1_list *pub, enum ltc_oid_id *oid_id)
1313
{
1414
der_flexi_check flexi_should[3];
15-
ltc_asn1_list *seqid, *id;
15+
ltc_asn1_list *seqid, *id = NULL;
1616
int err;
1717
unsigned long n = 0;
1818
LTC_SET_DER_FLEXI_CHECK(flexi_should, n++, LTC_ASN1_SEQUENCE, &seqid);

src/pk/asn1/x509/x509_import.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
#define OID_DETAIL_ELEMENT(detail, oid, types, ub) { detail, oid, types, ub, NULL }
2222
#define OID_DETAIL_ELEMENT_5(detail, arc, oid, types, ub) { detail, arc "." # oid, types, ub, NULL }
2323

24+
#define st_oid_detail st_x509_import_oid_detail
25+
2426
typedef struct st_oid_detail {
2527
ltc_x509_details detail;
2628
const char *oid;
@@ -162,6 +164,7 @@ LTC_INLINE static int s_x509_get_name_process(const ltc_asn1_list *set, st_oid_d
162164
return CRYPT_OK;
163165
}
164166

167+
#ifndef S_FREE
165168
#define S_FREE
166169
LTC_INLINE static void s_free(const void* p)
167170
{
@@ -170,7 +173,10 @@ LTC_INLINE static void s_free(const void* p)
170173
}
171174
XFREE((void*)p);
172175
}
176+
#endif
173177

178+
#ifndef S_FREE_X509_STRING_ARRAY
179+
#define S_FREE_X509_STRING_ARRAY
174180
LTC_INLINE static void s_free_x509_string_array(const ltc_x509_string *strings, unsigned long num)
175181
{
176182
unsigned long n;
@@ -179,6 +185,7 @@ LTC_INLINE static void s_free_x509_string_array(const ltc_x509_string *strings,
179185
}
180186
s_free(strings);
181187
}
188+
#endif
182189

183190
#define SETBIT(v, n) (v=((unsigned char)(v) | (1U << (unsigned char)(n))))
184191
#define CLRBIT(v, n) (v=((unsigned char)(v) & ~(1U << (unsigned char)(n))))
@@ -431,6 +438,8 @@ static int s_x509_check_spki(const ltc_asn1_list *seq, const ltc_pka_key *spki)
431438
return CRYPT_PK_INVALID_TYPE;
432439
}
433440

441+
#ifndef S_IS_CONTEXT_SPECIFIC
442+
#define S_IS_CONTEXT_SPECIFIC
434443
LTC_INLINE static int s_is_context_specific(const ltc_asn1_list *seq)
435444
{
436445
if (seq->type != LTC_ASN1_CUSTOM_TYPE)
@@ -439,7 +448,10 @@ LTC_INLINE static int s_is_context_specific(const ltc_asn1_list *seq)
439448
return 0;
440449
return 1;
441450
}
451+
#endif
442452

453+
#ifndef S_IS_CONTEXT_SPECIFIC_PRIMITIVE
454+
#define S_IS_CONTEXT_SPECIFIC_PRIMITIVE
443455
LTC_INLINE static int s_is_context_specific_primitive(const ltc_asn1_list *seq)
444456
{
445457
if (!s_is_context_specific(seq))
@@ -448,6 +460,7 @@ LTC_INLINE static int s_is_context_specific_primitive(const ltc_asn1_list *seq)
448460
return 0;
449461
return 1;
450462
}
463+
#endif
451464

452465
LTC_INLINE static int s_is_context_specific_constructed(const ltc_asn1_list *seq)
453466
{
@@ -650,4 +663,6 @@ void x509_free(const ltc_x509_certificate **cert)
650663
*cert = NULL;
651664
}
652665

666+
#undef st_oid_detail
667+
653668
#endif /* LTC_DER */

src/pk/rsa/rsa_import.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99

1010
#ifdef LTC_MRSA
1111

12+
#ifndef S_RSA_DECODE
13+
#define S_RSA_DECODE
1214
static int s_rsa_decode(const unsigned char *in, unsigned long inlen, rsa_key *key)
1315
{
1416
/* now it should be SEQUENCE { INTEGER, INTEGER } */
@@ -17,6 +19,7 @@ static int s_rsa_decode(const unsigned char *in, unsigned long inlen, rsa_key *k
1719
LTC_ASN1_INTEGER, 1UL, key->e,
1820
LTC_ASN1_EOL, 0UL, NULL);
1921
}
22+
#endif
2023

2124

2225
/**

src/pk/rsa/rsa_import_x509.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99

1010
#ifdef LTC_MRSA
1111

12+
#ifndef S_RSA_DECODE
13+
#define S_RSA_DECODE
1214
static int s_rsa_decode(const unsigned char *in, unsigned long inlen, rsa_key *key)
1315
{
1416
/* now it should be SEQUENCE { INTEGER, INTEGER } */
@@ -17,6 +19,7 @@ static int s_rsa_decode(const unsigned char *in, unsigned long inlen, rsa_key *k
1719
LTC_ASN1_INTEGER, 1UL, key->e,
1820
LTC_ASN1_EOL, 0UL, NULL);
1921
}
22+
#endif
2023

2124
typedef struct rsa_pss_parameters_data {
2225
ltc_asn1_list params[4], inner[4], hash_alg[1], mgf[2], mgf_hash_alg[1];

0 commit comments

Comments
 (0)