File indexing completed on 2025-01-18 10:05:47
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011 #ifndef OPENSSL_PARAMS_H
0012 # define OPENSSL_PARAMS_H
0013 # pragma once
0014
0015 # include <openssl/core.h>
0016 # include <openssl/bn.h>
0017
0018 # ifdef __cplusplus
0019 extern "C" {
0020 # endif
0021
0022 # define OSSL_PARAM_UNMODIFIED ((size_t)-1)
0023
0024 # define OSSL_PARAM_END \
0025 { NULL, 0, NULL, 0, 0 }
0026
0027 # define OSSL_PARAM_DEFN(key, type, addr, sz) \
0028 { (key), (type), (addr), (sz), OSSL_PARAM_UNMODIFIED }
0029
0030
0031 # define OSSL_PARAM_int(key, addr) \
0032 OSSL_PARAM_DEFN((key), OSSL_PARAM_INTEGER, (addr), sizeof(int))
0033 # define OSSL_PARAM_uint(key, addr) \
0034 OSSL_PARAM_DEFN((key), OSSL_PARAM_UNSIGNED_INTEGER, (addr), \
0035 sizeof(unsigned int))
0036 # define OSSL_PARAM_long(key, addr) \
0037 OSSL_PARAM_DEFN((key), OSSL_PARAM_INTEGER, (addr), sizeof(long int))
0038 # define OSSL_PARAM_ulong(key, addr) \
0039 OSSL_PARAM_DEFN((key), OSSL_PARAM_UNSIGNED_INTEGER, (addr), \
0040 sizeof(unsigned long int))
0041 # define OSSL_PARAM_int32(key, addr) \
0042 OSSL_PARAM_DEFN((key), OSSL_PARAM_INTEGER, (addr), sizeof(int32_t))
0043 # define OSSL_PARAM_uint32(key, addr) \
0044 OSSL_PARAM_DEFN((key), OSSL_PARAM_UNSIGNED_INTEGER, (addr), \
0045 sizeof(uint32_t))
0046 # define OSSL_PARAM_int64(key, addr) \
0047 OSSL_PARAM_DEFN((key), OSSL_PARAM_INTEGER, (addr), sizeof(int64_t))
0048 # define OSSL_PARAM_uint64(key, addr) \
0049 OSSL_PARAM_DEFN((key), OSSL_PARAM_UNSIGNED_INTEGER, (addr), \
0050 sizeof(uint64_t))
0051 # define OSSL_PARAM_size_t(key, addr) \
0052 OSSL_PARAM_DEFN((key), OSSL_PARAM_UNSIGNED_INTEGER, (addr), sizeof(size_t))
0053 # define OSSL_PARAM_time_t(key, addr) \
0054 OSSL_PARAM_DEFN((key), OSSL_PARAM_INTEGER, (addr), sizeof(time_t))
0055 # define OSSL_PARAM_double(key, addr) \
0056 OSSL_PARAM_DEFN((key), OSSL_PARAM_REAL, (addr), sizeof(double))
0057
0058 # define OSSL_PARAM_BN(key, bn, sz) \
0059 OSSL_PARAM_DEFN((key), OSSL_PARAM_UNSIGNED_INTEGER, (bn), (sz))
0060 # define OSSL_PARAM_utf8_string(key, addr, sz) \
0061 OSSL_PARAM_DEFN((key), OSSL_PARAM_UTF8_STRING, (addr), sz)
0062 # define OSSL_PARAM_octet_string(key, addr, sz) \
0063 OSSL_PARAM_DEFN((key), OSSL_PARAM_OCTET_STRING, (addr), sz)
0064
0065 # define OSSL_PARAM_utf8_ptr(key, addr, sz) \
0066 OSSL_PARAM_DEFN((key), OSSL_PARAM_UTF8_PTR, (addr), sz)
0067 # define OSSL_PARAM_octet_ptr(key, addr, sz) \
0068 OSSL_PARAM_DEFN((key), OSSL_PARAM_OCTET_PTR, (addr), sz)
0069
0070
0071 OSSL_PARAM *OSSL_PARAM_locate(OSSL_PARAM *p, const char *key);
0072 const OSSL_PARAM *OSSL_PARAM_locate_const(const OSSL_PARAM *p, const char *key);
0073
0074
0075 OSSL_PARAM OSSL_PARAM_construct_int(const char *key, int *buf);
0076 OSSL_PARAM OSSL_PARAM_construct_uint(const char *key, unsigned int *buf);
0077 OSSL_PARAM OSSL_PARAM_construct_long(const char *key, long int *buf);
0078 OSSL_PARAM OSSL_PARAM_construct_ulong(const char *key, unsigned long int *buf);
0079 OSSL_PARAM OSSL_PARAM_construct_int32(const char *key, int32_t *buf);
0080 OSSL_PARAM OSSL_PARAM_construct_uint32(const char *key, uint32_t *buf);
0081 OSSL_PARAM OSSL_PARAM_construct_int64(const char *key, int64_t *buf);
0082 OSSL_PARAM OSSL_PARAM_construct_uint64(const char *key, uint64_t *buf);
0083 OSSL_PARAM OSSL_PARAM_construct_size_t(const char *key, size_t *buf);
0084 OSSL_PARAM OSSL_PARAM_construct_time_t(const char *key, time_t *buf);
0085 OSSL_PARAM OSSL_PARAM_construct_BN(const char *key, unsigned char *buf,
0086 size_t bsize);
0087 OSSL_PARAM OSSL_PARAM_construct_double(const char *key, double *buf);
0088 OSSL_PARAM OSSL_PARAM_construct_utf8_string(const char *key, char *buf,
0089 size_t bsize);
0090 OSSL_PARAM OSSL_PARAM_construct_utf8_ptr(const char *key, char **buf,
0091 size_t bsize);
0092 OSSL_PARAM OSSL_PARAM_construct_octet_string(const char *key, void *buf,
0093 size_t bsize);
0094 OSSL_PARAM OSSL_PARAM_construct_octet_ptr(const char *key, void **buf,
0095 size_t bsize);
0096 OSSL_PARAM OSSL_PARAM_construct_end(void);
0097
0098 int OSSL_PARAM_allocate_from_text(OSSL_PARAM *to,
0099 const OSSL_PARAM *paramdefs,
0100 const char *key, const char *value,
0101 size_t value_n, int *found);
0102
0103 int OSSL_PARAM_get_int(const OSSL_PARAM *p, int *val);
0104 int OSSL_PARAM_get_uint(const OSSL_PARAM *p, unsigned int *val);
0105 int OSSL_PARAM_get_long(const OSSL_PARAM *p, long int *val);
0106 int OSSL_PARAM_get_ulong(const OSSL_PARAM *p, unsigned long int *val);
0107 int OSSL_PARAM_get_int32(const OSSL_PARAM *p, int32_t *val);
0108 int OSSL_PARAM_get_uint32(const OSSL_PARAM *p, uint32_t *val);
0109 int OSSL_PARAM_get_int64(const OSSL_PARAM *p, int64_t *val);
0110 int OSSL_PARAM_get_uint64(const OSSL_PARAM *p, uint64_t *val);
0111 int OSSL_PARAM_get_size_t(const OSSL_PARAM *p, size_t *val);
0112 int OSSL_PARAM_get_time_t(const OSSL_PARAM *p, time_t *val);
0113
0114 int OSSL_PARAM_set_int(OSSL_PARAM *p, int val);
0115 int OSSL_PARAM_set_uint(OSSL_PARAM *p, unsigned int val);
0116 int OSSL_PARAM_set_long(OSSL_PARAM *p, long int val);
0117 int OSSL_PARAM_set_ulong(OSSL_PARAM *p, unsigned long int val);
0118 int OSSL_PARAM_set_int32(OSSL_PARAM *p, int32_t val);
0119 int OSSL_PARAM_set_uint32(OSSL_PARAM *p, uint32_t val);
0120 int OSSL_PARAM_set_int64(OSSL_PARAM *p, int64_t val);
0121 int OSSL_PARAM_set_uint64(OSSL_PARAM *p, uint64_t val);
0122 int OSSL_PARAM_set_size_t(OSSL_PARAM *p, size_t val);
0123 int OSSL_PARAM_set_time_t(OSSL_PARAM *p, time_t val);
0124
0125 int OSSL_PARAM_get_double(const OSSL_PARAM *p, double *val);
0126 int OSSL_PARAM_set_double(OSSL_PARAM *p, double val);
0127
0128 int OSSL_PARAM_get_BN(const OSSL_PARAM *p, BIGNUM **val);
0129 int OSSL_PARAM_set_BN(OSSL_PARAM *p, const BIGNUM *val);
0130
0131 int OSSL_PARAM_get_utf8_string(const OSSL_PARAM *p, char **val, size_t max_len);
0132 int OSSL_PARAM_set_utf8_string(OSSL_PARAM *p, const char *val);
0133
0134 int OSSL_PARAM_get_octet_string(const OSSL_PARAM *p, void **val, size_t max_len,
0135 size_t *used_len);
0136 int OSSL_PARAM_set_octet_string(OSSL_PARAM *p, const void *val, size_t len);
0137
0138 int OSSL_PARAM_get_utf8_ptr(const OSSL_PARAM *p, const char **val);
0139 int OSSL_PARAM_set_utf8_ptr(OSSL_PARAM *p, const char *val);
0140
0141 int OSSL_PARAM_get_octet_ptr(const OSSL_PARAM *p, const void **val,
0142 size_t *used_len);
0143 int OSSL_PARAM_set_octet_ptr(OSSL_PARAM *p, const void *val,
0144 size_t used_len);
0145
0146 int OSSL_PARAM_get_utf8_string_ptr(const OSSL_PARAM *p, const char **val);
0147 int OSSL_PARAM_get_octet_string_ptr(const OSSL_PARAM *p, const void **val,
0148 size_t *used_len);
0149
0150 int OSSL_PARAM_modified(const OSSL_PARAM *p);
0151 void OSSL_PARAM_set_all_unmodified(OSSL_PARAM *p);
0152
0153 OSSL_PARAM *OSSL_PARAM_dup(const OSSL_PARAM *p);
0154 OSSL_PARAM *OSSL_PARAM_merge(const OSSL_PARAM *p1, const OSSL_PARAM *p2);
0155 void OSSL_PARAM_free(OSSL_PARAM *p);
0156
0157 # ifdef __cplusplus
0158 }
0159 # endif
0160 #endif