/freebsd/crypto/openssl/crypto/dsa/ |
H A D | dsa_key.c | 44 const BIGNUM *priv_key, BIGNUM *pub_key) in ossl_dsa_generate_public_key() argument 51 BN_with_flags(prk, priv_key, BN_FLG_CONSTTIME); in ossl_dsa_generate_public_key() 66 BIGNUM *pub_key = NULL, *priv_key = NULL; in dsa_keygen() local 71 if (dsa->priv_key == NULL) { in dsa_keygen() 72 if ((priv_key = BN_secure_new()) == NULL) in dsa_keygen() 75 priv_key = dsa->priv_key; in dsa_keygen() 90 MIN_STRENGTH, priv_key)) in dsa_keygen() 100 if (!ossl_dsa_generate_public_key(ctx, dsa, priv_key, pub_key)) in dsa_keygen() 103 dsa->priv_key = priv_key; in dsa_keygen() 120 BN_clear_free(dsa->priv_key); in dsa_keygen() [all …]
|
H A D | dsa_lib.c | 49 BIGNUM *pub_key = NULL, *priv_key = NULL; in DSA_dup_DH() local 64 if (r->priv_key != NULL) { in DSA_dup_DH() 65 priv_key = BN_dup(r->priv_key); in DSA_dup_DH() 66 if (priv_key == NULL) in DSA_dup_DH() 69 if (!DH_set0_key(ret, pub_key, priv_key)) in DSA_dup_DH() 71 } else if (r->priv_key != NULL) { in DSA_dup_DH() 80 BN_free(priv_key); in DSA_dup_DH() 237 BN_clear_free(r->priv_key); in DSA_free() 302 return d->priv_key; in DSA_get0_priv_key() 306 const BIGNUM **pub_key, const BIGNUM **priv_key) in DSA_get0_key() argument [all …]
|
H A D | dsa_backend.c | 34 BIGNUM *priv_key = NULL, *pub_key = NULL; in ossl_dsa_key_fromdata() local 52 if (param_priv_key != NULL && !OSSL_PARAM_get_BN(param_priv_key, &priv_key)) in ossl_dsa_key_fromdata() 55 if (!DSA_set0_key(dsa, pub_key, priv_key)) in ossl_dsa_key_fromdata() 61 BN_clear_free(priv_key); in ossl_dsa_key_fromdata() 106 || !dsa_bn_dup_check(&dupkey->priv_key, dsa->priv_key))) in ossl_dsa_dup()
|
H A D | dsa_check.c | 89 int ossl_dsa_check_priv_key(const DSA *dsa, const BIGNUM *priv_key, int *ret) in ossl_dsa_check_pairwise() 96 return ossl_ffc_validate_private_key(dsa->params.q, priv_key, ret); in ossl_dsa_check_pairwise() 113 || dsa->priv_key == NULL 125 if (!ossl_dsa_generate_public_key(ctx, dsa, dsa->priv_key, pub_key)) 57 ossl_dsa_check_priv_key(const DSA * dsa,const BIGNUM * priv_key,int * ret) ossl_dsa_check_priv_key() argument
|
/freebsd/crypto/libecc/src/tests/ |
H A D | ed25519_test_vectors.h | 21 .priv_key = ed25519_1_test_vectors_priv_key, 44 .priv_key = ed25519_2_test_vectors_priv_key, 67 .priv_key = ed25519_3_test_vectors_priv_key, 90 .priv_key = ed25519_4_test_vectors_priv_key, 113 .priv_key = ed25519_5_test_vectors_priv_key, 136 .priv_key = ed25519_6_test_vectors_priv_key, 159 .priv_key = ed25519_7_test_vectors_priv_key, 182 .priv_key = ed25519_8_test_vectors_priv_key, 205 .priv_key = ed25519_9_test_vectors_priv_key, 228 .priv_key = ed25519_10_test_vectors_priv_key, [all …]
|
H A D | decdsa_test_vectors.h | 31 .priv_key = decdsa_rfc6979_SECP192R1_SHA224_0_test_vector_priv_key, 66 .priv_key = decdsa_rfc6979_SECP192R1_SHA256_0_test_vector_priv_key, 101 .priv_key = decdsa_rfc6979_SECP192R1_SHA384_0_test_vector_priv_key, 136 .priv_key = decdsa_rfc6979_SECP192R1_SHA512_0_test_vector_priv_key, 171 .priv_key = decdsa_rfc6979_SECP192R1_SHA224_1_test_vector_priv_key, 206 .priv_key = decdsa_rfc6979_SECP192R1_SHA256_1_test_vector_priv_key, 241 .priv_key = decdsa_rfc6979_SECP192R1_SHA384_1_test_vector_priv_key, 276 .priv_key = decdsa_rfc6979_SECP192R1_SHA512_1_test_vector_priv_key, 314 .priv_key = decdsa_rfc6979_SECP256R1_SHA224_0_test_vector_priv_key, 352 .priv_key = decdsa_rfc6979_SECP256R1_SHA256_0_test_vector_priv_key, [all …]
|
H A D | ed448_test_vectors.h | 24 .priv_key = ed448_1_test_vectors_priv_key, 47 .priv_key = ed448_2_test_vectors_priv_key, 70 .priv_key = ed448_3_test_vectors_priv_key, 96 .priv_key = ed448_4_test_vectors_priv_key, 122 .priv_key = ed448_5_test_vectors_priv_key, 148 .priv_key = ed448_6_test_vectors_priv_key, 174 .priv_key = ed448_7_test_vectors_priv_key, 263 .priv_key = ed448_8_test_vectors_priv_key, 292 .priv_key = ed448_9_test_vectors_priv_key,
|
H A D | ec_self_tests_core.h | 30 const u8 *priv_key; member 173 .priv_key = ecdsa_secp224r1_sha3_224_test_vectors_priv_key, 241 .priv_key = ecdsa_secp256r1_sha3_256_test_vectors_priv_key, 309 .priv_key = ecdsa_secp256r1_sha3_512_test_vectors_priv_key, 385 .priv_key = ecdsa_secp384r1_sha3_384_test_vectors_priv_key, 472 .priv_key = ecdsa_secp521r1_sha3_512_test_vectors_priv_key, 532 .priv_key = ecdsa_secp192r1_test_vectors_priv_key, 598 .priv_key = ecdsa_secp224r1_test_vectors_priv_key, 664 .priv_key = ecdsa_secp256r1_test_vectors_priv_key, 731 .priv_key = ecdsa_secp256r1_sha512_test_vectors_priv_key, [all …]
|
H A D | dbign_test_vectors.h | 31 .priv_key = dbign_1_test_vectors_priv_key, 61 .priv_key = dbign_2_test_vectors_priv_key, 91 .priv_key = dbign_3_test_vectors_priv_key, 121 .priv_key = dbign_4_test_vectors_priv_key, 148 .priv_key = dbign_5_test_vectors_priv_key, 179 .priv_key = dbign_6_test_vectors_priv_key, 206 .priv_key = dbign_7_test_vectors_priv_key,
|
H A D | bign_test_vectors.h | 50 .priv_key = bign_1_test_vectors_priv_key, 101 .priv_key = bign_2_test_vectors_priv_key, 149 .priv_key = bign_3_test_vectors_priv_key, 200 .priv_key = bign_4_test_vectors_priv_key, 256 .priv_key = bign_5_test_vectors_priv_key, 310 .priv_key = bign_6_test_vectors_priv_key, 367 .priv_key = bign_7_test_vectors_priv_key, 423 .priv_key = bign_8_test_vectors_priv_key,
|
/freebsd/crypto/libecc/include/libecc/sig/ |
H A D | ec_key.h | 75 #define EC_PRIV_KEY_EXPORT_SIZE(priv_key) \ argument 76 …LOCAL_MAX(MAX_DIGEST_SIZE, LOCAL_MAX(BYTECEIL((priv_key)->params->ec_gen_order_bitlen), BYTECEIL((… 82 #define EC_PRIV_KEY_EXPORT_SIZE(priv_key) \ argument 83 …((u8)(LOCAL_MAX(BYTECEIL((priv_key)->params->ec_gen_order_bitlen), BYTECEIL((priv_key)->params->ec… 92 #define EC_STRUCTURED_PRIV_KEY_EXPORT_SIZE(priv_key) \ argument 93 ((u8)(EC_PRIV_KEY_EXPORT_SIZE(priv_key) + (3 * sizeof(u8)))) 99 ATTRIBUTE_WARN_UNUSED_RET int ec_priv_key_import_from_buf(ec_priv_key *priv_key, 103 ATTRIBUTE_WARN_UNUSED_RET int ec_priv_key_export_to_buf(const ec_priv_key *priv_key, u8 *priv_key_b… 106 ATTRIBUTE_WARN_UNUSED_RET int ec_structured_priv_key_import_from_buf(ec_priv_key *priv_key, 111 ATTRIBUTE_WARN_UNUSED_RET int ec_structured_priv_key_export_to_buf(const ec_priv_key *priv_key, [all …]
|
/freebsd/crypto/libecc/src/sig/ |
H A D | ec_key.c | 56 int ec_priv_key_import_from_buf(ec_priv_key *priv_key, in ec_priv_key_import_from_buf() argument 63 MUST_HAVE((priv_key != NULL), ret, err); in ec_priv_key_import_from_buf() 65 ret = nn_init_from_buf(&(priv_key->x), priv_key_buf, priv_key_buf_len); EG(ret, err); in ec_priv_key_import_from_buf() 68 priv_key->key_type = ec_key_alg; in ec_priv_key_import_from_buf() 69 priv_key->params = (const ec_params *)params; in ec_priv_key_import_from_buf() 70 priv_key->magic = PRIV_KEY_MAGIC; in ec_priv_key_import_from_buf() 80 int ec_priv_key_export_to_buf(const ec_priv_key *priv_key, u8 *priv_key_buf, in ec_priv_key_export_to_buf() argument 86 ret = priv_key_check_initialized(priv_key); EG(ret, err); in ec_priv_key_export_to_buf() 92 ret = nn_bitlen(&(priv_key->x), &blen); EG(ret, err); in ec_priv_key_export_to_buf() 96 ret = nn_export_to_buf(priv_key_buf, priv_key_buf_len, &(priv_key->x)); in ec_priv_key_export_to_buf() [all …]
|
H A D | fuzzing_ecdsa.c | 43 const ec_priv_key *priv_key; in ecdsa_sign_raw() local 75 priv_key = &(ctx->key_pair->priv_key); in ecdsa_sign_raw() 76 q = &(priv_key->params->ec_gen_order); in ecdsa_sign_raw() 77 q_bit_len = priv_key->params->ec_gen_order_bitlen; in ecdsa_sign_raw() 78 G = &(priv_key->params->ec_gen); in ecdsa_sign_raw() 80 x = &(priv_key->x); in ecdsa_sign_raw() 83 dbg_nn_print("p", &(priv_key->params->ec_fp.p)); in ecdsa_sign_raw() 84 dbg_nn_print("q", &(priv_key->params->ec_gen_order)); in ecdsa_sign_raw() 85 dbg_priv_key_print("x", priv_key); in ecdsa_sign_raw() 86 dbg_ec_point_print("G", &(priv_key->params->ec_gen)); in ecdsa_sign_raw() [all …]
|
H A D | ecsdsa_common.c | 146 const ec_priv_key *priv_key; in __ecsdsa_sign_init() local 168 priv_key = &(ctx->key_pair->priv_key); in __ecsdsa_sign_init() 169 G = &(priv_key->params->ec_gen); in __ecsdsa_sign_init() 170 q = &(priv_key->params->ec_gen_order); in __ecsdsa_sign_init() 171 p_bit_len = priv_key->params->ec_fp.p_bitlen; in __ecsdsa_sign_init() 174 dbg_nn_print("p", &(priv_key->params->ec_fp.p)); in __ecsdsa_sign_init() 176 dbg_priv_key_print("x", priv_key); in __ecsdsa_sign_init() 230 PTR_NULLIFY(priv_key); in __ecsdsa_sign_init() 275 const ec_priv_key *priv_key; in __ecsdsa_sign_finalize() local 299 priv_key = &(ctx->key_pair->priv_key); in __ecsdsa_sign_finalize() [all …]
|
H A D | fuzzing_ecgdsa.c | 46 const ec_priv_key *priv_key; in ecgdsa_sign_raw() local 75 priv_key = &(ctx->key_pair->priv_key); in ecgdsa_sign_raw() 76 G = &(priv_key->params->ec_gen); in ecgdsa_sign_raw() 77 q = &(priv_key->params->ec_gen_order); in ecgdsa_sign_raw() 78 x = &(priv_key->x); in ecgdsa_sign_raw() 79 q_bit_len = priv_key->params->ec_gen_order_bitlen; in ecgdsa_sign_raw() 80 p_bit_len = priv_key->params->ec_fp.p_bitlen; in ecgdsa_sign_raw() 88 dbg_nn_print("p", &(priv_key->params->ec_fp.p)); in ecgdsa_sign_raw() 90 dbg_priv_key_print("x", priv_key); in ecgdsa_sign_raw() 238 PTR_NULLIFY(priv_key); in ecgdsa_sign_raw()
|
/freebsd/crypto/openssl/crypto/ec/ |
H A D | ec_key.c | 99 BN_clear_free(r->priv_key); in EC_KEY_free() 144 if (src->priv_key != NULL) { in EC_KEY_copy() 145 if (dest->priv_key == NULL) { in EC_KEY_copy() 146 dest->priv_key = BN_new(); in EC_KEY_copy() 147 if (dest->priv_key == NULL) in EC_KEY_copy() 150 if (!BN_copy(dest->priv_key, src->priv_key)) in EC_KEY_copy() 254 BIGNUM *priv_key = NULL; in ec_generate_key() local 265 if (eckey->priv_key == NULL) { in ec_generate_key() 266 priv_key = BN_secure_new(); in ec_generate_key() 267 if (priv_key == NULL) in ec_generate_key() [all …]
|
H A D | ecdh_ossl.c | 55 const BIGNUM *priv_key; in ossl_ecdh_simple_compute_key() local 70 priv_key = EC_KEY_get0_private_key(ecdh); in ossl_ecdh_simple_compute_key() 71 if (priv_key == NULL) { in ossl_ecdh_simple_compute_key() 84 !BN_mul(x, x, priv_key, ctx)) { in ossl_ecdh_simple_compute_key() 88 priv_key = x; in ossl_ecdh_simple_compute_key() 96 if (!EC_POINT_mul(group, tmp, NULL, pub_key, priv_key, ctx)) { in ossl_ecdh_simple_compute_key()
|
H A D | ec_asn1.c | 940 EC_PRIVATEKEY *priv_key = NULL; in d2i_ECPrivateKey() local 943 if ((priv_key = d2i_EC_PRIVATEKEY(NULL, &p, len)) == NULL) in d2i_ECPrivateKey() 954 if (priv_key->parameters) { in d2i_ECPrivateKey() 956 ret->group = EC_GROUP_new_from_ecpkparameters(priv_key->parameters); in d2i_ECPrivateKey() 958 && priv_key->parameters->type == ECPKPARAMETERS_TYPE_EXPLICIT) in d2i_ECPrivateKey() 967 ret->version = priv_key->version; in d2i_ECPrivateKey() 969 if (priv_key->privateKey) { in d2i_ECPrivateKey() 970 ASN1_OCTET_STRING *pkey = priv_key->privateKey; in d2i_ECPrivateKey() 989 if (priv_key->publicKey) { in d2i_ECPrivateKey() 993 pub_oct = ASN1_STRING_get0_data(priv_key->publicKey); in d2i_ECPrivateKey() [all …]
|
/freebsd/crypto/libecc/src/ecdh/ |
H A D | x25519_448.c | 304 ATTRIBUTE_WARN_UNUSED_RET static int x25519_448_gen_priv_key(u8 *priv_key, u8 len) in x25519_448_gen_priv_key() argument 308 MUST_HAVE((priv_key != NULL), ret, err); in x25519_448_gen_priv_key() 312 ret = get_random(priv_key, len); in x25519_448_gen_priv_key() 319 ATTRIBUTE_WARN_UNUSED_RET static int x25519_448_init_pub_key(const u8 *priv_key, u8 *pub_key, u8 le… in x25519_448_init_pub_key() argument 323 MUST_HAVE((priv_key != NULL) && (pub_key != NULL), ret, err); in x25519_448_init_pub_key() 342 ret = x25519_448_core(priv_key, u, pub_key, len); in x25519_448_init_pub_key() 350 ret = x25519_448_core(priv_key, u, pub_key, len); in x25519_448_init_pub_key() 359 ATTRIBUTE_WARN_UNUSED_RET static int x25519_448_derive_secret(const u8 *priv_key, const u8 *peer_pu… in x25519_448_derive_secret() argument 363 MUST_HAVE((priv_key != NULL) && (peer_pub_key != NULL) && (shared_secret != NULL), ret, err); in x25519_448_derive_secret() 367 ret = x25519_448_core(priv_key, peer_pub_key, shared_secret, len); in x25519_448_derive_secret() [all …]
|
H A D | ecccdh.c | 100 kp->priv_key.magic = PRIV_KEY_MAGIC; in ecccdh_gen_key_pair() 101 kp->priv_key.key_type = ECCCDH; in ecccdh_gen_key_pair() 102 kp->priv_key.params = params; in ecccdh_gen_key_pair() 103 ret = generic_gen_priv_key(&(kp->priv_key)); EG(ret, err); in ecccdh_gen_key_pair() 106 ret = ecccdh_init_pub_key(&(kp->pub_key), &(kp->priv_key)); in ecccdh_gen_key_pair() 128 …ret = ec_priv_key_import_from_buf(&(kp->priv_key), params, priv_key_buf, priv_key_buf_len, ECCCDH)… in ecccdh_import_key_pair_from_priv_key_buf() 131 ret = ecccdh_init_pub_key(&(kp->pub_key), &(kp->priv_key)); in ecccdh_import_key_pair_from_priv_key_buf()
|
/freebsd/crypto/openssl/providers/implementations/keymgmt/ |
H A D | mac_legacy_kmgmt.c | 59 unsigned char *priv_key; member 98 OPENSSL_secure_clear_free(mackey->priv_key, mackey->priv_key_len); in ossl_mac_key_free() 152 ok = key->priv_key != NULL; in mac_has() 167 if ((key1->priv_key == NULL && key2->priv_key != NULL) in mac_match() 168 || (key1->priv_key != NULL && key2->priv_key == NULL) in mac_match() 174 ok = ok && (key1->priv_key == NULL /* implies key2->privkey == NULL */ in mac_match() 175 || CRYPTO_memcmp(key1->priv_key, key2->priv_key, in mac_match() 194 OPENSSL_secure_clear_free(key->priv_key, key->priv_key_len); in mac_key_fromdata() 196 key->priv_key = OPENSSL_secure_malloc(p->data_size > 0 ? p->data_size : 1); in mac_key_fromdata() 197 if (key->priv_key == NULL) { in mac_key_fromdata() [all …]
|
/freebsd/crypto/openssl/crypto/dh/ |
H A D | dh_key.c | 72 if (dh->priv_key == NULL) { in ossl_dh_compute_key() 80 BN_set_flags(dh->priv_key, BN_FLG_CONSTTIME); in ossl_dh_compute_key() 86 if (!dh->meth->bn_mod_exp(dh, z, pub_key, dh->priv_key, dh->params.p, ctx, in ossl_dh_compute_key() 226 const BIGNUM *priv_key, BIGNUM *pub_key) in ossl_dh_generate_public_key() argument 249 BN_with_flags(prk, priv_key, BN_FLG_CONSTTIME); in ossl_dh_generate_public_key() 269 BIGNUM *pub_key = NULL, *priv_key = NULL; in generate_key() local 291 if (dh->priv_key == NULL) { in generate_key() 292 priv_key = BN_secure_new(); in generate_key() 293 if (priv_key == NULL) in generate_key() 297 priv_key = dh->priv_key; in generate_key() [all …]
|
H A D | dh_lib.c | 159 BN_clear_free(r->priv_key); in DH_free() 255 void DH_get0_key(const DH *dh, const BIGNUM **pub_key, const BIGNUM **priv_key) in DH_get0_key() argument 259 if (priv_key != NULL) in DH_get0_key() 260 *priv_key = dh->priv_key; in DH_get0_key() 263 int DH_set0_key(DH *dh, BIGNUM *pub_key, BIGNUM *priv_key) in DH_set0_key() argument 269 if (priv_key != NULL) { in DH_set0_key() 270 BN_clear_free(dh->priv_key); in DH_set0_key() 271 dh->priv_key = priv_key; in DH_set0_key() 295 return dh->priv_key; in DH_get0_priv_key()
|
/freebsd/crypto/libecc/include/libecc/ecdh/ |
H A D | x25519_448.h | 36 ATTRIBUTE_WARN_UNUSED_RET int x25519_gen_priv_key(u8 priv_key[X25519_SIZE]); 38 ATTRIBUTE_WARN_UNUSED_RET int x25519_init_pub_key(const u8 priv_key[X25519_SIZE], u8 pub_key[X25519… 40 ATTRIBUTE_WARN_UNUSED_RET int x25519_derive_secret(const u8 priv_key[X25519_SIZE], const u8 peer_pu… 53 ATTRIBUTE_WARN_UNUSED_RET int x448_gen_priv_key(u8 priv_key[X448_SIZE]); 55 ATTRIBUTE_WARN_UNUSED_RET int x448_init_pub_key(const u8 priv_key[X448_SIZE], u8 pub_key[X448_SIZE]… 57 ATTRIBUTE_WARN_UNUSED_RET int x448_derive_secret(const u8 priv_key[X448_SIZE], const u8 peer_pub_ke…
|
/freebsd/crypto/openssl/crypto/sm2/ |
H A D | sm2_key.c | 27 const BIGNUM *priv_key = NULL, *order = NULL; in ossl_sm2_key_private_check() local 31 || (priv_key = EC_KEY_get0_private_key(eckey)) == NULL in ossl_sm2_key_private_check() 41 if (BN_cmp(priv_key, BN_value_one()) < 0 in ossl_sm2_key_private_check() 42 || BN_cmp(priv_key, max) >= 0) { in ossl_sm2_key_private_check()
|