| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/openssl/src/crypto/asn1/ameth_lib.c |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||||||||
| 2 | - | |||||||||||||||||||
| 3 | - | |||||||||||||||||||
| 4 | typedef int sk_cmp_fn_type(const char *const *a, const char *const *b); | - | ||||||||||||||||||
| 5 | static struct stack_st_EVP_PKEY_ASN1_METHOD *app_methods = | - | ||||||||||||||||||
| 6 | ((void *)0) | - | ||||||||||||||||||
| 7 | ; | - | ||||||||||||||||||
| 8 | - | |||||||||||||||||||
| 9 | static int ameth_cmp_BSEARCH_CMP_FN(const void *, const void *); static int ameth_cmp(const EVP_PKEY_ASN1_METHOD * const *, const EVP_PKEY_ASN1_METHOD * const *); static const EVP_PKEY_ASN1_METHOD * * OBJ_bsearch_ameth(const EVP_PKEY_ASN1_METHOD * *key, const EVP_PKEY_ASN1_METHOD * const *base, int num) | - | ||||||||||||||||||
| 10 | ; | - | ||||||||||||||||||
| 11 | - | |||||||||||||||||||
| 12 | static int ameth_cmp(const EVP_PKEY_ASN1_METHOD *const *a, | - | ||||||||||||||||||
| 13 | const EVP_PKEY_ASN1_METHOD *const *b) | - | ||||||||||||||||||
| 14 | { | - | ||||||||||||||||||
| 15 | return executed 386968 times by 1 test: ((*a)->pkey_id - (*b)->pkey_id);return ((*a)->pkey_id - (*b)->pkey_id);Executed by:
executed 386968 times by 1 test: return ((*a)->pkey_id - (*b)->pkey_id);Executed by:
| 386968 | ||||||||||||||||||
| 16 | } | - | ||||||||||||||||||
| 17 | - | |||||||||||||||||||
| 18 | static int ameth_cmp_BSEARCH_CMP_FN(const void *a_, const void *b_) { const EVP_PKEY_ASN1_METHOD * const *a = a_; const EVP_PKEY_ASN1_METHOD * const *b = b_; return executed 386968 times by 1 test: ameth_cmp(a,b);return ameth_cmp(a,b);Executed by:
executed 386968 times by 1 test: } static const EVP_PKEY_ASN1_METHOD * *OBJ_bsearch_ameth(const EVP_PKEY_ASN1_METHOD * *key, const EVP_PKEY_ASN1_METHOD * const *base, int num) { returnreturn ameth_cmp(a,b);Executed by:
executed 103133 times by 1 test: (const EVP_PKEY_ASN1_METHOD * *)OBJ_bsearch_(key, base, num, sizeof(const EVP_PKEY_ASN1_METHOD *), ameth_cmp_BSEARCH_CMP_FN);return (const EVP_PKEY_ASN1_METHOD * *)OBJ_bsearch_(key, base, num, sizeof(const EVP_PKEY_ASN1_METHOD *), ameth_cmp_BSEARCH_CMP_FN);Executed by:
executed 103133 times by 1 test: } extern void dummy_prototype(void)return (const EVP_PKEY_ASN1_METHOD * *)OBJ_bsearch_(key, base, num, sizeof(const EVP_PKEY_ASN1_METHOD *), ameth_cmp_BSEARCH_CMP_FN);Executed by:
| 103133-386968 | ||||||||||||||||||
| 19 | ; | - | ||||||||||||||||||
| 20 | - | |||||||||||||||||||
| 21 | int EVP_PKEY_asn1_get_count(void) | - | ||||||||||||||||||
| 22 | { | - | ||||||||||||||||||
| 23 | int num = (sizeof(standard_methods)/sizeof((standard_methods)[0])); | - | ||||||||||||||||||
| 24 | if (app_methods
| 0-18665 | ||||||||||||||||||
| 25 | num += sk_EVP_PKEY_ASN1_METHOD_num(app_methods); never executed: num += sk_EVP_PKEY_ASN1_METHOD_num(app_methods); | 0 | ||||||||||||||||||
| 26 | return executed 18665 times by 1 test: num;return num;Executed by:
executed 18665 times by 1 test: return num;Executed by:
| 18665 | ||||||||||||||||||
| 27 | } | - | ||||||||||||||||||
| 28 | - | |||||||||||||||||||
| 29 | const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_get0(int idx) | - | ||||||||||||||||||
| 30 | { | - | ||||||||||||||||||
| 31 | int num = (sizeof(standard_methods)/sizeof((standard_methods)[0])); | - | ||||||||||||||||||
| 32 | if (idx < 0
| 0-315201 | ||||||||||||||||||
| 33 | return never executed: return ((void *)0) ;never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
| 34 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
| 35 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
| 36 | if (idx < num
| 0-315201 | ||||||||||||||||||
| 37 | return executed 315201 times by 1 test: standard_methods[idx];return standard_methods[idx];Executed by:
executed 315201 times by 1 test: return standard_methods[idx];Executed by:
| 315201 | ||||||||||||||||||
| 38 | idx -= num; | - | ||||||||||||||||||
| 39 | return never executed: sk_EVP_PKEY_ASN1_METHOD_value(app_methods, idx);return sk_EVP_PKEY_ASN1_METHOD_value(app_methods, idx);never executed: return sk_EVP_PKEY_ASN1_METHOD_value(app_methods, idx); | 0 | ||||||||||||||||||
| 40 | } | - | ||||||||||||||||||
| 41 | - | |||||||||||||||||||
| 42 | static const EVP_PKEY_ASN1_METHOD *pkey_asn1_find(int type) | - | ||||||||||||||||||
| 43 | { | - | ||||||||||||||||||
| 44 | EVP_PKEY_ASN1_METHOD tmp; | - | ||||||||||||||||||
| 45 | const EVP_PKEY_ASN1_METHOD *t = &tmp, **ret; | - | ||||||||||||||||||
| 46 | tmp.pkey_id = type; | - | ||||||||||||||||||
| 47 | if (app_methods
| 0-103133 | ||||||||||||||||||
| 48 | int idx; | - | ||||||||||||||||||
| 49 | idx = sk_EVP_PKEY_ASN1_METHOD_find(app_methods, &tmp); | - | ||||||||||||||||||
| 50 | if (idx >= 0
| 0 | ||||||||||||||||||
| 51 | return never executed: sk_EVP_PKEY_ASN1_METHOD_value(app_methods, idx);return sk_EVP_PKEY_ASN1_METHOD_value(app_methods, idx);never executed: return sk_EVP_PKEY_ASN1_METHOD_value(app_methods, idx); | 0 | ||||||||||||||||||
| 52 | } never executed: end of block | 0 | ||||||||||||||||||
| 53 | ret = OBJ_bsearch_ameth(&t, standard_methods, (sizeof(standard_methods)/sizeof((standard_methods)[0]))); | - | ||||||||||||||||||
| 54 | if (!ret
| 0-100949 | ||||||||||||||||||
| 55 | return executed 2184 times by 1 test: return ((void *)0) ;Executed by:
executed 2184 times by 1 test: return ((void *)0) ;Executed by:
| 2184 | ||||||||||||||||||
| 56 | ((void *)0) executed 2184 times by 1 test: return ((void *)0) ;Executed by:
| 2184 | ||||||||||||||||||
| 57 | ; executed 2184 times by 1 test: return ((void *)0) ;Executed by:
| 2184 | ||||||||||||||||||
| 58 | return executed 100949 times by 1 test: *ret;return *ret;Executed by:
executed 100949 times by 1 test: return *ret;Executed by:
| 100949 | ||||||||||||||||||
| 59 | } | - | ||||||||||||||||||
| 60 | - | |||||||||||||||||||
| 61 | - | |||||||||||||||||||
| 62 | - | |||||||||||||||||||
| 63 | - | |||||||||||||||||||
| 64 | - | |||||||||||||||||||
| 65 | - | |||||||||||||||||||
| 66 | - | |||||||||||||||||||
| 67 | const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_find(ENGINE **pe, int type) | - | ||||||||||||||||||
| 68 | { | - | ||||||||||||||||||
| 69 | const EVP_PKEY_ASN1_METHOD *t; | - | ||||||||||||||||||
| 70 | - | |||||||||||||||||||
| 71 | for (;;) { | - | ||||||||||||||||||
| 72 | t = pkey_asn1_find(type); | - | ||||||||||||||||||
| 73 | if (!t
| 1817-100949 | ||||||||||||||||||
| 74 | break; executed 101316 times by 1 test: break;Executed by:
| 101316 | ||||||||||||||||||
| 75 | type = t->pkey_base_id; | - | ||||||||||||||||||
| 76 | } executed 1817 times by 1 test: end of blockExecuted by:
| 1817 | ||||||||||||||||||
| 77 | if (pe
| 1105-100211 | ||||||||||||||||||
| 78 | - | |||||||||||||||||||
| 79 | ENGINE *e; | - | ||||||||||||||||||
| 80 | - | |||||||||||||||||||
| 81 | e = ENGINE_get_pkey_asn1_meth_engine(type); | - | ||||||||||||||||||
| 82 | if (e
| 0-100211 | ||||||||||||||||||
| 83 | *pe = e; | - | ||||||||||||||||||
| 84 | return never executed: ENGINE_get_pkey_asn1_meth(e, type);return ENGINE_get_pkey_asn1_meth(e, type);never executed: return ENGINE_get_pkey_asn1_meth(e, type); | 0 | ||||||||||||||||||
| 85 | } | - | ||||||||||||||||||
| 86 | - | |||||||||||||||||||
| 87 | *pe = | - | ||||||||||||||||||
| 88 | ((void *)0) | - | ||||||||||||||||||
| 89 | ; | - | ||||||||||||||||||
| 90 | } executed 100211 times by 1 test: end of blockExecuted by:
| 100211 | ||||||||||||||||||
| 91 | return executed 101316 times by 1 test: t;return t;Executed by:
executed 101316 times by 1 test: return t;Executed by:
| 101316 | ||||||||||||||||||
| 92 | } | - | ||||||||||||||||||
| 93 | - | |||||||||||||||||||
| 94 | const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_find_str(ENGINE **pe, | - | ||||||||||||||||||
| 95 | const char *str, int len) | - | ||||||||||||||||||
| 96 | { | - | ||||||||||||||||||
| 97 | int i; | - | ||||||||||||||||||
| 98 | const EVP_PKEY_ASN1_METHOD *ameth = | - | ||||||||||||||||||
| 99 | ((void *)0) | - | ||||||||||||||||||
| 100 | ; | - | ||||||||||||||||||
| 101 | - | |||||||||||||||||||
| 102 | if (len == -1
| 8726-9918 | ||||||||||||||||||
| 103 | len = strlen(str); executed 9918 times by 1 test: len = strlen(str);Executed by:
| 9918 | ||||||||||||||||||
| 104 | if (pe
| 8848-9796 | ||||||||||||||||||
| 105 | - | |||||||||||||||||||
| 106 | ENGINE *e; | - | ||||||||||||||||||
| 107 | ameth = ENGINE_pkey_asn1_find_str(&e, str, len); | - | ||||||||||||||||||
| 108 | if (ameth
| 0-9796 | ||||||||||||||||||
| 109 | - | |||||||||||||||||||
| 110 | - | |||||||||||||||||||
| 111 | - | |||||||||||||||||||
| 112 | if (!ENGINE_init(e)
| 0 | ||||||||||||||||||
| 113 | ameth = never executed: ameth = ((void *)0) ; | 0 | ||||||||||||||||||
| 114 | ((void *)0) never executed: ameth = ((void *)0) ; | 0 | ||||||||||||||||||
| 115 | ; never executed: ameth = ((void *)0) ; | 0 | ||||||||||||||||||
| 116 | ENGINE_free(e); | - | ||||||||||||||||||
| 117 | *pe = e; | - | ||||||||||||||||||
| 118 | return never executed: ameth;return ameth;never executed: return ameth; | 0 | ||||||||||||||||||
| 119 | } | - | ||||||||||||||||||
| 120 | - | |||||||||||||||||||
| 121 | *pe = | - | ||||||||||||||||||
| 122 | ((void *)0) | - | ||||||||||||||||||
| 123 | ; | - | ||||||||||||||||||
| 124 | } executed 9796 times by 1 test: end of blockExecuted by:
| 9796 | ||||||||||||||||||
| 125 | for (i = EVP_PKEY_asn1_get_count(); i-- > 0
| 9833-315181 | ||||||||||||||||||
| 126 | ameth = EVP_PKEY_asn1_get0(i); | - | ||||||||||||||||||
| 127 | if (ameth->pkey_flags & 0x1
| 73454-241727 | ||||||||||||||||||
| 128 | continue; executed 73454 times by 1 test: continue;Executed by:
| 73454 | ||||||||||||||||||
| 129 | if ((
| 17821-223906 | ||||||||||||||||||
| 130 | && strncasecmp(ameth->pem_str, str, len) == 0
| 8811-9010 | ||||||||||||||||||
| 131 | return executed 8811 times by 1 test: ameth;return ameth;Executed by:
executed 8811 times by 1 test: return ameth;Executed by:
| 8811 | ||||||||||||||||||
| 132 | } executed 232916 times by 1 test: end of blockExecuted by:
| 232916 | ||||||||||||||||||
| 133 | return executed 9833 times by 1 test: return ((void *)0) ;Executed by:
executed 9833 times by 1 test: return ((void *)0) ;Executed by:
| 9833 | ||||||||||||||||||
| 134 | ((void *)0) executed 9833 times by 1 test: return ((void *)0) ;Executed by:
| 9833 | ||||||||||||||||||
| 135 | ; executed 9833 times by 1 test: return ((void *)0) ;Executed by:
| 9833 | ||||||||||||||||||
| 136 | } | - | ||||||||||||||||||
| 137 | - | |||||||||||||||||||
| 138 | int EVP_PKEY_asn1_add0(const EVP_PKEY_ASN1_METHOD *ameth) | - | ||||||||||||||||||
| 139 | { | - | ||||||||||||||||||
| 140 | EVP_PKEY_ASN1_METHOD tmp = { 0, }; | - | ||||||||||||||||||
| 141 | - | |||||||||||||||||||
| 142 | if (app_methods ==
| 0 | ||||||||||||||||||
| 143 | ((void *)0)
| 0 | ||||||||||||||||||
| 144 | ) { | - | ||||||||||||||||||
| 145 | app_methods = sk_EVP_PKEY_ASN1_METHOD_new(ameth_cmp); | - | ||||||||||||||||||
| 146 | if (app_methods ==
| 0 | ||||||||||||||||||
| 147 | ((void *)0)
| 0 | ||||||||||||||||||
| 148 | ) | - | ||||||||||||||||||
| 149 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||
| 150 | } never executed: end of block | 0 | ||||||||||||||||||
| 151 | - | |||||||||||||||||||
| 152 | tmp.pkey_id = ameth->pkey_id; | - | ||||||||||||||||||
| 153 | if (sk_EVP_PKEY_ASN1_METHOD_find(app_methods, &tmp) >= 0
| 0 | ||||||||||||||||||
| 154 | ERR_put_error(6,(188),(179),__FILE__,152) | - | ||||||||||||||||||
| 155 | ; | - | ||||||||||||||||||
| 156 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||
| 157 | } | - | ||||||||||||||||||
| 158 | - | |||||||||||||||||||
| 159 | if (!sk_EVP_PKEY_ASN1_METHOD_push(app_methods, ameth)
| 0 | ||||||||||||||||||
| 160 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||
| 161 | sk_EVP_PKEY_ASN1_METHOD_sort(app_methods); | - | ||||||||||||||||||
| 162 | return never executed: 1;return 1;never executed: return 1; | 0 | ||||||||||||||||||
| 163 | } | - | ||||||||||||||||||
| 164 | - | |||||||||||||||||||
| 165 | int EVP_PKEY_asn1_add_alias(int to, int from) | - | ||||||||||||||||||
| 166 | { | - | ||||||||||||||||||
| 167 | EVP_PKEY_ASN1_METHOD *ameth; | - | ||||||||||||||||||
| 168 | ameth = EVP_PKEY_asn1_new(from, 0x1, | - | ||||||||||||||||||
| 169 | ((void *)0) | - | ||||||||||||||||||
| 170 | , | - | ||||||||||||||||||
| 171 | ((void *)0) | - | ||||||||||||||||||
| 172 | ); | - | ||||||||||||||||||
| 173 | if (ameth ==
| 0 | ||||||||||||||||||
| 174 | ((void *)0)
| 0 | ||||||||||||||||||
| 175 | ) | - | ||||||||||||||||||
| 176 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||
| 177 | ameth->pkey_base_id = to; | - | ||||||||||||||||||
| 178 | if (!EVP_PKEY_asn1_add0(ameth)
| 0 | ||||||||||||||||||
| 179 | EVP_PKEY_asn1_free(ameth); | - | ||||||||||||||||||
| 180 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||
| 181 | } | - | ||||||||||||||||||
| 182 | return never executed: 1;return 1;never executed: return 1; | 0 | ||||||||||||||||||
| 183 | } | - | ||||||||||||||||||
| 184 | - | |||||||||||||||||||
| 185 | int EVP_PKEY_asn1_get0_info(int *ppkey_id, int *ppkey_base_id, | - | ||||||||||||||||||
| 186 | int *ppkey_flags, const char **pinfo, | - | ||||||||||||||||||
| 187 | const char **ppem_str, | - | ||||||||||||||||||
| 188 | const EVP_PKEY_ASN1_METHOD *ameth) | - | ||||||||||||||||||
| 189 | { | - | ||||||||||||||||||
| 190 | if (!ameth
| 0-116 | ||||||||||||||||||
| 191 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||
| 192 | if (ppkey_id
| 11-105 | ||||||||||||||||||
| 193 | * executed 105 times by 1 test: ppkey_id = ameth->pkey_id;*ppkey_id = ameth->pkey_id;Executed by:
executed 105 times by 1 test: *ppkey_id = ameth->pkey_id;Executed by:
| 105 | ||||||||||||||||||
| 194 | if (ppkey_base_id
| 1-115 | ||||||||||||||||||
| 195 | * executed 1 time by 1 test: ppkey_base_id = ameth->pkey_base_id;*ppkey_base_id = ameth->pkey_base_id;Executed by:
executed 1 time by 1 test: *ppkey_base_id = ameth->pkey_base_id;Executed by:
| 1 | ||||||||||||||||||
| 196 | if (ppkey_flags
| 0-116 | ||||||||||||||||||
| 197 | * never executed: ppkey_flags = ameth->pkey_flags;*ppkey_flags = ameth->pkey_flags;never executed: *ppkey_flags = ameth->pkey_flags; | 0 | ||||||||||||||||||
| 198 | if (pinfo
| 0-116 | ||||||||||||||||||
| 199 | * never executed: pinfo = ameth->info;*pinfo = ameth->info;never executed: *pinfo = ameth->info; | 0 | ||||||||||||||||||
| 200 | if (ppem_str
| 10-106 | ||||||||||||||||||
| 201 | * executed 10 times by 1 test: ppem_str = ameth->pem_str;*ppem_str = ameth->pem_str;Executed by:
executed 10 times by 1 test: *ppem_str = ameth->pem_str;Executed by:
| 10 | ||||||||||||||||||
| 202 | return executed 116 times by 1 test: 1;return 1;Executed by:
executed 116 times by 1 test: return 1;Executed by:
| 116 | ||||||||||||||||||
| 203 | } | - | ||||||||||||||||||
| 204 | - | |||||||||||||||||||
| 205 | const EVP_PKEY_ASN1_METHOD *EVP_PKEY_get0_asn1(const EVP_PKEY *pkey) | - | ||||||||||||||||||
| 206 | { | - | ||||||||||||||||||
| 207 | return never executed: pkey->ameth;return pkey->ameth;never executed: return pkey->ameth; | 0 | ||||||||||||||||||
| 208 | } | - | ||||||||||||||||||
| 209 | - | |||||||||||||||||||
| 210 | EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_new(int id, int flags, | - | ||||||||||||||||||
| 211 | const char *pem_str, const char *info) | - | ||||||||||||||||||
| 212 | { | - | ||||||||||||||||||
| 213 | EVP_PKEY_ASN1_METHOD *ameth = CRYPTO_zalloc(sizeof(*ameth), __FILE__, 204); | - | ||||||||||||||||||
| 214 | - | |||||||||||||||||||
| 215 | if (ameth ==
| 0 | ||||||||||||||||||
| 216 | ((void *)0)
| 0 | ||||||||||||||||||
| 217 | ) | - | ||||||||||||||||||
| 218 | return never executed: return ((void *)0) ;never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
| 219 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
| 220 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
| 221 | - | |||||||||||||||||||
| 222 | ameth->pkey_id = id; | - | ||||||||||||||||||
| 223 | ameth->pkey_base_id = id; | - | ||||||||||||||||||
| 224 | ameth->pkey_flags = flags | 0x2; | - | ||||||||||||||||||
| 225 | - | |||||||||||||||||||
| 226 | if (info
| 0 | ||||||||||||||||||
| 227 | ameth->info = CRYPTO_strdup(info, __FILE__, 214); | - | ||||||||||||||||||
| 228 | if (!ameth->info
| 0 | ||||||||||||||||||
| 229 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 230 | } never executed: end of block | 0 | ||||||||||||||||||
| 231 | if (!((pem_str ==
| 0 | ||||||||||||||||||
| 232 | ((void *)0)
| 0 | ||||||||||||||||||
| 233 | && (
| 0 | ||||||||||||||||||
| 234 | || (pem_str !=
| 0 | ||||||||||||||||||
| 235 | ((void *)0)
| 0 | ||||||||||||||||||
| 236 | && (
| 0 | ||||||||||||||||||
| 237 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 238 | - | |||||||||||||||||||
| 239 | if (pem_str
| 0 | ||||||||||||||||||
| 240 | ameth->pem_str = CRYPTO_strdup(pem_str, __FILE__, 232); | - | ||||||||||||||||||
| 241 | if (!ameth->pem_str
| 0 | ||||||||||||||||||
| 242 | goto never executed: err;goto err;never executed: goto err; | 0 | ||||||||||||||||||
| 243 | } never executed: end of block | 0 | ||||||||||||||||||
| 244 | - | |||||||||||||||||||
| 245 | return never executed: ameth;return ameth;never executed: return ameth; | 0 | ||||||||||||||||||
| 246 | - | |||||||||||||||||||
| 247 | err: | - | ||||||||||||||||||
| 248 | EVP_PKEY_asn1_free(ameth); | - | ||||||||||||||||||
| 249 | return never executed: return ((void *)0) ;never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
| 250 | ((void *)0) never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
| 251 | ; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||
| 252 | - | |||||||||||||||||||
| 253 | } | - | ||||||||||||||||||
| 254 | - | |||||||||||||||||||
| 255 | void EVP_PKEY_asn1_copy(EVP_PKEY_ASN1_METHOD *dst, | - | ||||||||||||||||||
| 256 | const EVP_PKEY_ASN1_METHOD *src) | - | ||||||||||||||||||
| 257 | { | - | ||||||||||||||||||
| 258 | - | |||||||||||||||||||
| 259 | dst->pub_decode = src->pub_decode; | - | ||||||||||||||||||
| 260 | dst->pub_encode = src->pub_encode; | - | ||||||||||||||||||
| 261 | dst->pub_cmp = src->pub_cmp; | - | ||||||||||||||||||
| 262 | dst->pub_print = src->pub_print; | - | ||||||||||||||||||
| 263 | - | |||||||||||||||||||
| 264 | dst->priv_decode = src->priv_decode; | - | ||||||||||||||||||
| 265 | dst->priv_encode = src->priv_encode; | - | ||||||||||||||||||
| 266 | dst->priv_print = src->priv_print; | - | ||||||||||||||||||
| 267 | - | |||||||||||||||||||
| 268 | dst->old_priv_encode = src->old_priv_encode; | - | ||||||||||||||||||
| 269 | dst->old_priv_decode = src->old_priv_decode; | - | ||||||||||||||||||
| 270 | - | |||||||||||||||||||
| 271 | dst->pkey_size = src->pkey_size; | - | ||||||||||||||||||
| 272 | dst->pkey_bits = src->pkey_bits; | - | ||||||||||||||||||
| 273 | - | |||||||||||||||||||
| 274 | dst->param_decode = src->param_decode; | - | ||||||||||||||||||
| 275 | dst->param_encode = src->param_encode; | - | ||||||||||||||||||
| 276 | dst->param_missing = src->param_missing; | - | ||||||||||||||||||
| 277 | dst->param_copy = src->param_copy; | - | ||||||||||||||||||
| 278 | dst->param_cmp = src->param_cmp; | - | ||||||||||||||||||
| 279 | dst->param_print = src->param_print; | - | ||||||||||||||||||
| 280 | - | |||||||||||||||||||
| 281 | dst->pkey_free = src->pkey_free; | - | ||||||||||||||||||
| 282 | dst->pkey_ctrl = src->pkey_ctrl; | - | ||||||||||||||||||
| 283 | - | |||||||||||||||||||
| 284 | dst->item_sign = src->item_sign; | - | ||||||||||||||||||
| 285 | dst->item_verify = src->item_verify; | - | ||||||||||||||||||
| 286 | - | |||||||||||||||||||
| 287 | dst->siginf_set = src->siginf_set; | - | ||||||||||||||||||
| 288 | - | |||||||||||||||||||
| 289 | dst->pkey_check = src->pkey_check; | - | ||||||||||||||||||
| 290 | - | |||||||||||||||||||
| 291 | } never executed: end of block | 0 | ||||||||||||||||||
| 292 | - | |||||||||||||||||||
| 293 | void EVP_PKEY_asn1_free(EVP_PKEY_ASN1_METHOD *ameth) | - | ||||||||||||||||||
| 294 | { | - | ||||||||||||||||||
| 295 | if (ameth
| 0 | ||||||||||||||||||
| 296 | CRYPTO_free(ameth->pem_str, __FILE__, 286); | - | ||||||||||||||||||
| 297 | CRYPTO_free(ameth->info, __FILE__, 287); | - | ||||||||||||||||||
| 298 | CRYPTO_free(ameth, __FILE__, 288); | - | ||||||||||||||||||
| 299 | } never executed: end of block | 0 | ||||||||||||||||||
| 300 | } never executed: end of block | 0 | ||||||||||||||||||
| 301 | - | |||||||||||||||||||
| 302 | void EVP_PKEY_asn1_set_public(EVP_PKEY_ASN1_METHOD *ameth, | - | ||||||||||||||||||
| 303 | int (*pub_decode) (EVP_PKEY *pk, | - | ||||||||||||||||||
| 304 | X509_PUBKEY *pub), | - | ||||||||||||||||||
| 305 | int (*pub_encode) (X509_PUBKEY *pub, | - | ||||||||||||||||||
| 306 | const EVP_PKEY *pk), | - | ||||||||||||||||||
| 307 | int (*pub_cmp) (const EVP_PKEY *a, | - | ||||||||||||||||||
| 308 | const EVP_PKEY *b), | - | ||||||||||||||||||
| 309 | int (*pub_print) (BIO *out, | - | ||||||||||||||||||
| 310 | const EVP_PKEY *pkey, | - | ||||||||||||||||||
| 311 | int indent, ASN1_PCTX *pctx), | - | ||||||||||||||||||
| 312 | int (*pkey_size) (const EVP_PKEY *pk), | - | ||||||||||||||||||
| 313 | int (*pkey_bits) (const EVP_PKEY *pk)) | - | ||||||||||||||||||
| 314 | { | - | ||||||||||||||||||
| 315 | ameth->pub_decode = pub_decode; | - | ||||||||||||||||||
| 316 | ameth->pub_encode = pub_encode; | - | ||||||||||||||||||
| 317 | ameth->pub_cmp = pub_cmp; | - | ||||||||||||||||||
| 318 | ameth->pub_print = pub_print; | - | ||||||||||||||||||
| 319 | ameth->pkey_size = pkey_size; | - | ||||||||||||||||||
| 320 | ameth->pkey_bits = pkey_bits; | - | ||||||||||||||||||
| 321 | } never executed: end of block | 0 | ||||||||||||||||||
| 322 | - | |||||||||||||||||||
| 323 | void EVP_PKEY_asn1_set_private(EVP_PKEY_ASN1_METHOD *ameth, | - | ||||||||||||||||||
| 324 | int (*priv_decode) (EVP_PKEY *pk, | - | ||||||||||||||||||
| 325 | const PKCS8_PRIV_KEY_INFO | - | ||||||||||||||||||
| 326 | *p8inf), | - | ||||||||||||||||||
| 327 | int (*priv_encode) (PKCS8_PRIV_KEY_INFO *p8, | - | ||||||||||||||||||
| 328 | const EVP_PKEY *pk), | - | ||||||||||||||||||
| 329 | int (*priv_print) (BIO *out, | - | ||||||||||||||||||
| 330 | const EVP_PKEY *pkey, | - | ||||||||||||||||||
| 331 | int indent, | - | ||||||||||||||||||
| 332 | ASN1_PCTX *pctx)) | - | ||||||||||||||||||
| 333 | { | - | ||||||||||||||||||
| 334 | ameth->priv_decode = priv_decode; | - | ||||||||||||||||||
| 335 | ameth->priv_encode = priv_encode; | - | ||||||||||||||||||
| 336 | ameth->priv_print = priv_print; | - | ||||||||||||||||||
| 337 | } never executed: end of block | 0 | ||||||||||||||||||
| 338 | - | |||||||||||||||||||
| 339 | void EVP_PKEY_asn1_set_param(EVP_PKEY_ASN1_METHOD *ameth, | - | ||||||||||||||||||
| 340 | int (*param_decode) (EVP_PKEY *pkey, | - | ||||||||||||||||||
| 341 | const unsigned char **pder, | - | ||||||||||||||||||
| 342 | int derlen), | - | ||||||||||||||||||
| 343 | int (*param_encode) (const EVP_PKEY *pkey, | - | ||||||||||||||||||
| 344 | unsigned char **pder), | - | ||||||||||||||||||
| 345 | int (*param_missing) (const EVP_PKEY *pk), | - | ||||||||||||||||||
| 346 | int (*param_copy) (EVP_PKEY *to, | - | ||||||||||||||||||
| 347 | const EVP_PKEY *from), | - | ||||||||||||||||||
| 348 | int (*param_cmp) (const EVP_PKEY *a, | - | ||||||||||||||||||
| 349 | const EVP_PKEY *b), | - | ||||||||||||||||||
| 350 | int (*param_print) (BIO *out, | - | ||||||||||||||||||
| 351 | const EVP_PKEY *pkey, | - | ||||||||||||||||||
| 352 | int indent, ASN1_PCTX *pctx)) | - | ||||||||||||||||||
| 353 | { | - | ||||||||||||||||||
| 354 | ameth->param_decode = param_decode; | - | ||||||||||||||||||
| 355 | ameth->param_encode = param_encode; | - | ||||||||||||||||||
| 356 | ameth->param_missing = param_missing; | - | ||||||||||||||||||
| 357 | ameth->param_copy = param_copy; | - | ||||||||||||||||||
| 358 | ameth->param_cmp = param_cmp; | - | ||||||||||||||||||
| 359 | ameth->param_print = param_print; | - | ||||||||||||||||||
| 360 | } never executed: end of block | 0 | ||||||||||||||||||
| 361 | - | |||||||||||||||||||
| 362 | void EVP_PKEY_asn1_set_free(EVP_PKEY_ASN1_METHOD *ameth, | - | ||||||||||||||||||
| 363 | void (*pkey_free) (EVP_PKEY *pkey)) | - | ||||||||||||||||||
| 364 | { | - | ||||||||||||||||||
| 365 | ameth->pkey_free = pkey_free; | - | ||||||||||||||||||
| 366 | } never executed: end of block | 0 | ||||||||||||||||||
| 367 | - | |||||||||||||||||||
| 368 | void EVP_PKEY_asn1_set_ctrl(EVP_PKEY_ASN1_METHOD *ameth, | - | ||||||||||||||||||
| 369 | int (*pkey_ctrl) (EVP_PKEY *pkey, int op, | - | ||||||||||||||||||
| 370 | long arg1, void *arg2)) | - | ||||||||||||||||||
| 371 | { | - | ||||||||||||||||||
| 372 | ameth->pkey_ctrl = pkey_ctrl; | - | ||||||||||||||||||
| 373 | } never executed: end of block | 0 | ||||||||||||||||||
| 374 | - | |||||||||||||||||||
| 375 | void EVP_PKEY_asn1_set_security_bits(EVP_PKEY_ASN1_METHOD *ameth, | - | ||||||||||||||||||
| 376 | int (*pkey_security_bits) (const EVP_PKEY | - | ||||||||||||||||||
| 377 | *pk)) | - | ||||||||||||||||||
| 378 | { | - | ||||||||||||||||||
| 379 | ameth->pkey_security_bits = pkey_security_bits; | - | ||||||||||||||||||
| 380 | } never executed: end of block | 0 | ||||||||||||||||||
| 381 | - | |||||||||||||||||||
| 382 | void EVP_PKEY_asn1_set_item(EVP_PKEY_ASN1_METHOD *ameth, | - | ||||||||||||||||||
| 383 | int (*item_verify) (EVP_MD_CTX *ctx, | - | ||||||||||||||||||
| 384 | const ASN1_ITEM *it, | - | ||||||||||||||||||
| 385 | void *asn, | - | ||||||||||||||||||
| 386 | X509_ALGOR *a, | - | ||||||||||||||||||
| 387 | ASN1_BIT_STRING *sig, | - | ||||||||||||||||||
| 388 | EVP_PKEY *pkey), | - | ||||||||||||||||||
| 389 | int (*item_sign) (EVP_MD_CTX *ctx, | - | ||||||||||||||||||
| 390 | const ASN1_ITEM *it, | - | ||||||||||||||||||
| 391 | void *asn, | - | ||||||||||||||||||
| 392 | X509_ALGOR *alg1, | - | ||||||||||||||||||
| 393 | X509_ALGOR *alg2, | - | ||||||||||||||||||
| 394 | ASN1_BIT_STRING *sig)) | - | ||||||||||||||||||
| 395 | { | - | ||||||||||||||||||
| 396 | ameth->item_sign = item_sign; | - | ||||||||||||||||||
| 397 | ameth->item_verify = item_verify; | - | ||||||||||||||||||
| 398 | } never executed: end of block | 0 | ||||||||||||||||||
| 399 | - | |||||||||||||||||||
| 400 | void EVP_PKEY_asn1_set_siginf(EVP_PKEY_ASN1_METHOD *ameth, | - | ||||||||||||||||||
| 401 | int (*siginf_set) (X509_SIG_INFO *siginf, | - | ||||||||||||||||||
| 402 | const X509_ALGOR *alg, | - | ||||||||||||||||||
| 403 | const ASN1_STRING *sig)) | - | ||||||||||||||||||
| 404 | { | - | ||||||||||||||||||
| 405 | ameth->siginf_set = siginf_set; | - | ||||||||||||||||||
| 406 | } never executed: end of block | 0 | ||||||||||||||||||
| 407 | - | |||||||||||||||||||
| 408 | void EVP_PKEY_asn1_set_check(EVP_PKEY_ASN1_METHOD *ameth, | - | ||||||||||||||||||
| 409 | int (*pkey_check) (const EVP_PKEY *pk)) | - | ||||||||||||||||||
| 410 | { | - | ||||||||||||||||||
| 411 | ameth->pkey_check = pkey_check; | - | ||||||||||||||||||
| 412 | } never executed: end of block | 0 | ||||||||||||||||||
| 413 | - | |||||||||||||||||||
| 414 | void EVP_PKEY_asn1_set_public_check(EVP_PKEY_ASN1_METHOD *ameth, | - | ||||||||||||||||||
| 415 | int (*pkey_pub_check) (const EVP_PKEY *pk)) | - | ||||||||||||||||||
| 416 | { | - | ||||||||||||||||||
| 417 | ameth->pkey_public_check = pkey_pub_check; | - | ||||||||||||||||||
| 418 | } never executed: end of block | 0 | ||||||||||||||||||
| 419 | - | |||||||||||||||||||
| 420 | void EVP_PKEY_asn1_set_param_check(EVP_PKEY_ASN1_METHOD *ameth, | - | ||||||||||||||||||
| 421 | int (*pkey_param_check) (const EVP_PKEY *pk)) | - | ||||||||||||||||||
| 422 | { | - | ||||||||||||||||||
| 423 | ameth->pkey_param_check = pkey_param_check; | - | ||||||||||||||||||
| 424 | } never executed: end of block | 0 | ||||||||||||||||||
| 425 | - | |||||||||||||||||||
| 426 | void EVP_PKEY_asn1_set_set_priv_key(EVP_PKEY_ASN1_METHOD *ameth, | - | ||||||||||||||||||
| 427 | int (*set_priv_key) (EVP_PKEY *pk, | - | ||||||||||||||||||
| 428 | const unsigned char | - | ||||||||||||||||||
| 429 | *priv, | - | ||||||||||||||||||
| 430 | size_t len)) | - | ||||||||||||||||||
| 431 | { | - | ||||||||||||||||||
| 432 | ameth->set_priv_key = set_priv_key; | - | ||||||||||||||||||
| 433 | } never executed: end of block | 0 | ||||||||||||||||||
| 434 | - | |||||||||||||||||||
| 435 | void EVP_PKEY_asn1_set_set_pub_key(EVP_PKEY_ASN1_METHOD *ameth, | - | ||||||||||||||||||
| 436 | int (*set_pub_key) (EVP_PKEY *pk, | - | ||||||||||||||||||
| 437 | const unsigned char *pub, | - | ||||||||||||||||||
| 438 | size_t len)) | - | ||||||||||||||||||
| 439 | { | - | ||||||||||||||||||
| 440 | ameth->set_pub_key = set_pub_key; | - | ||||||||||||||||||
| 441 | } never executed: end of block | 0 | ||||||||||||||||||
| 442 | - | |||||||||||||||||||
| 443 | void EVP_PKEY_asn1_set_get_priv_key(EVP_PKEY_ASN1_METHOD *ameth, | - | ||||||||||||||||||
| 444 | int (*get_priv_key) (const EVP_PKEY *pk, | - | ||||||||||||||||||
| 445 | unsigned char *priv, | - | ||||||||||||||||||
| 446 | size_t *len)) | - | ||||||||||||||||||
| 447 | { | - | ||||||||||||||||||
| 448 | ameth->get_priv_key = get_priv_key; | - | ||||||||||||||||||
| 449 | } never executed: end of block | 0 | ||||||||||||||||||
| 450 | - | |||||||||||||||||||
| 451 | void EVP_PKEY_asn1_set_get_pub_key(EVP_PKEY_ASN1_METHOD *ameth, | - | ||||||||||||||||||
| 452 | int (*get_pub_key) (const EVP_PKEY *pk, | - | ||||||||||||||||||
| 453 | unsigned char *pub, | - | ||||||||||||||||||
| 454 | size_t *len)) | - | ||||||||||||||||||
| 455 | { | - | ||||||||||||||||||
| 456 | ameth->get_pub_key = get_pub_key; | - | ||||||||||||||||||
| 457 | } never executed: end of block | 0 | ||||||||||||||||||
| Switch to Source code | Preprocessed file |