| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/openssh/src/openbsd-compat/libressl-api-compat.c |
| Source code | Switch to Preprocessed file |
| Line | Source | Count | ||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | /* $OpenBSD: dsa_lib.c,v 1.29 2018/04/14 07:09:21 tb Exp $ */ | - | ||||||||||||||||||||||||||||||
| 2 | /* $OpenBSD: rsa_lib.c,v 1.37 2018/04/14 07:09:21 tb Exp $ */ | - | ||||||||||||||||||||||||||||||
| 3 | /* $OpenBSD: evp_lib.c,v 1.17 2018/09/12 06:35:38 djm Exp $ */ | - | ||||||||||||||||||||||||||||||
| 4 | /* $OpenBSD: dh_lib.c,v 1.32 2018/05/02 15:48:38 tb Exp $ */ | - | ||||||||||||||||||||||||||||||
| 5 | /* $OpenBSD: p_lib.c,v 1.24 2018/05/30 15:40:50 tb Exp $ */ | - | ||||||||||||||||||||||||||||||
| 6 | /* $OpenBSD: digest.c,v 1.30 2018/04/14 07:09:21 tb Exp $ */ | - | ||||||||||||||||||||||||||||||
| 7 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | - | ||||||||||||||||||||||||||||||
| 8 | * All rights reserved. | - | ||||||||||||||||||||||||||||||
| 9 | * | - | ||||||||||||||||||||||||||||||
| 10 | * This package is an SSL implementation written | - | ||||||||||||||||||||||||||||||
| 11 | * by Eric Young (eay@cryptsoft.com). | - | ||||||||||||||||||||||||||||||
| 12 | * The implementation was written so as to conform with Netscapes SSL. | - | ||||||||||||||||||||||||||||||
| 13 | * | - | ||||||||||||||||||||||||||||||
| 14 | * This library is free for commercial and non-commercial use as long as | - | ||||||||||||||||||||||||||||||
| 15 | * the following conditions are aheared to. The following conditions | - | ||||||||||||||||||||||||||||||
| 16 | * apply to all code found in this distribution, be it the RC4, RSA, | - | ||||||||||||||||||||||||||||||
| 17 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | - | ||||||||||||||||||||||||||||||
| 18 | * included with this distribution is covered by the same copyright terms | - | ||||||||||||||||||||||||||||||
| 19 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | - | ||||||||||||||||||||||||||||||
| 20 | * | - | ||||||||||||||||||||||||||||||
| 21 | * Copyright remains Eric Young's, and as such any Copyright notices in | - | ||||||||||||||||||||||||||||||
| 22 | * the code are not to be removed. | - | ||||||||||||||||||||||||||||||
| 23 | * If this package is used in a product, Eric Young should be given attribution | - | ||||||||||||||||||||||||||||||
| 24 | * as the author of the parts of the library used. | - | ||||||||||||||||||||||||||||||
| 25 | * This can be in the form of a textual message at program startup or | - | ||||||||||||||||||||||||||||||
| 26 | * in documentation (online or textual) provided with the package. | - | ||||||||||||||||||||||||||||||
| 27 | * | - | ||||||||||||||||||||||||||||||
| 28 | * Redistribution and use in source and binary forms, with or without | - | ||||||||||||||||||||||||||||||
| 29 | * modification, are permitted provided that the following conditions | - | ||||||||||||||||||||||||||||||
| 30 | * are met: | - | ||||||||||||||||||||||||||||||
| 31 | * 1. Redistributions of source code must retain the copyright | - | ||||||||||||||||||||||||||||||
| 32 | * notice, this list of conditions and the following disclaimer. | - | ||||||||||||||||||||||||||||||
| 33 | * 2. Redistributions in binary form must reproduce the above copyright | - | ||||||||||||||||||||||||||||||
| 34 | * notice, this list of conditions and the following disclaimer in the | - | ||||||||||||||||||||||||||||||
| 35 | * documentation and/or other materials provided with the distribution. | - | ||||||||||||||||||||||||||||||
| 36 | * 3. All advertising materials mentioning features or use of this software | - | ||||||||||||||||||||||||||||||
| 37 | * must display the following acknowledgement: | - | ||||||||||||||||||||||||||||||
| 38 | * "This product includes cryptographic software written by | - | ||||||||||||||||||||||||||||||
| 39 | * Eric Young (eay@cryptsoft.com)" | - | ||||||||||||||||||||||||||||||
| 40 | * The word 'cryptographic' can be left out if the rouines from the library | - | ||||||||||||||||||||||||||||||
| 41 | * being used are not cryptographic related :-). | - | ||||||||||||||||||||||||||||||
| 42 | * 4. If you include any Windows specific code (or a derivative thereof) from | - | ||||||||||||||||||||||||||||||
| 43 | * the apps directory (application code) you must include an acknowledgement: | - | ||||||||||||||||||||||||||||||
| 44 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | - | ||||||||||||||||||||||||||||||
| 45 | * | - | ||||||||||||||||||||||||||||||
| 46 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | - | ||||||||||||||||||||||||||||||
| 47 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | - | ||||||||||||||||||||||||||||||
| 48 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | - | ||||||||||||||||||||||||||||||
| 49 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | - | ||||||||||||||||||||||||||||||
| 50 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | - | ||||||||||||||||||||||||||||||
| 51 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | - | ||||||||||||||||||||||||||||||
| 52 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | - | ||||||||||||||||||||||||||||||
| 53 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | - | ||||||||||||||||||||||||||||||
| 54 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | - | ||||||||||||||||||||||||||||||
| 55 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | - | ||||||||||||||||||||||||||||||
| 56 | * SUCH DAMAGE. | - | ||||||||||||||||||||||||||||||
| 57 | * | - | ||||||||||||||||||||||||||||||
| 58 | * The licence and distribution terms for any publically available version or | - | ||||||||||||||||||||||||||||||
| 59 | * derivative of this code cannot be changed. i.e. this code cannot simply be | - | ||||||||||||||||||||||||||||||
| 60 | * copied and put under another distribution licence | - | ||||||||||||||||||||||||||||||
| 61 | * [including the GNU Public Licence.] | - | ||||||||||||||||||||||||||||||
| 62 | */ | - | ||||||||||||||||||||||||||||||
| 63 | - | |||||||||||||||||||||||||||||||
| 64 | /* $OpenBSD: dsa_asn1.c,v 1.22 2018/06/14 17:03:19 jsing Exp $ */ | - | ||||||||||||||||||||||||||||||
| 65 | /* $OpenBSD: ecs_asn1.c,v 1.9 2018/03/17 15:24:44 tb Exp $ */ | - | ||||||||||||||||||||||||||||||
| 66 | /* $OpenBSD: digest.c,v 1.30 2018/04/14 07:09:21 tb Exp $ */ | - | ||||||||||||||||||||||||||||||
| 67 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | - | ||||||||||||||||||||||||||||||
| 68 | * project 2000. | - | ||||||||||||||||||||||||||||||
| 69 | */ | - | ||||||||||||||||||||||||||||||
| 70 | /* ==================================================================== | - | ||||||||||||||||||||||||||||||
| 71 | * Copyright (c) 2000-2005 The OpenSSL Project. All rights reserved. | - | ||||||||||||||||||||||||||||||
| 72 | * | - | ||||||||||||||||||||||||||||||
| 73 | * Redistribution and use in source and binary forms, with or without | - | ||||||||||||||||||||||||||||||
| 74 | * modification, are permitted provided that the following conditions | - | ||||||||||||||||||||||||||||||
| 75 | * are met: | - | ||||||||||||||||||||||||||||||
| 76 | * | - | ||||||||||||||||||||||||||||||
| 77 | * 1. Redistributions of source code must retain the above copyright | - | ||||||||||||||||||||||||||||||
| 78 | * notice, this list of conditions and the following disclaimer. | - | ||||||||||||||||||||||||||||||
| 79 | * | - | ||||||||||||||||||||||||||||||
| 80 | * 2. Redistributions in binary form must reproduce the above copyright | - | ||||||||||||||||||||||||||||||
| 81 | * notice, this list of conditions and the following disclaimer in | - | ||||||||||||||||||||||||||||||
| 82 | * the documentation and/or other materials provided with the | - | ||||||||||||||||||||||||||||||
| 83 | * distribution. | - | ||||||||||||||||||||||||||||||
| 84 | * | - | ||||||||||||||||||||||||||||||
| 85 | * 3. All advertising materials mentioning features or use of this | - | ||||||||||||||||||||||||||||||
| 86 | * software must display the following acknowledgment: | - | ||||||||||||||||||||||||||||||
| 87 | * "This product includes software developed by the OpenSSL Project | - | ||||||||||||||||||||||||||||||
| 88 | * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" | - | ||||||||||||||||||||||||||||||
| 89 | * | - | ||||||||||||||||||||||||||||||
| 90 | * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to | - | ||||||||||||||||||||||||||||||
| 91 | * endorse or promote products derived from this software without | - | ||||||||||||||||||||||||||||||
| 92 | * prior written permission. For written permission, please contact | - | ||||||||||||||||||||||||||||||
| 93 | * licensing@OpenSSL.org. | - | ||||||||||||||||||||||||||||||
| 94 | * | - | ||||||||||||||||||||||||||||||
| 95 | * 5. Products derived from this software may not be called "OpenSSL" | - | ||||||||||||||||||||||||||||||
| 96 | * nor may "OpenSSL" appear in their names without prior written | - | ||||||||||||||||||||||||||||||
| 97 | * permission of the OpenSSL Project. | - | ||||||||||||||||||||||||||||||
| 98 | * | - | ||||||||||||||||||||||||||||||
| 99 | * 6. Redistributions of any form whatsoever must retain the following | - | ||||||||||||||||||||||||||||||
| 100 | * acknowledgment: | - | ||||||||||||||||||||||||||||||
| 101 | * "This product includes software developed by the OpenSSL Project | - | ||||||||||||||||||||||||||||||
| 102 | * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" | - | ||||||||||||||||||||||||||||||
| 103 | * | - | ||||||||||||||||||||||||||||||
| 104 | * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY | - | ||||||||||||||||||||||||||||||
| 105 | * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | - | ||||||||||||||||||||||||||||||
| 106 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | - | ||||||||||||||||||||||||||||||
| 107 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR | - | ||||||||||||||||||||||||||||||
| 108 | * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | - | ||||||||||||||||||||||||||||||
| 109 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | - | ||||||||||||||||||||||||||||||
| 110 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | - | ||||||||||||||||||||||||||||||
| 111 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | - | ||||||||||||||||||||||||||||||
| 112 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | - | ||||||||||||||||||||||||||||||
| 113 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | - | ||||||||||||||||||||||||||||||
| 114 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | - | ||||||||||||||||||||||||||||||
| 115 | * OF THE POSSIBILITY OF SUCH DAMAGE. | - | ||||||||||||||||||||||||||||||
| 116 | * ==================================================================== | - | ||||||||||||||||||||||||||||||
| 117 | * | - | ||||||||||||||||||||||||||||||
| 118 | * This product includes cryptographic software written by Eric Young | - | ||||||||||||||||||||||||||||||
| 119 | * (eay@cryptsoft.com). This product includes software written by Tim | - | ||||||||||||||||||||||||||||||
| 120 | * Hudson (tjh@cryptsoft.com). | - | ||||||||||||||||||||||||||||||
| 121 | * | - | ||||||||||||||||||||||||||||||
| 122 | */ | - | ||||||||||||||||||||||||||||||
| 123 | - | |||||||||||||||||||||||||||||||
| 124 | /* $OpenBSD: rsa_meth.c,v 1.2 2018/09/12 06:35:38 djm Exp $ */ | - | ||||||||||||||||||||||||||||||
| 125 | /* | - | ||||||||||||||||||||||||||||||
| 126 | * Copyright (c) 2018 Theo Buehler <tb@openbsd.org> | - | ||||||||||||||||||||||||||||||
| 127 | * | - | ||||||||||||||||||||||||||||||
| 128 | * Permission to use, copy, modify, and distribute this software for any | - | ||||||||||||||||||||||||||||||
| 129 | * purpose with or without fee is hereby granted, provided that the above | - | ||||||||||||||||||||||||||||||
| 130 | * copyright notice and this permission notice appear in all copies. | - | ||||||||||||||||||||||||||||||
| 131 | * | - | ||||||||||||||||||||||||||||||
| 132 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | - | ||||||||||||||||||||||||||||||
| 133 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | - | ||||||||||||||||||||||||||||||
| 134 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | - | ||||||||||||||||||||||||||||||
| 135 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | - | ||||||||||||||||||||||||||||||
| 136 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | - | ||||||||||||||||||||||||||||||
| 137 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | - | ||||||||||||||||||||||||||||||
| 138 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | - | ||||||||||||||||||||||||||||||
| 139 | */ | - | ||||||||||||||||||||||||||||||
| 140 | - | |||||||||||||||||||||||||||||||
| 141 | #include "includes.h" | - | ||||||||||||||||||||||||||||||
| 142 | - | |||||||||||||||||||||||||||||||
| 143 | #ifdef WITH_OPENSSL | - | ||||||||||||||||||||||||||||||
| 144 | - | |||||||||||||||||||||||||||||||
| 145 | #include <sys/types.h> | - | ||||||||||||||||||||||||||||||
| 146 | - | |||||||||||||||||||||||||||||||
| 147 | #include <stdlib.h> | - | ||||||||||||||||||||||||||||||
| 148 | #include <string.h> | - | ||||||||||||||||||||||||||||||
| 149 | - | |||||||||||||||||||||||||||||||
| 150 | #include <openssl/err.h> | - | ||||||||||||||||||||||||||||||
| 151 | #include <openssl/bn.h> | - | ||||||||||||||||||||||||||||||
| 152 | #include <openssl/dsa.h> | - | ||||||||||||||||||||||||||||||
| 153 | #include <openssl/rsa.h> | - | ||||||||||||||||||||||||||||||
| 154 | #include <openssl/evp.h> | - | ||||||||||||||||||||||||||||||
| 155 | #include <openssl/ecdsa.h> | - | ||||||||||||||||||||||||||||||
| 156 | #include <openssl/dh.h> | - | ||||||||||||||||||||||||||||||
| 157 | - | |||||||||||||||||||||||||||||||
| 158 | #ifndef HAVE_DSA_GET0_PQG | - | ||||||||||||||||||||||||||||||
| 159 | void | - | ||||||||||||||||||||||||||||||
| 160 | DSA_get0_pqg(const DSA *d, const BIGNUM **p, const BIGNUM **q, const BIGNUM **g) | - | ||||||||||||||||||||||||||||||
| 161 | { | - | ||||||||||||||||||||||||||||||
| 162 | if (p != NULL)
| 3-240 | ||||||||||||||||||||||||||||||
| 163 | *p = d->p; executed 240 times by 4 tests: *p = d->p;Executed by:
| 240 | ||||||||||||||||||||||||||||||
| 164 | if (q != NULL)
| 28-215 | ||||||||||||||||||||||||||||||
| 165 | *q = d->q; executed 215 times by 4 tests: *q = d->q;Executed by:
| 215 | ||||||||||||||||||||||||||||||
| 166 | if (g != NULL)
| 25-218 | ||||||||||||||||||||||||||||||
| 167 | *g = d->g; executed 218 times by 4 tests: *g = d->g;Executed by:
| 218 | ||||||||||||||||||||||||||||||
| 168 | } executed 243 times by 4 tests: end of blockExecuted by:
| 243 | ||||||||||||||||||||||||||||||
| 169 | #endif /* HAVE_DSA_GET0_PQG */ | - | ||||||||||||||||||||||||||||||
| 170 | - | |||||||||||||||||||||||||||||||
| 171 | #ifndef HAVE_DSA_SET0_PQG | - | ||||||||||||||||||||||||||||||
| 172 | int | - | ||||||||||||||||||||||||||||||
| 173 | DSA_set0_pqg(DSA *d, BIGNUM *p, BIGNUM *q, BIGNUM *g) | - | ||||||||||||||||||||||||||||||
| 174 | { | - | ||||||||||||||||||||||||||||||
| 175 | if ((d->p == NULL && p == NULL) || (d->q == NULL && q == NULL) ||
| 0-10010 | ||||||||||||||||||||||||||||||
| 176 | (d->g == NULL && g == NULL))
| 0-10010 | ||||||||||||||||||||||||||||||
| 177 | return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||
| 178 | - | |||||||||||||||||||||||||||||||
| 179 | if (p != NULL) {
| 0-10010 | ||||||||||||||||||||||||||||||
| 180 | BN_free(d->p); | - | ||||||||||||||||||||||||||||||
| 181 | d->p = p; | - | ||||||||||||||||||||||||||||||
| 182 | } executed 10010 times by 4 tests: end of blockExecuted by:
| 10010 | ||||||||||||||||||||||||||||||
| 183 | if (q != NULL) {
| 0-10010 | ||||||||||||||||||||||||||||||
| 184 | BN_free(d->q); | - | ||||||||||||||||||||||||||||||
| 185 | d->q = q; | - | ||||||||||||||||||||||||||||||
| 186 | } executed 10010 times by 4 tests: end of blockExecuted by:
| 10010 | ||||||||||||||||||||||||||||||
| 187 | if (g != NULL) {
| 0-10010 | ||||||||||||||||||||||||||||||
| 188 | BN_free(d->g); | - | ||||||||||||||||||||||||||||||
| 189 | d->g = g; | - | ||||||||||||||||||||||||||||||
| 190 | } executed 10010 times by 4 tests: end of blockExecuted by:
| 10010 | ||||||||||||||||||||||||||||||
| 191 | - | |||||||||||||||||||||||||||||||
| 192 | return 1; executed 10010 times by 4 tests: return 1;Executed by:
| 10010 | ||||||||||||||||||||||||||||||
| 193 | } | - | ||||||||||||||||||||||||||||||
| 194 | #endif /* HAVE_DSA_SET0_PQG */ | - | ||||||||||||||||||||||||||||||
| 195 | - | |||||||||||||||||||||||||||||||
| 196 | #ifndef HAVE_DSA_GET0_KEY | - | ||||||||||||||||||||||||||||||
| 197 | void | - | ||||||||||||||||||||||||||||||
| 198 | DSA_get0_key(const DSA *d, const BIGNUM **pub_key, const BIGNUM **priv_key) | - | ||||||||||||||||||||||||||||||
| 199 | { | - | ||||||||||||||||||||||||||||||
| 200 | if (pub_key != NULL)
| 3-216 | ||||||||||||||||||||||||||||||
| 201 | *pub_key = d->pub_key; executed 216 times by 4 tests: *pub_key = d->pub_key;Executed by:
| 216 | ||||||||||||||||||||||||||||||
| 202 | if (priv_key != NULL)
| 4-215 | ||||||||||||||||||||||||||||||
| 203 | *priv_key = d->priv_key; executed 4 times by 2 tests: *priv_key = d->priv_key;Executed by:
| 4 | ||||||||||||||||||||||||||||||
| 204 | } executed 219 times by 4 tests: end of blockExecuted by:
| 219 | ||||||||||||||||||||||||||||||
| 205 | #endif /* HAVE_DSA_GET0_KEY */ | - | ||||||||||||||||||||||||||||||
| 206 | - | |||||||||||||||||||||||||||||||
| 207 | #ifndef HAVE_DSA_SET0_KEY | - | ||||||||||||||||||||||||||||||
| 208 | int | - | ||||||||||||||||||||||||||||||
| 209 | DSA_set0_key(DSA *d, BIGNUM *pub_key, BIGNUM *priv_key) | - | ||||||||||||||||||||||||||||||
| 210 | { | - | ||||||||||||||||||||||||||||||
| 211 | if (d->pub_key == NULL && pub_key == NULL)
| 0-10010 | ||||||||||||||||||||||||||||||
| 212 | return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||
| 213 | - | |||||||||||||||||||||||||||||||
| 214 | if (pub_key != NULL) {
| 0-10010 | ||||||||||||||||||||||||||||||
| 215 | BN_free(d->pub_key); | - | ||||||||||||||||||||||||||||||
| 216 | d->pub_key = pub_key; | - | ||||||||||||||||||||||||||||||
| 217 | } executed 10010 times by 4 tests: end of blockExecuted by:
| 10010 | ||||||||||||||||||||||||||||||
| 218 | if (priv_key != NULL) {
| 2-10008 | ||||||||||||||||||||||||||||||
| 219 | BN_free(d->priv_key); | - | ||||||||||||||||||||||||||||||
| 220 | d->priv_key = priv_key; | - | ||||||||||||||||||||||||||||||
| 221 | } executed 2 times by 2 tests: end of blockExecuted by:
| 2 | ||||||||||||||||||||||||||||||
| 222 | - | |||||||||||||||||||||||||||||||
| 223 | return 1; executed 10010 times by 4 tests: return 1;Executed by:
| 10010 | ||||||||||||||||||||||||||||||
| 224 | } | - | ||||||||||||||||||||||||||||||
| 225 | #endif /* HAVE_DSA_SET0_KEY */ | - | ||||||||||||||||||||||||||||||
| 226 | - | |||||||||||||||||||||||||||||||
| 227 | #ifndef HAVE_RSA_GET0_KEY | - | ||||||||||||||||||||||||||||||
| 228 | void | - | ||||||||||||||||||||||||||||||
| 229 | RSA_get0_key(const RSA *r, const BIGNUM **n, const BIGNUM **e, const BIGNUM **d) | - | ||||||||||||||||||||||||||||||
| 230 | { | - | ||||||||||||||||||||||||||||||
| 231 | if (n != NULL)
| 8-173831 | ||||||||||||||||||||||||||||||
| 232 | *n = r->n; executed 173831 times by 5 tests: *n = r->n;Executed by:
| 173831 | ||||||||||||||||||||||||||||||
| 233 | if (e != NULL)
| 232-173607 | ||||||||||||||||||||||||||||||
| 234 | *e = r->e; executed 232 times by 5 tests: *e = r->e;Executed by:
| 232 | ||||||||||||||||||||||||||||||
| 235 | if (d != NULL)
| 10-173829 | ||||||||||||||||||||||||||||||
| 236 | *d = r->d; executed 10 times by 3 tests: *d = r->d;Executed by:
| 10 | ||||||||||||||||||||||||||||||
| 237 | } executed 173839 times by 5 tests: end of blockExecuted by:
| 173839 | ||||||||||||||||||||||||||||||
| 238 | #endif /* HAVE_RSA_GET0_KEY */ | - | ||||||||||||||||||||||||||||||
| 239 | - | |||||||||||||||||||||||||||||||
| 240 | #ifndef HAVE_RSA_SET0_KEY | - | ||||||||||||||||||||||||||||||
| 241 | int | - | ||||||||||||||||||||||||||||||
| 242 | RSA_set0_key(RSA *r, BIGNUM *n, BIGNUM *e, BIGNUM *d) | - | ||||||||||||||||||||||||||||||
| 243 | { | - | ||||||||||||||||||||||||||||||
| 244 | if ((r->n == NULL && n == NULL) || (r->e == NULL && e == NULL))
| 0-5049 | ||||||||||||||||||||||||||||||
| 245 | return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||
| 246 | - | |||||||||||||||||||||||||||||||
| 247 | if (n != NULL) {
| 0-5049 | ||||||||||||||||||||||||||||||
| 248 | BN_free(r->n); | - | ||||||||||||||||||||||||||||||
| 249 | r->n = n; | - | ||||||||||||||||||||||||||||||
| 250 | } executed 5049 times by 5 tests: end of blockExecuted by:
| 5049 | ||||||||||||||||||||||||||||||
| 251 | if (e != NULL) {
| 0-5049 | ||||||||||||||||||||||||||||||
| 252 | BN_free(r->e); | - | ||||||||||||||||||||||||||||||
| 253 | r->e = e; | - | ||||||||||||||||||||||||||||||
| 254 | } executed 5049 times by 5 tests: end of blockExecuted by:
| 5049 | ||||||||||||||||||||||||||||||
| 255 | if (d != NULL) {
| 6-5043 | ||||||||||||||||||||||||||||||
| 256 | BN_free(r->d); | - | ||||||||||||||||||||||||||||||
| 257 | r->d = d; | - | ||||||||||||||||||||||||||||||
| 258 | } executed 6 times by 3 tests: end of blockExecuted by:
| 6 | ||||||||||||||||||||||||||||||
| 259 | - | |||||||||||||||||||||||||||||||
| 260 | return 1; executed 5049 times by 5 tests: return 1;Executed by:
| 5049 | ||||||||||||||||||||||||||||||
| 261 | } | - | ||||||||||||||||||||||||||||||
| 262 | #endif /* HAVE_RSA_SET0_KEY */ | - | ||||||||||||||||||||||||||||||
| 263 | - | |||||||||||||||||||||||||||||||
| 264 | #ifndef HAVE_RSA_GET0_CRT_PARAMS | - | ||||||||||||||||||||||||||||||
| 265 | void | - | ||||||||||||||||||||||||||||||
| 266 | RSA_get0_crt_params(const RSA *r, const BIGNUM **dmp1, const BIGNUM **dmq1, | - | ||||||||||||||||||||||||||||||
| 267 | const BIGNUM **iqmp) | - | ||||||||||||||||||||||||||||||
| 268 | { | - | ||||||||||||||||||||||||||||||
| 269 | if (dmp1 != NULL)
| 0-4 | ||||||||||||||||||||||||||||||
| 270 | *dmp1 = r->dmp1; never executed: *dmp1 = r->dmp1; | 0 | ||||||||||||||||||||||||||||||
| 271 | if (dmq1 != NULL)
| 0-4 | ||||||||||||||||||||||||||||||
| 272 | *dmq1 = r->dmq1; never executed: *dmq1 = r->dmq1; | 0 | ||||||||||||||||||||||||||||||
| 273 | if (iqmp != NULL)
| 0-4 | ||||||||||||||||||||||||||||||
| 274 | *iqmp = r->iqmp; executed 4 times by 2 tests: *iqmp = r->iqmp;Executed by:
| 4 | ||||||||||||||||||||||||||||||
| 275 | } executed 4 times by 2 tests: end of blockExecuted by:
| 4 | ||||||||||||||||||||||||||||||
| 276 | #endif /* HAVE_RSA_GET0_CRT_PARAMS */ | - | ||||||||||||||||||||||||||||||
| 277 | - | |||||||||||||||||||||||||||||||
| 278 | #ifndef HAVE_RSA_SET0_CRT_PARAMS | - | ||||||||||||||||||||||||||||||
| 279 | int | - | ||||||||||||||||||||||||||||||
| 280 | RSA_set0_crt_params(RSA *r, BIGNUM *dmp1, BIGNUM *dmq1, BIGNUM *iqmp) | - | ||||||||||||||||||||||||||||||
| 281 | { | - | ||||||||||||||||||||||||||||||
| 282 | if ((r->dmp1 == NULL && dmp1 == NULL) ||
| 0-6 | ||||||||||||||||||||||||||||||
| 283 | (r->dmq1 == NULL && dmq1 == NULL) ||
| 0-6 | ||||||||||||||||||||||||||||||
| 284 | (r->iqmp == NULL && iqmp == NULL))
| 0-6 | ||||||||||||||||||||||||||||||
| 285 | return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||
| 286 | - | |||||||||||||||||||||||||||||||
| 287 | if (dmp1 != NULL) {
| 0-6 | ||||||||||||||||||||||||||||||
| 288 | BN_free(r->dmp1); | - | ||||||||||||||||||||||||||||||
| 289 | r->dmp1 = dmp1; | - | ||||||||||||||||||||||||||||||
| 290 | } executed 6 times by 3 tests: end of blockExecuted by:
| 6 | ||||||||||||||||||||||||||||||
| 291 | if (dmq1 != NULL) {
| 0-6 | ||||||||||||||||||||||||||||||
| 292 | BN_free(r->dmq1); | - | ||||||||||||||||||||||||||||||
| 293 | r->dmq1 = dmq1; | - | ||||||||||||||||||||||||||||||
| 294 | } executed 6 times by 3 tests: end of blockExecuted by:
| 6 | ||||||||||||||||||||||||||||||
| 295 | if (iqmp != NULL) {
| 0-6 | ||||||||||||||||||||||||||||||
| 296 | BN_free(r->iqmp); | - | ||||||||||||||||||||||||||||||
| 297 | r->iqmp = iqmp; | - | ||||||||||||||||||||||||||||||
| 298 | } executed 6 times by 3 tests: end of blockExecuted by:
| 6 | ||||||||||||||||||||||||||||||
| 299 | - | |||||||||||||||||||||||||||||||
| 300 | return 1; executed 6 times by 3 tests: return 1;Executed by:
| 6 | ||||||||||||||||||||||||||||||
| 301 | } | - | ||||||||||||||||||||||||||||||
| 302 | #endif /* HAVE_RSA_SET0_CRT_PARAMS */ | - | ||||||||||||||||||||||||||||||
| 303 | - | |||||||||||||||||||||||||||||||
| 304 | #ifndef HAVE_RSA_GET0_FACTORS | - | ||||||||||||||||||||||||||||||
| 305 | void | - | ||||||||||||||||||||||||||||||
| 306 | RSA_get0_factors(const RSA *r, const BIGNUM **p, const BIGNUM **q) | - | ||||||||||||||||||||||||||||||
| 307 | { | - | ||||||||||||||||||||||||||||||
| 308 | if (p != NULL)
| 1-13 | ||||||||||||||||||||||||||||||
| 309 | *p = r->p; executed 13 times by 3 tests: *p = r->p;Executed by:
| 13 | ||||||||||||||||||||||||||||||
| 310 | if (q != NULL)
| 3-11 | ||||||||||||||||||||||||||||||
| 311 | *q = r->q; executed 11 times by 3 tests: *q = r->q;Executed by:
| 11 | ||||||||||||||||||||||||||||||
| 312 | } executed 14 times by 3 tests: end of blockExecuted by:
| 14 | ||||||||||||||||||||||||||||||
| 313 | #endif /* HAVE_RSA_GET0_FACTORS */ | - | ||||||||||||||||||||||||||||||
| 314 | - | |||||||||||||||||||||||||||||||
| 315 | #ifndef HAVE_RSA_SET0_FACTORS | - | ||||||||||||||||||||||||||||||
| 316 | int | - | ||||||||||||||||||||||||||||||
| 317 | RSA_set0_factors(RSA *r, BIGNUM *p, BIGNUM *q) | - | ||||||||||||||||||||||||||||||
| 318 | { | - | ||||||||||||||||||||||||||||||
| 319 | if ((r->p == NULL && p == NULL) || (r->q == NULL && q == NULL))
| 0-6 | ||||||||||||||||||||||||||||||
| 320 | return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||
| 321 | - | |||||||||||||||||||||||||||||||
| 322 | if (p != NULL) {
| 0-6 | ||||||||||||||||||||||||||||||
| 323 | BN_free(r->p); | - | ||||||||||||||||||||||||||||||
| 324 | r->p = p; | - | ||||||||||||||||||||||||||||||
| 325 | } executed 6 times by 3 tests: end of blockExecuted by:
| 6 | ||||||||||||||||||||||||||||||
| 326 | if (q != NULL) {
| 0-6 | ||||||||||||||||||||||||||||||
| 327 | BN_free(r->q); | - | ||||||||||||||||||||||||||||||
| 328 | r->q = q; | - | ||||||||||||||||||||||||||||||
| 329 | } executed 6 times by 3 tests: end of blockExecuted by:
| 6 | ||||||||||||||||||||||||||||||
| 330 | - | |||||||||||||||||||||||||||||||
| 331 | return 1; executed 6 times by 3 tests: return 1;Executed by:
| 6 | ||||||||||||||||||||||||||||||
| 332 | } | - | ||||||||||||||||||||||||||||||
| 333 | #endif /* HAVE_RSA_SET0_FACTORS */ | - | ||||||||||||||||||||||||||||||
| 334 | - | |||||||||||||||||||||||||||||||
| 335 | #ifndef HAVE_EVP_CIPHER_CTX_GET_IV | - | ||||||||||||||||||||||||||||||
| 336 | int | - | ||||||||||||||||||||||||||||||
| 337 | EVP_CIPHER_CTX_get_iv(const EVP_CIPHER_CTX *ctx, unsigned char *iv, size_t len) | - | ||||||||||||||||||||||||||||||
| 338 | { | - | ||||||||||||||||||||||||||||||
| 339 | if (ctx == NULL)
| 0 | ||||||||||||||||||||||||||||||
| 340 | return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||
| 341 | if (EVP_CIPHER_CTX_iv_length(ctx) < 0)
| 0 | ||||||||||||||||||||||||||||||
| 342 | return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||
| 343 | if (len != (size_t)EVP_CIPHER_CTX_iv_length(ctx))
| 0 | ||||||||||||||||||||||||||||||
| 344 | return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||
| 345 | if (len > EVP_MAX_IV_LENGTH)
| 0 | ||||||||||||||||||||||||||||||
| 346 | return 0; /* sanity check; shouldn't happen */ never executed: return 0; | 0 | ||||||||||||||||||||||||||||||
| 347 | /* | - | ||||||||||||||||||||||||||||||
| 348 | * Skip the memcpy entirely when the requested IV length is zero, | - | ||||||||||||||||||||||||||||||
| 349 | * since the iv pointer may be NULL or invalid. | - | ||||||||||||||||||||||||||||||
| 350 | */ | - | ||||||||||||||||||||||||||||||
| 351 | if (len != 0) {
| 0 | ||||||||||||||||||||||||||||||
| 352 | if (iv == NULL)
| 0 | ||||||||||||||||||||||||||||||
| 353 | return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||
| 354 | # ifdef HAVE_EVP_CIPHER_CTX_IV | - | ||||||||||||||||||||||||||||||
| 355 | memcpy(iv, EVP_CIPHER_CTX_iv(ctx), len); | - | ||||||||||||||||||||||||||||||
| 356 | # else | - | ||||||||||||||||||||||||||||||
| 357 | memcpy(iv, ctx->iv, len); | - | ||||||||||||||||||||||||||||||
| 358 | # endif /* HAVE_EVP_CIPHER_CTX_IV */ | - | ||||||||||||||||||||||||||||||
| 359 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 360 | return 1; never executed: return 1; | 0 | ||||||||||||||||||||||||||||||
| 361 | } | - | ||||||||||||||||||||||||||||||
| 362 | #endif /* HAVE_EVP_CIPHER_CTX_GET_IV */ | - | ||||||||||||||||||||||||||||||
| 363 | - | |||||||||||||||||||||||||||||||
| 364 | #ifndef HAVE_EVP_CIPHER_CTX_SET_IV | - | ||||||||||||||||||||||||||||||
| 365 | int | - | ||||||||||||||||||||||||||||||
| 366 | EVP_CIPHER_CTX_set_iv(EVP_CIPHER_CTX *ctx, const unsigned char *iv, size_t len) | - | ||||||||||||||||||||||||||||||
| 367 | { | - | ||||||||||||||||||||||||||||||
| 368 | if (ctx == NULL)
| 0 | ||||||||||||||||||||||||||||||
| 369 | return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||
| 370 | if (EVP_CIPHER_CTX_iv_length(ctx) < 0)
| 0 | ||||||||||||||||||||||||||||||
| 371 | return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||
| 372 | if (len != (size_t)EVP_CIPHER_CTX_iv_length(ctx))
| 0 | ||||||||||||||||||||||||||||||
| 373 | return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||
| 374 | if (len > EVP_MAX_IV_LENGTH)
| 0 | ||||||||||||||||||||||||||||||
| 375 | return 0; /* sanity check; shouldn't happen */ never executed: return 0; | 0 | ||||||||||||||||||||||||||||||
| 376 | /* | - | ||||||||||||||||||||||||||||||
| 377 | * Skip the memcpy entirely when the requested IV length is zero, | - | ||||||||||||||||||||||||||||||
| 378 | * since the iv pointer may be NULL or invalid. | - | ||||||||||||||||||||||||||||||
| 379 | */ | - | ||||||||||||||||||||||||||||||
| 380 | if (len != 0) {
| 0 | ||||||||||||||||||||||||||||||
| 381 | if (iv == NULL)
| 0 | ||||||||||||||||||||||||||||||
| 382 | return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||
| 383 | # ifdef HAVE_EVP_CIPHER_CTX_IV_NOCONST | - | ||||||||||||||||||||||||||||||
| 384 | memcpy(EVP_CIPHER_CTX_iv_noconst(ctx), iv, len); | - | ||||||||||||||||||||||||||||||
| 385 | # else | - | ||||||||||||||||||||||||||||||
| 386 | memcpy(ctx->iv, iv, len); | - | ||||||||||||||||||||||||||||||
| 387 | # endif /* HAVE_EVP_CIPHER_CTX_IV_NOCONST */ | - | ||||||||||||||||||||||||||||||
| 388 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 389 | return 1; never executed: return 1; | 0 | ||||||||||||||||||||||||||||||
| 390 | } | - | ||||||||||||||||||||||||||||||
| 391 | #endif /* HAVE_EVP_CIPHER_CTX_SET_IV */ | - | ||||||||||||||||||||||||||||||
| 392 | - | |||||||||||||||||||||||||||||||
| 393 | #ifndef HAVE_DSA_SIG_GET0 | - | ||||||||||||||||||||||||||||||
| 394 | void | - | ||||||||||||||||||||||||||||||
| 395 | DSA_SIG_get0(const DSA_SIG *sig, const BIGNUM **pr, const BIGNUM **ps) | - | ||||||||||||||||||||||||||||||
| 396 | { | - | ||||||||||||||||||||||||||||||
| 397 | if (pr != NULL)
| 0-65 | ||||||||||||||||||||||||||||||
| 398 | *pr = sig->r; executed 65 times by 3 tests: *pr = sig->r;Executed by:
| 65 | ||||||||||||||||||||||||||||||
| 399 | if (ps != NULL)
| 0-65 | ||||||||||||||||||||||||||||||
| 400 | *ps = sig->s; executed 65 times by 3 tests: *ps = sig->s;Executed by:
| 65 | ||||||||||||||||||||||||||||||
| 401 | } executed 65 times by 3 tests: end of blockExecuted by:
| 65 | ||||||||||||||||||||||||||||||
| 402 | #endif /* HAVE_DSA_SIG_GET0 */ | - | ||||||||||||||||||||||||||||||
| 403 | - | |||||||||||||||||||||||||||||||
| 404 | #ifndef HAVE_DSA_SIG_SET0 | - | ||||||||||||||||||||||||||||||
| 405 | int | - | ||||||||||||||||||||||||||||||
| 406 | DSA_SIG_set0(DSA_SIG *sig, BIGNUM *r, BIGNUM *s) | - | ||||||||||||||||||||||||||||||
| 407 | { | - | ||||||||||||||||||||||||||||||
| 408 | if (r == NULL || s == NULL)
| 0-2031 | ||||||||||||||||||||||||||||||
| 409 | return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||
| 410 | - | |||||||||||||||||||||||||||||||
| 411 | BN_clear_free(sig->r); | - | ||||||||||||||||||||||||||||||
| 412 | sig->r = r; | - | ||||||||||||||||||||||||||||||
| 413 | BN_clear_free(sig->s); | - | ||||||||||||||||||||||||||||||
| 414 | sig->s = s; | - | ||||||||||||||||||||||||||||||
| 415 | - | |||||||||||||||||||||||||||||||
| 416 | return 1; executed 2031 times by 3 tests: return 1;Executed by:
| 2031 | ||||||||||||||||||||||||||||||
| 417 | } | - | ||||||||||||||||||||||||||||||
| 418 | #endif /* HAVE_DSA_SIG_SET0 */ | - | ||||||||||||||||||||||||||||||
| 419 | - | |||||||||||||||||||||||||||||||
| 420 | #ifndef HAVE_ECDSA_SIG_GET0 | - | ||||||||||||||||||||||||||||||
| 421 | void | - | ||||||||||||||||||||||||||||||
| 422 | ECDSA_SIG_get0(const ECDSA_SIG *sig, const BIGNUM **pr, const BIGNUM **ps) | - | ||||||||||||||||||||||||||||||
| 423 | { | - | ||||||||||||||||||||||||||||||
| 424 | if (pr != NULL)
| 0-64 | ||||||||||||||||||||||||||||||
| 425 | *pr = sig->r; executed 64 times by 2 tests: *pr = sig->r;Executed by:
| 64 | ||||||||||||||||||||||||||||||
| 426 | if (ps != NULL)
| 0-64 | ||||||||||||||||||||||||||||||
| 427 | *ps = sig->s; executed 64 times by 2 tests: *ps = sig->s;Executed by:
| 64 | ||||||||||||||||||||||||||||||
| 428 | } executed 64 times by 2 tests: end of blockExecuted by:
| 64 | ||||||||||||||||||||||||||||||
| 429 | #endif /* HAVE_ECDSA_SIG_GET0 */ | - | ||||||||||||||||||||||||||||||
| 430 | - | |||||||||||||||||||||||||||||||
| 431 | #ifndef HAVE_ECDSA_SIG_SET0 | - | ||||||||||||||||||||||||||||||
| 432 | int | - | ||||||||||||||||||||||||||||||
| 433 | ECDSA_SIG_set0(ECDSA_SIG *sig, BIGNUM *r, BIGNUM *s) | - | ||||||||||||||||||||||||||||||
| 434 | { | - | ||||||||||||||||||||||||||||||
| 435 | if (r == NULL || s == NULL)
| 0-5809 | ||||||||||||||||||||||||||||||
| 436 | return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||
| 437 | - | |||||||||||||||||||||||||||||||
| 438 | BN_clear_free(sig->r); | - | ||||||||||||||||||||||||||||||
| 439 | BN_clear_free(sig->s); | - | ||||||||||||||||||||||||||||||
| 440 | sig->r = r; | - | ||||||||||||||||||||||||||||||
| 441 | sig->s = s; | - | ||||||||||||||||||||||||||||||
| 442 | return 1; executed 5809 times by 2 tests: return 1;Executed by:
| 5809 | ||||||||||||||||||||||||||||||
| 443 | } | - | ||||||||||||||||||||||||||||||
| 444 | #endif /* HAVE_ECDSA_SIG_SET0 */ | - | ||||||||||||||||||||||||||||||
| 445 | - | |||||||||||||||||||||||||||||||
| 446 | #ifndef HAVE_DH_GET0_PQG | - | ||||||||||||||||||||||||||||||
| 447 | void | - | ||||||||||||||||||||||||||||||
| 448 | DH_get0_pqg(const DH *dh, const BIGNUM **p, const BIGNUM **q, const BIGNUM **g) | - | ||||||||||||||||||||||||||||||
| 449 | { | - | ||||||||||||||||||||||||||||||
| 450 | if (p != NULL)
| 0-600 | ||||||||||||||||||||||||||||||
| 451 | *p = dh->p; executed 600 times by 1 test: *p = dh->p;Executed by:
| 600 | ||||||||||||||||||||||||||||||
| 452 | if (q != NULL)
| 0-600 | ||||||||||||||||||||||||||||||
| 453 | *q = dh->q; never executed: *q = dh->q; | 0 | ||||||||||||||||||||||||||||||
| 454 | if (g != NULL)
| 120-480 | ||||||||||||||||||||||||||||||
| 455 | *g = dh->g; executed 120 times by 1 test: *g = dh->g;Executed by:
| 120 | ||||||||||||||||||||||||||||||
| 456 | } executed 600 times by 1 test: end of blockExecuted by:
| 600 | ||||||||||||||||||||||||||||||
| 457 | #endif /* HAVE_DH_GET0_PQG */ | - | ||||||||||||||||||||||||||||||
| 458 | - | |||||||||||||||||||||||||||||||
| 459 | #ifndef HAVE_DH_SET0_PQG | - | ||||||||||||||||||||||||||||||
| 460 | int | - | ||||||||||||||||||||||||||||||
| 461 | DH_set0_pqg(DH *dh, BIGNUM *p, BIGNUM *q, BIGNUM *g) | - | ||||||||||||||||||||||||||||||
| 462 | { | - | ||||||||||||||||||||||||||||||
| 463 | if ((dh->p == NULL && p == NULL) || (dh->g == NULL && g == NULL))
| 0-160 | ||||||||||||||||||||||||||||||
| 464 | return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||
| 465 | - | |||||||||||||||||||||||||||||||
| 466 | if (p != NULL) {
| 0-160 | ||||||||||||||||||||||||||||||
| 467 | BN_free(dh->p); | - | ||||||||||||||||||||||||||||||
| 468 | dh->p = p; | - | ||||||||||||||||||||||||||||||
| 469 | } executed 160 times by 1 test: end of blockExecuted by:
| 160 | ||||||||||||||||||||||||||||||
| 470 | if (q != NULL) {
| 0-160 | ||||||||||||||||||||||||||||||
| 471 | BN_free(dh->q); | - | ||||||||||||||||||||||||||||||
| 472 | dh->q = q; | - | ||||||||||||||||||||||||||||||
| 473 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 474 | if (g != NULL) {
| 0-160 | ||||||||||||||||||||||||||||||
| 475 | BN_free(dh->g); | - | ||||||||||||||||||||||||||||||
| 476 | dh->g = g; | - | ||||||||||||||||||||||||||||||
| 477 | } executed 160 times by 1 test: end of blockExecuted by:
| 160 | ||||||||||||||||||||||||||||||
| 478 | - | |||||||||||||||||||||||||||||||
| 479 | return 1; executed 160 times by 1 test: return 1;Executed by:
| 160 | ||||||||||||||||||||||||||||||
| 480 | } | - | ||||||||||||||||||||||||||||||
| 481 | #endif /* HAVE_DH_SET0_PQG */ | - | ||||||||||||||||||||||||||||||
| 482 | - | |||||||||||||||||||||||||||||||
| 483 | #ifndef HAVE_DH_GET0_KEY | - | ||||||||||||||||||||||||||||||
| 484 | void | - | ||||||||||||||||||||||||||||||
| 485 | DH_get0_key(const DH *dh, const BIGNUM **pub_key, const BIGNUM **priv_key) | - | ||||||||||||||||||||||||||||||
| 486 | { | - | ||||||||||||||||||||||||||||||
| 487 | if (pub_key != NULL)
| 0-400 | ||||||||||||||||||||||||||||||
| 488 | *pub_key = dh->pub_key; executed 400 times by 1 test: *pub_key = dh->pub_key;Executed by:
| 400 | ||||||||||||||||||||||||||||||
| 489 | if (priv_key != NULL)
| 0-400 | ||||||||||||||||||||||||||||||
| 490 | *priv_key = dh->priv_key; never executed: *priv_key = dh->priv_key; | 0 | ||||||||||||||||||||||||||||||
| 491 | } executed 400 times by 1 test: end of blockExecuted by:
| 400 | ||||||||||||||||||||||||||||||
| 492 | #endif /* HAVE_DH_GET0_KEY */ | - | ||||||||||||||||||||||||||||||
| 493 | - | |||||||||||||||||||||||||||||||
| 494 | #ifndef HAVE_DH_SET0_KEY | - | ||||||||||||||||||||||||||||||
| 495 | int | - | ||||||||||||||||||||||||||||||
| 496 | DH_set0_key(DH *dh, BIGNUM *pub_key, BIGNUM *priv_key) | - | ||||||||||||||||||||||||||||||
| 497 | { | - | ||||||||||||||||||||||||||||||
| 498 | if (pub_key != NULL) {
| 0 | ||||||||||||||||||||||||||||||
| 499 | BN_free(dh->pub_key); | - | ||||||||||||||||||||||||||||||
| 500 | dh->pub_key = pub_key; | - | ||||||||||||||||||||||||||||||
| 501 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 502 | if (priv_key != NULL) {
| 0 | ||||||||||||||||||||||||||||||
| 503 | BN_free(dh->priv_key); | - | ||||||||||||||||||||||||||||||
| 504 | dh->priv_key = priv_key; | - | ||||||||||||||||||||||||||||||
| 505 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 506 | - | |||||||||||||||||||||||||||||||
| 507 | return 1; never executed: return 1; | 0 | ||||||||||||||||||||||||||||||
| 508 | } | - | ||||||||||||||||||||||||||||||
| 509 | #endif /* HAVE_DH_SET0_KEY */ | - | ||||||||||||||||||||||||||||||
| 510 | - | |||||||||||||||||||||||||||||||
| 511 | #ifndef HAVE_DH_SET_LENGTH | - | ||||||||||||||||||||||||||||||
| 512 | int | - | ||||||||||||||||||||||||||||||
| 513 | DH_set_length(DH *dh, long length) | - | ||||||||||||||||||||||||||||||
| 514 | { | - | ||||||||||||||||||||||||||||||
| 515 | if (length < 0 || length > INT_MAX)
| 0-160 | ||||||||||||||||||||||||||||||
| 516 | return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||
| 517 | - | |||||||||||||||||||||||||||||||
| 518 | dh->length = length; | - | ||||||||||||||||||||||||||||||
| 519 | return 1; executed 160 times by 1 test: return 1;Executed by:
| 160 | ||||||||||||||||||||||||||||||
| 520 | } | - | ||||||||||||||||||||||||||||||
| 521 | #endif /* HAVE_DH_SET_LENGTH */ | - | ||||||||||||||||||||||||||||||
| 522 | - | |||||||||||||||||||||||||||||||
| 523 | #ifndef HAVE_RSA_METH_FREE | - | ||||||||||||||||||||||||||||||
| 524 | void | - | ||||||||||||||||||||||||||||||
| 525 | RSA_meth_free(RSA_METHOD *meth) | - | ||||||||||||||||||||||||||||||
| 526 | { | - | ||||||||||||||||||||||||||||||
| 527 | if (meth != NULL) {
| 0 | ||||||||||||||||||||||||||||||
| 528 | free((char *)meth->name); | - | ||||||||||||||||||||||||||||||
| 529 | free(meth); | - | ||||||||||||||||||||||||||||||
| 530 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 531 | } never executed: end of block | 0 | ||||||||||||||||||||||||||||||
| 532 | #endif /* HAVE_RSA_METH_FREE */ | - | ||||||||||||||||||||||||||||||
| 533 | - | |||||||||||||||||||||||||||||||
| 534 | #ifndef HAVE_RSA_METH_DUP | - | ||||||||||||||||||||||||||||||
| 535 | RSA_METHOD * | - | ||||||||||||||||||||||||||||||
| 536 | RSA_meth_dup(const RSA_METHOD *meth) | - | ||||||||||||||||||||||||||||||
| 537 | { | - | ||||||||||||||||||||||||||||||
| 538 | RSA_METHOD *copy; | - | ||||||||||||||||||||||||||||||
| 539 | - | |||||||||||||||||||||||||||||||
| 540 | if ((copy = calloc(1, sizeof(*copy))) == NULL)
| 0 | ||||||||||||||||||||||||||||||
| 541 | return NULL; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||||||||
| 542 | memcpy(copy, meth, sizeof(*copy)); | - | ||||||||||||||||||||||||||||||
| 543 | if ((copy->name = strdup(meth->name)) == NULL) { never executed: __retval = (char *) memcpy (__retval, meth->name , __len);
| 0 | ||||||||||||||||||||||||||||||
| 544 | free(copy); | - | ||||||||||||||||||||||||||||||
| 545 | return NULL; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||||||||
| 546 | } | - | ||||||||||||||||||||||||||||||
| 547 | - | |||||||||||||||||||||||||||||||
| 548 | return copy; never executed: return copy; | 0 | ||||||||||||||||||||||||||||||
| 549 | } | - | ||||||||||||||||||||||||||||||
| 550 | #endif /* HAVE_RSA_METH_DUP */ | - | ||||||||||||||||||||||||||||||
| 551 | - | |||||||||||||||||||||||||||||||
| 552 | #ifndef HAVE_RSA_METH_SET1_NAME | - | ||||||||||||||||||||||||||||||
| 553 | int | - | ||||||||||||||||||||||||||||||
| 554 | RSA_meth_set1_name(RSA_METHOD *meth, const char *name) | - | ||||||||||||||||||||||||||||||
| 555 | { | - | ||||||||||||||||||||||||||||||
| 556 | char *copy; | - | ||||||||||||||||||||||||||||||
| 557 | - | |||||||||||||||||||||||||||||||
| 558 | if ((copy = strdup(name)) == NULL) never executed: __retval = (char *) memcpy (__retval, name , __len);
| 0 | ||||||||||||||||||||||||||||||
| 559 | return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||||||||
| 560 | free((char *)meth->name); | - | ||||||||||||||||||||||||||||||
| 561 | meth->name = copy; | - | ||||||||||||||||||||||||||||||
| 562 | return 1; never executed: return 1; | 0 | ||||||||||||||||||||||||||||||
| 563 | } | - | ||||||||||||||||||||||||||||||
| 564 | #endif /* HAVE_RSA_METH_SET1_NAME */ | - | ||||||||||||||||||||||||||||||
| 565 | - | |||||||||||||||||||||||||||||||
| 566 | #ifndef HAVE_RSA_METH_GET_FINISH | - | ||||||||||||||||||||||||||||||
| 567 | int | - | ||||||||||||||||||||||||||||||
| 568 | (*RSA_meth_get_finish(const RSA_METHOD *meth))(RSA *rsa) | - | ||||||||||||||||||||||||||||||
| 569 | { | - | ||||||||||||||||||||||||||||||
| 570 | return meth->finish; never executed: return meth->finish; | 0 | ||||||||||||||||||||||||||||||
| 571 | } | - | ||||||||||||||||||||||||||||||
| 572 | #endif /* HAVE_RSA_METH_GET_FINISH */ | - | ||||||||||||||||||||||||||||||
| 573 | - | |||||||||||||||||||||||||||||||
| 574 | #ifndef HAVE_RSA_METH_SET_PRIV_ENC | - | ||||||||||||||||||||||||||||||
| 575 | int | - | ||||||||||||||||||||||||||||||
| 576 | RSA_meth_set_priv_enc(RSA_METHOD *meth, int (*priv_enc)(int flen, | - | ||||||||||||||||||||||||||||||
| 577 | const unsigned char *from, unsigned char *to, RSA *rsa, int padding)) | - | ||||||||||||||||||||||||||||||
| 578 | { | - | ||||||||||||||||||||||||||||||
| 579 | meth->rsa_priv_enc = priv_enc; | - | ||||||||||||||||||||||||||||||
| 580 | return 1; never executed: return 1; | 0 | ||||||||||||||||||||||||||||||
| 581 | } | - | ||||||||||||||||||||||||||||||
| 582 | #endif /* HAVE_RSA_METH_SET_PRIV_ENC */ | - | ||||||||||||||||||||||||||||||
| 583 | - | |||||||||||||||||||||||||||||||
| 584 | #ifndef HAVE_RSA_METH_SET_PRIV_DEC | - | ||||||||||||||||||||||||||||||
| 585 | int | - | ||||||||||||||||||||||||||||||
| 586 | RSA_meth_set_priv_dec(RSA_METHOD *meth, int (*priv_dec)(int flen, | - | ||||||||||||||||||||||||||||||
| 587 | const unsigned char *from, unsigned char *to, RSA *rsa, int padding)) | - | ||||||||||||||||||||||||||||||
| 588 | { | - | ||||||||||||||||||||||||||||||
| 589 | meth->rsa_priv_dec = priv_dec; | - | ||||||||||||||||||||||||||||||
| 590 | return 1; never executed: return 1; | 0 | ||||||||||||||||||||||||||||||
| 591 | } | - | ||||||||||||||||||||||||||||||
| 592 | #endif /* HAVE_RSA_METH_SET_PRIV_DEC */ | - | ||||||||||||||||||||||||||||||
| 593 | - | |||||||||||||||||||||||||||||||
| 594 | #ifndef HAVE_RSA_METH_SET_FINISH | - | ||||||||||||||||||||||||||||||
| 595 | int | - | ||||||||||||||||||||||||||||||
| 596 | RSA_meth_set_finish(RSA_METHOD *meth, int (*finish)(RSA *rsa)) | - | ||||||||||||||||||||||||||||||
| 597 | { | - | ||||||||||||||||||||||||||||||
| 598 | meth->finish = finish; | - | ||||||||||||||||||||||||||||||
| 599 | return 1; never executed: return 1; | 0 | ||||||||||||||||||||||||||||||
| 600 | } | - | ||||||||||||||||||||||||||||||
| 601 | #endif /* HAVE_RSA_METH_SET_FINISH */ | - | ||||||||||||||||||||||||||||||
| 602 | - | |||||||||||||||||||||||||||||||
| 603 | #ifndef HAVE_EVP_PKEY_GET0_RSA | - | ||||||||||||||||||||||||||||||
| 604 | RSA * | - | ||||||||||||||||||||||||||||||
| 605 | EVP_PKEY_get0_RSA(EVP_PKEY *pkey) | - | ||||||||||||||||||||||||||||||
| 606 | { | - | ||||||||||||||||||||||||||||||
| 607 | if (pkey->type != EVP_PKEY_RSA) {
| 0 | ||||||||||||||||||||||||||||||
| 608 | /* EVPerror(EVP_R_EXPECTING_AN_RSA_KEY); */ | - | ||||||||||||||||||||||||||||||
| 609 | return NULL; never executed: return ((void *)0) ; | 0 | ||||||||||||||||||||||||||||||
| 610 | } | - | ||||||||||||||||||||||||||||||
| 611 | return pkey->pkey.rsa; never executed: return pkey->pkey.rsa; | 0 | ||||||||||||||||||||||||||||||
| 612 | } | - | ||||||||||||||||||||||||||||||
| 613 | #endif /* HAVE_EVP_PKEY_GET0_RSA */ | - | ||||||||||||||||||||||||||||||
| 614 | - | |||||||||||||||||||||||||||||||
| 615 | #ifndef HAVE_EVP_MD_CTX_NEW | - | ||||||||||||||||||||||||||||||
| 616 | EVP_MD_CTX * | - | ||||||||||||||||||||||||||||||
| 617 | EVP_MD_CTX_new(void) | - | ||||||||||||||||||||||||||||||
| 618 | { | - | ||||||||||||||||||||||||||||||
| 619 | return calloc(1, sizeof(EVP_MD_CTX)); executed 6290 times by 3 tests: return calloc(1, sizeof(EVP_MD_CTX));Executed by:
| 6290 | ||||||||||||||||||||||||||||||
| 620 | } | - | ||||||||||||||||||||||||||||||
| 621 | #endif /* HAVE_EVP_MD_CTX_NEW */ | - | ||||||||||||||||||||||||||||||
| 622 | - | |||||||||||||||||||||||||||||||
| 623 | #ifndef HAVE_EVP_MD_CTX_FREE | - | ||||||||||||||||||||||||||||||
| 624 | void | - | ||||||||||||||||||||||||||||||
| 625 | EVP_MD_CTX_free(EVP_MD_CTX *ctx) | - | ||||||||||||||||||||||||||||||
| 626 | { | - | ||||||||||||||||||||||||||||||
| 627 | if (ctx == NULL)
| 0-6290 | ||||||||||||||||||||||||||||||
| 628 | return; never executed: return; | 0 | ||||||||||||||||||||||||||||||
| 629 | - | |||||||||||||||||||||||||||||||
| 630 | EVP_MD_CTX_cleanup(ctx); | - | ||||||||||||||||||||||||||||||
| 631 | - | |||||||||||||||||||||||||||||||
| 632 | free(ctx); | - | ||||||||||||||||||||||||||||||
| 633 | } executed 6290 times by 3 tests: end of blockExecuted by:
| 6290 | ||||||||||||||||||||||||||||||
| 634 | #endif /* HAVE_EVP_MD_CTX_FREE */ | - | ||||||||||||||||||||||||||||||
| 635 | - | |||||||||||||||||||||||||||||||
| 636 | #endif /* WITH_OPENSSL */ | - | ||||||||||||||||||||||||||||||
| Source code | Switch to Preprocessed file |