File indexing completed on 2026-09-12 09:19:29
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 #ifdef __cplusplus
0039 extern "C" {
0040 #endif
0041
0042 typedef struct obj_name_st {
0043 int type;
0044 int alias;
0045 const char *name;
0046 const char *data;
0047 } OBJ_NAME;
0048
0049 #define OBJ_create_and_add_object(a, b, c) OBJ_create(a, b, c)
0050
0051 int OBJ_NAME_init(void);
0052 int OBJ_NAME_new_index(unsigned long (*hash_func)(const char *),
0053 int (*cmp_func)(const char *, const char *),
0054 void (*free_func)(const char *, int, const char *));
0055 const char *OBJ_NAME_get(const char *name, int type);
0056 int OBJ_NAME_add(const char *name, int type, const char *data);
0057 int OBJ_NAME_remove(const char *name, int type);
0058 void OBJ_NAME_cleanup(int type);
0059 void OBJ_NAME_do_all(int type, void (*fn)(const OBJ_NAME *, void *arg),
0060 void *arg);
0061 void OBJ_NAME_do_all_sorted(int type,
0062 void (*fn)(const OBJ_NAME *, void *arg),
0063 void *arg);
0064
0065 DECLARE_ASN1_DUP_FUNCTION_name(ASN1_OBJECT, OBJ)
0066 ASN1_OBJECT *OBJ_nid2obj(int n);
0067 const char *OBJ_nid2ln(int n);
0068 const char *OBJ_nid2sn(int n);
0069 int OBJ_obj2nid(const ASN1_OBJECT *o);
0070 ASN1_OBJECT *OBJ_txt2obj(const char *s, int no_name);
0071 int OBJ_obj2txt(char *buf, int buf_len, const ASN1_OBJECT *a, int no_name);
0072 int OBJ_txt2nid(const char *s);
0073 int OBJ_ln2nid(const char *s);
0074 int OBJ_sn2nid(const char *s);
0075 int OBJ_cmp(const ASN1_OBJECT *a, const ASN1_OBJECT *b);
0076 const void *OBJ_bsearch_(const void *key, const void *base, int num, int size,
0077 int (*cmp)(const void *, const void *));
0078 const void *OBJ_bsearch_ex_(const void *key, const void *base, int num,
0079 int size,
0080 int (*cmp)(const void *, const void *),
0081 int flags);
0082
0083 #define _DECLARE_OBJ_BSEARCH_CMP_FN(scope, type1, type2, nm) \
0084 static int nm##_cmp_BSEARCH_CMP_FN(const void *, const void *); \
0085 static int nm##_cmp(type1 const *, type2 const *); \
0086 scope type2 *OBJ_bsearch_##nm(type1 *key, type2 const *base, int num)
0087
0088 #define DECLARE_OBJ_BSEARCH_CMP_FN(type1, type2, cmp) \
0089 _DECLARE_OBJ_BSEARCH_CMP_FN(static, type1, type2, cmp)
0090 #define DECLARE_OBJ_BSEARCH_GLOBAL_CMP_FN(type1, type2, nm) \
0091 type2 *OBJ_bsearch_##nm(type1 *key, type2 const *base, int num)
0092
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 #define IMPLEMENT_OBJ_BSEARCH_CMP_FN(type1, type2, nm) \
0121 static int nm##_cmp_BSEARCH_CMP_FN(const void *a_, const void *b_) \
0122 { \
0123 type1 const *a = a_; \
0124 type2 const *b = b_; \
0125 return nm##_cmp(a, b); \
0126 } \
0127 static type2 *OBJ_bsearch_##nm(type1 *key, type2 const *base, int num) \
0128 { \
0129 return (type2 *)OBJ_bsearch_(key, base, num, sizeof(type2), \
0130 nm##_cmp_BSEARCH_CMP_FN); \
0131 } \
0132 extern void dummy_prototype(void)
0133
0134 #define IMPLEMENT_OBJ_BSEARCH_GLOBAL_CMP_FN(type1, type2, nm) \
0135 static int nm##_cmp_BSEARCH_CMP_FN(const void *a_, const void *b_) \
0136 { \
0137 type1 const *a = a_; \
0138 type2 const *b = b_; \
0139 return nm##_cmp(a, b); \
0140 } \
0141 type2 *OBJ_bsearch_##nm(type1 *key, type2 const *base, int num) \
0142 { \
0143 return (type2 *)OBJ_bsearch_(key, base, num, sizeof(type2), \
0144 nm##_cmp_BSEARCH_CMP_FN); \
0145 } \
0146 extern void dummy_prototype(void)
0147
0148 #define OBJ_bsearch(type1, key, type2, base, num, cmp) \
0149 ((type2 *)OBJ_bsearch_(CHECKED_PTR_OF(type1, key), CHECKED_PTR_OF(type2, base), \
0150 num, sizeof(type2), \
0151 ((void)CHECKED_PTR_OF(type1, cmp##_type_1), \
0152 (void)CHECKED_PTR_OF(type2, cmp##_type_2), \
0153 cmp##_BSEARCH_CMP_FN)))
0154
0155 #define OBJ_bsearch_ex(type1, key, type2, base, num, cmp, flags) \
0156 ((type2 *)OBJ_bsearch_ex_(CHECKED_PTR_OF(type1, key), CHECKED_PTR_OF(type2, base), \
0157 num, sizeof(type2), \
0158 ((void)CHECKED_PTR_OF(type1, cmp##_type_1), \
0159 (void)type_2 = CHECKED_PTR_OF(type2, cmp##_type_2), \
0160 cmp##_BSEARCH_CMP_FN)), \
0161 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() \
0168 while (0) \
0169 continue
0170 #endif
0171 int OBJ_create_objects(BIO *in);
0172
0173 size_t OBJ_length(const ASN1_OBJECT *obj);
0174 const unsigned char *OBJ_get0_data(const ASN1_OBJECT *obj);
0175
0176 int OBJ_find_sigid_algs(int signid, int *pdig_nid, int *ppkey_nid);
0177 int OBJ_find_sigid_by_algs(int *psignid, int dig_nid, int pkey_nid);
0178 int OBJ_add_sigid(int signid, int dig_id, int pkey_id);
0179 void OBJ_sigid_free(void);
0180
0181 #define SN_ac_auditEntity SN_ac_auditIdentity
0182
0183 #ifdef __cplusplus
0184 }
0185 #endif
0186 #endif