diff options
author | jsing <> | 2017-01-21 04:44:43 +0000 |
---|---|---|
committer | jsing <> | 2017-01-21 04:44:43 +0000 |
commit | cf9904a4b13d79f0e11e7db5209260a381b4a83f (patch) | |
tree | 59d52ecb3cef99a21130ed575a0a20c9b6536385 /src/lib/libcrypto/objects/obj_dat.c | |
parent | 4a0bade454554867032b09f31d540604366200d5 (diff) | |
download | openbsd-cf9904a4b13d79f0e11e7db5209260a381b4a83f.tar.gz openbsd-cf9904a4b13d79f0e11e7db5209260a381b4a83f.tar.bz2 openbsd-cf9904a4b13d79f0e11e7db5209260a381b4a83f.zip |
Expand DECLARE_OBJ_BSEARCH_CMP_FN and IMPLEMENT_OBJ_BSEARCH_CMP_FN macros.
No change to generated assembly excluding line numbers.
Diffstat (limited to 'src/lib/libcrypto/objects/obj_dat.c')
-rw-r--r-- | src/lib/libcrypto/objects/obj_dat.c | 62 |
1 files changed, 55 insertions, 7 deletions
diff --git a/src/lib/libcrypto/objects/obj_dat.c b/src/lib/libcrypto/objects/obj_dat.c index 1d6207072d..e1dacc0d39 100644 --- a/src/lib/libcrypto/objects/obj_dat.c +++ b/src/lib/libcrypto/objects/obj_dat.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: obj_dat.c,v 1.37 2016/12/22 16:57:38 inoguchi Exp $ */ | 1 | /* $OpenBSD: obj_dat.c,v 1.38 2017/01/21 04:44:43 jsing Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -72,9 +72,15 @@ | |||
72 | /* obj_dat.h is generated from objects.h by obj_dat.pl */ | 72 | /* obj_dat.h is generated from objects.h by obj_dat.pl */ |
73 | #include "obj_dat.h" | 73 | #include "obj_dat.h" |
74 | 74 | ||
75 | DECLARE_OBJ_BSEARCH_CMP_FN(const ASN1_OBJECT *, unsigned int, sn); | 75 | static int sn_cmp_BSEARCH_CMP_FN(const void *, const void *); |
76 | DECLARE_OBJ_BSEARCH_CMP_FN(const ASN1_OBJECT *, unsigned int, ln); | 76 | static int sn_cmp(const ASN1_OBJECT * const *, unsigned int const *); |
77 | DECLARE_OBJ_BSEARCH_CMP_FN(const ASN1_OBJECT *, unsigned int, obj); | 77 | static unsigned int *OBJ_bsearch_sn(const ASN1_OBJECT * *key, unsigned int const *base, int num); |
78 | static int ln_cmp_BSEARCH_CMP_FN(const void *, const void *); | ||
79 | static int ln_cmp(const ASN1_OBJECT * const *, unsigned int const *); | ||
80 | static unsigned int *OBJ_bsearch_ln(const ASN1_OBJECT * *key, unsigned int const *base, int num); | ||
81 | static int obj_cmp_BSEARCH_CMP_FN(const void *, const void *); | ||
82 | static int obj_cmp(const ASN1_OBJECT * const *, unsigned int const *); | ||
83 | static unsigned int *OBJ_bsearch_obj(const ASN1_OBJECT * *key, unsigned int const *base, int num); | ||
78 | 84 | ||
79 | #define ADDED_DATA 0 | 85 | #define ADDED_DATA 0 |
80 | #define ADDED_SNAME 1 | 86 | #define ADDED_SNAME 1 |
@@ -95,14 +101,42 @@ static int sn_cmp(const ASN1_OBJECT * const *a, const unsigned int *b) | |||
95 | return (strcmp((*a)->sn, nid_objs[*b].sn)); | 101 | return (strcmp((*a)->sn, nid_objs[*b].sn)); |
96 | } | 102 | } |
97 | 103 | ||
98 | IMPLEMENT_OBJ_BSEARCH_CMP_FN(const ASN1_OBJECT *, unsigned int, sn); | 104 | |
105 | static int | ||
106 | sn_cmp_BSEARCH_CMP_FN(const void *a_, const void *b_) | ||
107 | { | ||
108 | const ASN1_OBJECT * const *a = a_; | ||
109 | unsigned int const *b = b_; | ||
110 | return sn_cmp(a, b); | ||
111 | } | ||
112 | |||
113 | static unsigned int * | ||
114 | OBJ_bsearch_sn(const ASN1_OBJECT * *key, unsigned int const *base, int num) | ||
115 | { | ||
116 | return (unsigned int *)OBJ_bsearch_(key, base, num, sizeof(unsigned int), | ||
117 | sn_cmp_BSEARCH_CMP_FN); | ||
118 | } | ||
99 | 119 | ||
100 | static int ln_cmp(const ASN1_OBJECT * const *a, const unsigned int *b) | 120 | static int ln_cmp(const ASN1_OBJECT * const *a, const unsigned int *b) |
101 | { | 121 | { |
102 | return (strcmp((*a)->ln, nid_objs[*b].ln)); | 122 | return (strcmp((*a)->ln, nid_objs[*b].ln)); |
103 | } | 123 | } |
104 | 124 | ||
105 | IMPLEMENT_OBJ_BSEARCH_CMP_FN(const ASN1_OBJECT *, unsigned int, ln); | 125 | |
126 | static int | ||
127 | ln_cmp_BSEARCH_CMP_FN(const void *a_, const void *b_) | ||
128 | { | ||
129 | const ASN1_OBJECT * const *a = a_; | ||
130 | unsigned int const *b = b_; | ||
131 | return ln_cmp(a, b); | ||
132 | } | ||
133 | |||
134 | static unsigned int * | ||
135 | OBJ_bsearch_ln(const ASN1_OBJECT * *key, unsigned int const *base, int num) | ||
136 | { | ||
137 | return (unsigned int *)OBJ_bsearch_(key, base, num, sizeof(unsigned int), | ||
138 | ln_cmp_BSEARCH_CMP_FN); | ||
139 | } | ||
106 | 140 | ||
107 | static unsigned long | 141 | static unsigned long |
108 | added_obj_hash(const ADDED_OBJ *ca) | 142 | added_obj_hash(const ADDED_OBJ *ca) |
@@ -400,7 +434,21 @@ obj_cmp(const ASN1_OBJECT * const *ap, const unsigned int *bp) | |||
400 | return (memcmp(a->data, b->data, a->length)); | 434 | return (memcmp(a->data, b->data, a->length)); |
401 | } | 435 | } |
402 | 436 | ||
403 | IMPLEMENT_OBJ_BSEARCH_CMP_FN(const ASN1_OBJECT *, unsigned int, obj); | 437 | |
438 | static int | ||
439 | obj_cmp_BSEARCH_CMP_FN(const void *a_, const void *b_) | ||
440 | { | ||
441 | const ASN1_OBJECT * const *a = a_; | ||
442 | unsigned int const *b = b_; | ||
443 | return obj_cmp(a, b); | ||
444 | } | ||
445 | |||
446 | static unsigned int * | ||
447 | OBJ_bsearch_obj(const ASN1_OBJECT * *key, unsigned int const *base, int num) | ||
448 | { | ||
449 | return (unsigned int *)OBJ_bsearch_(key, base, num, sizeof(unsigned int), | ||
450 | obj_cmp_BSEARCH_CMP_FN); | ||
451 | } | ||
404 | 452 | ||
405 | int | 453 | int |
406 | OBJ_obj2nid(const ASN1_OBJECT *a) | 454 | OBJ_obj2nid(const ASN1_OBJECT *a) |