OLD | NEW |
1 /* crypto/objects/objects.h */ | 1 /* crypto/objects/objects.h */ |
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 * |
5 * This package is an SSL implementation written | 5 * This package is an SSL implementation written |
6 * by Eric Young (eay@cryptsoft.com). | 6 * by Eric Young (eay@cryptsoft.com). |
7 * The implementation was written so as to conform with Netscapes SSL. | 7 * The implementation was written so as to conform with Netscapes SSL. |
8 * | 8 * |
9 * This library is free for commercial and non-commercial use as long as | 9 * This library is free for commercial and non-commercial use as long as |
10 * the following conditions are aheared to. The following conditions | 10 * the following conditions are aheared to. The following conditions |
(...skipping 993 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1004 ASN1_OBJECT * OBJ_nid2obj(int n); | 1004 ASN1_OBJECT * OBJ_nid2obj(int n); |
1005 const char * OBJ_nid2ln(int n); | 1005 const char * OBJ_nid2ln(int n); |
1006 const char * OBJ_nid2sn(int n); | 1006 const char * OBJ_nid2sn(int n); |
1007 int OBJ_obj2nid(const ASN1_OBJECT *o); | 1007 int OBJ_obj2nid(const ASN1_OBJECT *o); |
1008 ASN1_OBJECT * OBJ_txt2obj(const char *s, int no_name); | 1008 ASN1_OBJECT * OBJ_txt2obj(const char *s, int no_name); |
1009 int OBJ_obj2txt(char *buf, int buf_len, const ASN1_OBJECT *a, int no_name); | 1009 int OBJ_obj2txt(char *buf, int buf_len, const ASN1_OBJECT *a, int no_name); |
1010 int OBJ_txt2nid(const char *s); | 1010 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); |
1021 int OBJ_create(const char *oid,const char *sn,const char *ln); | 1102 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. |
1028 */ | 1117 */ |
1029 void ERR_load_OBJ_strings(void); | 1118 void ERR_load_OBJ_strings(void); |
1030 | 1119 |
1031 /* Error codes for the OBJ functions. */ | 1120 /* Error codes for the OBJ functions. */ |
1032 | 1121 |
1033 /* Function codes. */ | 1122 /* Function codes. */ |
1034 #define OBJ_F_OBJ_ADD_OBJECT 105 | 1123 #define OBJ_F_OBJ_ADD_OBJECT 105 |
1035 #define OBJ_F_OBJ_CREATE 100 | 1124 #define OBJ_F_OBJ_CREATE 100 |
1036 #define OBJ_F_OBJ_DUP 101 | 1125 #define OBJ_F_OBJ_DUP 101 |
1037 #define OBJ_F_OBJ_NAME_NEW_INDEX 106 | 1126 #define OBJ_F_OBJ_NAME_NEW_INDEX 106 |
1038 #define OBJ_F_OBJ_NID2LN 102 | 1127 #define OBJ_F_OBJ_NID2LN 102 |
1039 #define OBJ_F_OBJ_NID2OBJ 103 | 1128 #define OBJ_F_OBJ_NID2OBJ 103 |
1040 #define OBJ_F_OBJ_NID2SN 104 | 1129 #define OBJ_F_OBJ_NID2SN 104 |
1041 | 1130 |
1042 /* Reason codes. */ | 1131 /* Reason codes. */ |
1043 #define OBJ_R_MALLOC_FAILURE 100 | 1132 #define OBJ_R_MALLOC_FAILURE 100 |
1044 #define OBJ_R_UNKNOWN_NID 101 | 1133 #define OBJ_R_UNKNOWN_NID 101 |
1045 | 1134 |
1046 #ifdef __cplusplus | 1135 #ifdef __cplusplus |
1047 } | 1136 } |
1048 #endif | 1137 #endif |
1049 #endif | 1138 #endif |
OLD | NEW |