diff options
Diffstat (limited to 'src/lib/libssl/src/crypto/objects/objects.h')
| -rw-r--r-- | src/lib/libssl/src/crypto/objects/objects.h | 97 |
1 files changed, 93 insertions, 4 deletions
diff --git a/src/lib/libssl/src/crypto/objects/objects.h b/src/lib/libssl/src/crypto/objects/objects.h index 7242f76fb0..bd0ee52feb 100644 --- a/src/lib/libssl/src/crypto/objects/objects.h +++ b/src/lib/libssl/src/crypto/objects/objects.h | |||
| @@ -1011,10 +1011,91 @@ int OBJ_txt2nid(const char *s); | |||
| 1011 | int OBJ_ln2nid(const char *s); | 1011 | int OBJ_ln2nid(const char *s); |
| 1012 | int OBJ_sn2nid(const char *s); | 1012 | int OBJ_sn2nid(const char *s); |
| 1013 | int OBJ_cmp(const ASN1_OBJECT *a,const ASN1_OBJECT *b); | 1013 | int OBJ_cmp(const ASN1_OBJECT *a,const ASN1_OBJECT *b); |
| 1014 | const char * OBJ_bsearch(const char *key,const char *base,int num,int size, | 1014 | const void * OBJ_bsearch_(const void *key,const void *base,int num,int size, |
| 1015 | int (*cmp)(const void *, const void *)); | 1015 | int (*cmp)(const void *, const void *)); |
| 1016 | const char * OBJ_bsearch_ex(const char *key,const char *base,int num, | 1016 | const void * OBJ_bsearch_ex_(const void *key,const void *base,int num, |
| 1017 | int size, int (*cmp)(const void *, const void *), int flags); | 1017 | int size, |
| 1018 | int (*cmp)(const void *, const void *), | ||
| 1019 | int flags); | ||
| 1020 | |||
| 1021 | #define _DECLARE_OBJ_BSEARCH_CMP_FN(scope, type1, type2, nm) \ | ||
| 1022 | static int nm##_cmp_BSEARCH_CMP_FN(const void *, const void *); \ | ||
| 1023 | static int nm##_cmp(type1 const *, type2 const *); \ | ||
| 1024 | scope type2 * OBJ_bsearch_##nm(type1 *key, type2 const *base, int num) | ||
| 1025 | |||
| 1026 | #define DECLARE_OBJ_BSEARCH_CMP_FN(type1, type2, cmp) \ | ||
| 1027 | _DECLARE_OBJ_BSEARCH_CMP_FN(static, type1, type2, cmp) | ||
| 1028 | #define DECLARE_OBJ_BSEARCH_GLOBAL_CMP_FN(type1, type2, nm) \ | ||
| 1029 | type2 * OBJ_bsearch_##nm(type1 *key, type2 const *base, int num) | ||
| 1030 | |||
| 1031 | /* | ||
| 1032 | * Unsolved problem: if a type is actually a pointer type, like | ||
| 1033 | * nid_triple is, then its impossible to get a const where you need | ||
| 1034 | * it. Consider: | ||
| 1035 | * | ||
| 1036 | * typedef int nid_triple[3]; | ||
| 1037 | * const void *a_; | ||
| 1038 | * const nid_triple const *a = a_; | ||
| 1039 | * | ||
| 1040 | * The assignement discards a const because what you really want is: | ||
| 1041 | * | ||
| 1042 | * const int const * const *a = a_; | ||
| 1043 | * | ||
| 1044 | * But if you do that, you lose the fact that a is an array of 3 ints, | ||
| 1045 | * which breaks comparison functions. | ||
| 1046 | * | ||
| 1047 | * Thus we end up having to cast, sadly, or unpack the | ||
| 1048 | * declarations. Or, as I finally did in this case, delcare nid_triple | ||
| 1049 | * to be a struct, which it should have been in the first place. | ||
| 1050 | * | ||
| 1051 | * Ben, August 2008. | ||
| 1052 | * | ||
| 1053 | * Also, strictly speaking not all types need be const, but handling | ||
| 1054 | * the non-constness means a lot of complication, and in practice | ||
| 1055 | * comparison routines do always not touch their arguments. | ||
| 1056 | */ | ||
| 1057 | |||
| 1058 | #define IMPLEMENT_OBJ_BSEARCH_CMP_FN(type1, type2, nm) \ | ||
| 1059 | static int nm##_cmp_BSEARCH_CMP_FN(const void *a_, const void *b_) \ | ||
| 1060 | { \ | ||
| 1061 | type1 const *a = a_; \ | ||
| 1062 | type2 const *b = b_; \ | ||
| 1063 | return nm##_cmp(a,b); \ | ||
| 1064 | } \ | ||
| 1065 | static type2 *OBJ_bsearch_##nm(type1 *key, type2 const *base, int num) \ | ||
| 1066 | { \ | ||
| 1067 | return (type2 *)OBJ_bsearch_(key, base, num, sizeof(type2), \ | ||
| 1068 | nm##_cmp_BSEARCH_CMP_FN); \ | ||
| 1069 | } \ | ||
| 1070 | extern void dummy_prototype(void) | ||
| 1071 | |||
| 1072 | #define IMPLEMENT_OBJ_BSEARCH_GLOBAL_CMP_FN(type1, type2, nm) \ | ||
| 1073 | static int nm##_cmp_BSEARCH_CMP_FN(const void *a_, const void *b_) \ | ||
| 1074 | { \ | ||
| 1075 | type1 const *a = a_; \ | ||
| 1076 | type2 const *b = b_; \ | ||
| 1077 | return nm##_cmp(a,b); \ | ||
| 1078 | } \ | ||
| 1079 | type2 *OBJ_bsearch_##nm(type1 *key, type2 const *base, int num) \ | ||
| 1080 | { \ | ||
| 1081 | return (type2 *)OBJ_bsearch_(key, base, num, sizeof(type2), \ | ||
| 1082 | nm##_cmp_BSEARCH_CMP_FN); \ | ||
| 1083 | } \ | ||
| 1084 | extern void dummy_prototype(void) | ||
| 1085 | |||
| 1086 | #define OBJ_bsearch(type1,key,type2,base,num,cmp) \ | ||
| 1087 | ((type2 *)OBJ_bsearch_(CHECKED_PTR_OF(type1,key),CHECKED_PTR_OF(type2,base), \ | ||
| 1088 | num,sizeof(type2), \ | ||
| 1089 | ((void)CHECKED_PTR_OF(type1,cmp##_type_1), \ | ||
| 1090 | (void)CHECKED_PTR_OF(type2,cmp##_type_2), \ | ||
| 1091 | cmp##_BSEARCH_CMP_FN))) | ||
| 1092 | |||
| 1093 | #define OBJ_bsearch_ex(type1,key,type2,base,num,cmp,flags) \ | ||
| 1094 | ((type2 *)OBJ_bsearch_ex_(CHECKED_PTR_OF(type1,key),CHECKED_PTR_OF(type2,base), \ | ||
| 1095 | num,sizeof(type2), \ | ||
| 1096 | ((void)CHECKED_PTR_OF(type1,cmp##_type_1), \ | ||
| 1097 | (void)type_2=CHECKED_PTR_OF(type2,cmp##_type_2), \ | ||
| 1098 | cmp##_BSEARCH_CMP_FN)),flags) | ||
| 1018 | 1099 | ||
| 1019 | int OBJ_new_nid(int num); | 1100 | int OBJ_new_nid(int num); |
| 1020 | int OBJ_add_object(const ASN1_OBJECT *obj); | 1101 | int OBJ_add_object(const ASN1_OBJECT *obj); |
| @@ -1022,6 +1103,14 @@ int OBJ_create(const char *oid,const char *sn,const char *ln); | |||
| 1022 | void OBJ_cleanup(void ); | 1103 | void OBJ_cleanup(void ); |
| 1023 | int OBJ_create_objects(BIO *in); | 1104 | int OBJ_create_objects(BIO *in); |
| 1024 | 1105 | ||
| 1106 | int OBJ_find_sigid_algs(int signid, int *pdig_nid, int *ppkey_nid); | ||
| 1107 | int OBJ_find_sigid_by_algs(int *psignid, int dig_nid, int pkey_nid); | ||
| 1108 | int OBJ_add_sigid(int signid, int dig_id, int pkey_id); | ||
| 1109 | void OBJ_sigid_free(void); | ||
| 1110 | |||
| 1111 | extern int obj_cleanup_defer; | ||
| 1112 | void check_defer(int nid); | ||
| 1113 | |||
| 1025 | /* BEGIN ERROR CODES */ | 1114 | /* BEGIN ERROR CODES */ |
| 1026 | /* The following lines are auto generated by the script mkerr.pl. Any changes | 1115 | /* The following lines are auto generated by the script mkerr.pl. Any changes |
| 1027 | * made after this point may be overwritten when the script is next run. | 1116 | * made after this point may be overwritten when the script is next run. |
