File indexing completed on 2025-01-18 10:05:47
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #ifndef OPENSSL_OBJECTS_H
0011 # define OPENSSL_OBJECTS_H
0012 # pragma once
0013
0014 # include <openssl/macros.h>
0015 # ifndef OPENSSL_NO_DEPRECATED_3_0
0016 # define HEADER_OBJECTS_H
0017 # endif
0018
0019 # include <openssl/obj_mac.h>
0020 # include <openssl/bio.h>
0021 # include <openssl/asn1.h>
0022 # include <openssl/objectserr.h>
0023
0024 # define OBJ_NAME_TYPE_UNDEF 0x00
0025 # define OBJ_NAME_TYPE_MD_METH 0x01
0026 # define OBJ_NAME_TYPE_CIPHER_METH 0x02
0027 # define OBJ_NAME_TYPE_PKEY_METH 0x03
0028 # define OBJ_NAME_TYPE_COMP_METH 0x04
0029 # define OBJ_NAME_TYPE_MAC_METH 0x05
0030 # define OBJ_NAME_TYPE_KDF_METH 0x06
0031 # define OBJ_NAME_TYPE_NUM 0x07
0032
0033 # define OBJ_NAME_ALIAS 0x8000
0034
0035 # define OBJ_BSEARCH_VALUE_ON_NOMATCH 0x01
0036 # define OBJ_BSEARCH_FIRST_VALUE_ON_MATCH 0x02
0037
0038
0039 #ifdef __cplusplus
0040 extern "C" {
0041 #endif
0042
0043 typedef struct obj_name_st {
0044 int type;
0045 int alias;
0046 const char *name;
0047 const char *data;
0048 } OBJ_NAME;
0049
0050 # define OBJ_create_and_add_object(a,b,c) OBJ_create(a,b,c)
0051
0052 int OBJ_NAME_init(void);
0053 int OBJ_NAME_new_index(unsigned long (*hash_func) (const char *),
0054 int (*cmp_func) (const char *, const char *),
0055 void (*free_func) (const char *, int, const char *));
0056 const char *OBJ_NAME_get(const char *name, int type);
0057 int OBJ_NAME_add(const char *name, int type, const char *data);
0058 int OBJ_NAME_remove(const char *name, int type);
0059 void OBJ_NAME_cleanup(int type);
0060 void OBJ_NAME_do_all(int type, void (*fn) (const OBJ_NAME *, void *arg),
0061 void *arg);
0062 void OBJ_NAME_do_all_sorted(int type,
0063 void (*fn) (const OBJ_NAME *, void *arg),
0064 void *arg);
0065
0066 DECLARE_ASN1_DUP_FUNCTION_name(ASN1_OBJECT, OBJ)
0067 ASN1_OBJECT *OBJ_nid2obj(int n);
0068 const char *OBJ_nid2ln(int n);
0069 const char *OBJ_nid2sn(int n);
0070 int OBJ_obj2nid(const ASN1_OBJECT *o);
0071 ASN1_OBJECT *OBJ_txt2obj(const char *s, int no_name);
0072 int OBJ_obj2txt(char *buf, int buf_len, const ASN1_OBJECT *a, int no_name);
0073 int OBJ_txt2nid(const char *s);
0074 int OBJ_ln2nid(const char *s);
0075 int OBJ_sn2nid(const char *s);
0076 int OBJ_cmp(const ASN1_OBJECT *a, const ASN1_OBJECT *b);
0077 const void *OBJ_bsearch_(const void *key, const void *base, int num, int size,
0078 int (*cmp) (const void *, const void *));
0079 const void *OBJ_bsearch_ex_(const void *key, const void *base, int num,
0080 int size,
0081 int (*cmp) (const void *, const void *),
0082 int flags);
0083
0084 # define _DECLARE_OBJ_BSEARCH_CMP_FN(scope, type1, type2, nm) \
0085 static int nm##_cmp_BSEARCH_CMP_FN(const void *, const void *); \
0086 static int nm##_cmp(type1 const *, type2 const *); \
0087 scope type2 * OBJ_bsearch_##nm(type1 *key, type2 const *base, int num)
0088
0089 # define DECLARE_OBJ_BSEARCH_CMP_FN(type1, type2, cmp) \
0090 _DECLARE_OBJ_BSEARCH_CMP_FN(static, type1, type2, cmp)
0091 # define DECLARE_OBJ_BSEARCH_GLOBAL_CMP_FN(type1, type2, nm) \
0092 type2 * OBJ_bsearch_##nm(type1 *key, type2 const *base, int num)
0093
0094
0095
0096
0097
0098
0099
0100
0101
0102
0103
0104
0105
0106
0107
0108
0109
0110
0111
0112
0113
0114
0115
0116
0117
0118
0119
0120
0121 # define IMPLEMENT_OBJ_BSEARCH_CMP_FN(type1, type2, nm) \
0122 static int nm##_cmp_BSEARCH_CMP_FN(const void *a_, const void *b_) \
0123 { \
0124 type1 const *a = a_; \
0125 type2 const *b = b_; \
0126 return nm##_cmp(a,b); \
0127 } \
0128 static type2 *OBJ_bsearch_##nm(type1 *key, type2 const *base, int num) \
0129 { \
0130 return (type2 *)OBJ_bsearch_(key, base, num, sizeof(type2), \
0131 nm##_cmp_BSEARCH_CMP_FN); \
0132 } \
0133 extern void dummy_prototype(void)
0134
0135 # define IMPLEMENT_OBJ_BSEARCH_GLOBAL_CMP_FN(type1, type2, nm) \
0136 static int nm##_cmp_BSEARCH_CMP_FN(const void *a_, const void *b_) \
0137 { \
0138 type1 const *a = a_; \
0139 type2 const *b = b_; \
0140 return nm##_cmp(a,b); \
0141 } \
0142 type2 *OBJ_bsearch_##nm(type1 *key, type2 const *base, int num) \
0143 { \
0144 return (type2 *)OBJ_bsearch_(key, base, num, sizeof(type2), \
0145 nm##_cmp_BSEARCH_CMP_FN); \
0146 } \
0147 extern void dummy_prototype(void)
0148
0149 # define OBJ_bsearch(type1,key,type2,base,num,cmp) \
0150 ((type2 *)OBJ_bsearch_(CHECKED_PTR_OF(type1,key),CHECKED_PTR_OF(type2,base), \
0151 num,sizeof(type2), \
0152 ((void)CHECKED_PTR_OF(type1,cmp##_type_1), \
0153 (void)CHECKED_PTR_OF(type2,cmp##_type_2), \
0154 cmp##_BSEARCH_CMP_FN)))
0155
0156 # define OBJ_bsearch_ex(type1,key,type2,base,num,cmp,flags) \
0157 ((type2 *)OBJ_bsearch_ex_(CHECKED_PTR_OF(type1,key),CHECKED_PTR_OF(type2,base), \
0158 num,sizeof(type2), \
0159 ((void)CHECKED_PTR_OF(type1,cmp##_type_1), \
0160 (void)type_2=CHECKED_PTR_OF(type2,cmp##_type_2), \
0161 cmp##_BSEARCH_CMP_FN)),flags)
0162
0163 int OBJ_new_nid(int num);
0164 int OBJ_add_object(const ASN1_OBJECT *obj);
0165 int OBJ_create(const char *oid, const char *sn, const char *ln);
0166 #ifndef OPENSSL_NO_DEPRECATED_1_1_0
0167 # define OBJ_cleanup() while(0) continue
0168 #endif
0169 int OBJ_create_objects(BIO *in);
0170
0171 size_t OBJ_length(const ASN1_OBJECT *obj);
0172 const unsigned char *OBJ_get0_data(const ASN1_OBJECT *obj);
0173
0174 int OBJ_find_sigid_algs(int signid, int *pdig_nid, int *ppkey_nid);
0175 int OBJ_find_sigid_by_algs(int *psignid, int dig_nid, int pkey_nid);
0176 int OBJ_add_sigid(int signid, int dig_id, int pkey_id);
0177 void OBJ_sigid_free(void);
0178
0179 #define SN_ac_auditEntity SN_ac_auditIdentity
0180
0181 # ifdef __cplusplus
0182 }
0183 # endif
0184 #endif