diff options
Diffstat (limited to 'src/lib/libcrypto/asn1/a_strnid.c')
-rw-r--r-- | src/lib/libcrypto/asn1/a_strnid.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/src/lib/libcrypto/asn1/a_strnid.c b/src/lib/libcrypto/asn1/a_strnid.c index ab8417ffab..6b10cff994 100644 --- a/src/lib/libcrypto/asn1/a_strnid.c +++ b/src/lib/libcrypto/asn1/a_strnid.c | |||
@@ -65,8 +65,9 @@ | |||
65 | 65 | ||
66 | static STACK_OF(ASN1_STRING_TABLE) *stable = NULL; | 66 | static STACK_OF(ASN1_STRING_TABLE) *stable = NULL; |
67 | static void st_free(ASN1_STRING_TABLE *tbl); | 67 | static void st_free(ASN1_STRING_TABLE *tbl); |
68 | static int sk_table_cmp(ASN1_STRING_TABLE **a, ASN1_STRING_TABLE **b); | 68 | static int sk_table_cmp(const ASN1_STRING_TABLE * const *a, |
69 | static int table_cmp(ASN1_STRING_TABLE *a, ASN1_STRING_TABLE *b); | 69 | const ASN1_STRING_TABLE * const *b); |
70 | static int table_cmp(const void *a, const void *b); | ||
70 | 71 | ||
71 | 72 | ||
72 | /* This is the global mask for the mbstring functions: this is use to | 73 | /* This is the global mask for the mbstring functions: this is use to |
@@ -173,14 +174,16 @@ static ASN1_STRING_TABLE tbl_standard[] = { | |||
173 | {NID_dnQualifier, -1, -1, B_ASN1_PRINTABLESTRING, STABLE_NO_MASK} | 174 | {NID_dnQualifier, -1, -1, B_ASN1_PRINTABLESTRING, STABLE_NO_MASK} |
174 | }; | 175 | }; |
175 | 176 | ||
176 | static int sk_table_cmp(ASN1_STRING_TABLE **a, ASN1_STRING_TABLE **b) | 177 | static int sk_table_cmp(const ASN1_STRING_TABLE * const *a, |
178 | const ASN1_STRING_TABLE * const *b) | ||
177 | { | 179 | { |
178 | return (*a)->nid - (*b)->nid; | 180 | return (*a)->nid - (*b)->nid; |
179 | } | 181 | } |
180 | 182 | ||
181 | static int table_cmp(ASN1_STRING_TABLE *a, ASN1_STRING_TABLE *b) | 183 | static int table_cmp(const void *a, const void *b) |
182 | { | 184 | { |
183 | return a->nid - b->nid; | 185 | const ASN1_STRING_TABLE *sa = a, *sb = b; |
186 | return sa->nid - sb->nid; | ||
184 | } | 187 | } |
185 | 188 | ||
186 | ASN1_STRING_TABLE *ASN1_STRING_TABLE_get(int nid) | 189 | ASN1_STRING_TABLE *ASN1_STRING_TABLE_get(int nid) |
@@ -192,7 +195,7 @@ ASN1_STRING_TABLE *ASN1_STRING_TABLE_get(int nid) | |||
192 | ttmp = (ASN1_STRING_TABLE *) OBJ_bsearch((char *)&fnd, | 195 | ttmp = (ASN1_STRING_TABLE *) OBJ_bsearch((char *)&fnd, |
193 | (char *)tbl_standard, | 196 | (char *)tbl_standard, |
194 | sizeof(tbl_standard)/sizeof(ASN1_STRING_TABLE), | 197 | sizeof(tbl_standard)/sizeof(ASN1_STRING_TABLE), |
195 | sizeof(ASN1_STRING_TABLE), (int(*)())table_cmp); | 198 | sizeof(ASN1_STRING_TABLE), table_cmp); |
196 | if(ttmp) return ttmp; | 199 | if(ttmp) return ttmp; |
197 | if(!stable) return NULL; | 200 | if(!stable) return NULL; |
198 | idx = sk_ASN1_STRING_TABLE_find(stable, &fnd); | 201 | idx = sk_ASN1_STRING_TABLE_find(stable, &fnd); |
@@ -213,7 +216,7 @@ int ASN1_STRING_TABLE_add(int nid, | |||
213 | return 0; | 216 | return 0; |
214 | } | 217 | } |
215 | if(!(tmp = ASN1_STRING_TABLE_get(nid))) { | 218 | if(!(tmp = ASN1_STRING_TABLE_get(nid))) { |
216 | tmp = Malloc(sizeof(ASN1_STRING_TABLE)); | 219 | tmp = OPENSSL_malloc(sizeof(ASN1_STRING_TABLE)); |
217 | if(!tmp) { | 220 | if(!tmp) { |
218 | ASN1err(ASN1_F_ASN1_STRING_TABLE_ADD, | 221 | ASN1err(ASN1_F_ASN1_STRING_TABLE_ADD, |
219 | ERR_R_MALLOC_FAILURE); | 222 | ERR_R_MALLOC_FAILURE); |
@@ -241,7 +244,7 @@ void ASN1_STRING_TABLE_cleanup(void) | |||
241 | 244 | ||
242 | static void st_free(ASN1_STRING_TABLE *tbl) | 245 | static void st_free(ASN1_STRING_TABLE *tbl) |
243 | { | 246 | { |
244 | if(tbl->flags & STABLE_FLAGS_MALLOC) Free(tbl); | 247 | if(tbl->flags & STABLE_FLAGS_MALLOC) OPENSSL_free(tbl); |
245 | } | 248 | } |
246 | 249 | ||
247 | IMPLEMENT_STACK_OF(ASN1_STRING_TABLE) | 250 | IMPLEMENT_STACK_OF(ASN1_STRING_TABLE) |