/freebsd/crypto/openssl/crypto/dsa/ |
H A D | dsa_check.c | 66 int ossl_dsa_check_pub_key(const DSA *dsa, const BIGNUM *pub_key, int *ret) 71 return ossl_ffc_validate_public_key(&dsa->params, pub_key, ret) in ossl_dsa_check_pairwise() 80 int ossl_dsa_check_pub_key_partial(const DSA *dsa, const BIGNUM *pub_key, int *ret) in ossl_dsa_check_pairwise() 85 return ossl_ffc_validate_public_key_partial(&dsa->params, pub_key, ret) in ossl_dsa_check_pairwise() 107 BIGNUM *pub_key = NULL; 114 || dsa->pub_key == NULL) 120 pub_key = BN_new(); 121 if (pub_key == NULL) 125 if (!ossl_dsa_generate_public_key(ctx, dsa, dsa->priv_key, pub_key)) 128 ret = BN_cmp(pub_key, ds 40 ossl_dsa_check_pub_key(const DSA * dsa,const BIGNUM * pub_key,int * ret) ossl_dsa_check_pub_key() argument 51 ossl_dsa_check_pub_key_partial(const DSA * dsa,const BIGNUM * pub_key,int * ret) ossl_dsa_check_pub_key_partial() argument 73 BIGNUM *pub_key = NULL; ossl_dsa_check_pairwise() local [all...] |
H A D | dsa_key.c | 44 const BIGNUM *priv_key, BIGNUM *pub_key) in ossl_dsa_generate_public_key() argument 54 if (!BN_mod_exp(pub_key, dsa->params.g, prk, dsa->params.p, ctx)) in ossl_dsa_generate_public_key() 66 BIGNUM *pub_key = NULL, *priv_key = NULL; in dsa_keygen() local 93 if (dsa->pub_key == NULL) { in dsa_keygen() 94 if ((pub_key = BN_new()) == NULL) in dsa_keygen() 97 pub_key = dsa->pub_key; in dsa_keygen() 100 if (!ossl_dsa_generate_public_key(ctx, dsa, priv_key, pub_key)) in dsa_keygen() 104 dsa->pub_key = pub_key; in dsa_keygen() 119 BN_free(dsa->pub_key); in dsa_keygen() 121 dsa->pub_key = NULL; in dsa_keygen() [all …]
|
H A D | dsa_lib.c | 49 BIGNUM *pub_key = NULL, *priv_key = NULL; in DSA_dup_DH() local 60 if (r->pub_key != NULL) { in DSA_dup_DH() 61 pub_key = BN_dup(r->pub_key); in DSA_dup_DH() 62 if (pub_key == NULL) in DSA_dup_DH() 69 if (!DH_set0_key(ret, pub_key, priv_key)) in DSA_dup_DH() 79 BN_free(pub_key); in DSA_dup_DH() 236 BN_clear_free(r->pub_key); in DSA_free() 297 return d->pub_key; in DSA_get0_pub_key() 306 const BIGNUM **pub_key, const BIGNUM **priv_key) in DSA_get0_key() argument 308 if (pub_key != NULL) in DSA_get0_key() [all …]
|
H A D | dsa_backend.c | 34 BIGNUM *priv_key = NULL, *pub_key = NULL; in ossl_dsa_key_fromdata() local 50 if (param_pub_key != NULL && !OSSL_PARAM_get_BN(param_pub_key, &pub_key)) in ossl_dsa_key_fromdata() 55 if (!DSA_set0_key(dsa, pub_key, priv_key)) in ossl_dsa_key_fromdata() 62 BN_free(pub_key); in ossl_dsa_key_fromdata() 101 || !dsa_bn_dup_check(&dupkey->pub_key, dsa->pub_key))) in ossl_dsa_dup()
|
H A D | dsa_ameth.c | 70 if ((dsa->pub_key = ASN1_INTEGER_to_BN(public_key, NULL)) == NULL) { in dsa_pub_decode() 116 pubint = BN_to_ASN1_INTEGER(dsa->pub_key, NULL); in dsa_pub_encode() 264 return BN_cmp(b->pkey.dsa->pub_key, a->pkey.dsa->pub_key) == 0; in dsa_pub_cmp() 276 const BIGNUM *priv_key, *pub_key; in do_dsa_print() local 288 pub_key = x->pub_key; in do_dsa_print() 290 pub_key = NULL; in do_dsa_print() 311 if (!ASN1_bn_print(bp, "pub: ", pub_key, NULL, off)) in do_dsa_print() 436 const BIGNUM *q = DSA_get0_q(dsa), *pub_key = DSA_get0_pub_key(dsa); in dsa_pkey_export_to() local 454 if (pub_key != NULL) { in dsa_pkey_export_to() 456 pub_key)) in dsa_pkey_export_to()
|
/freebsd/crypto/libecc/src/sig/ |
H A D | ec_key.c | 139 int ec_pub_key_import_from_buf(ec_pub_key *pub_key, const ec_params *params, in ec_pub_key_import_from_buf() argument 145 MUST_HAVE(((pub_key != NULL) && (pub_key_buf != NULL) && (params != NULL)), ret, err); in ec_pub_key_import_from_buf() 148 ret = prj_pt_import_from_buf(&(pub_key->y), in ec_pub_key_import_from_buf() 161 ret = check_prj_pt_order(&(pub_key->y), &(params->ec_gen_order), PUBLIC_PT, &check); EG(ret, err); in ec_pub_key_import_from_buf() 166 pub_key->key_type = ec_key_alg; in ec_pub_key_import_from_buf() 167 pub_key->params = (const ec_params *)params; in ec_pub_key_import_from_buf() 168 pub_key->magic = PUB_KEY_MAGIC; in ec_pub_key_import_from_buf() 181 int ec_pub_key_import_from_aff_buf(ec_pub_key *pub_key, const ec_params *params, in ec_pub_key_import_from_aff_buf() argument 187 MUST_HAVE(((pub_key != NULL) && (pub_key_buf != NULL) && (params != NULL)), ret, err); in ec_pub_key_import_from_aff_buf() 190 ret = prj_pt_import_from_aff_buf(&(pub_key->y), in ec_pub_key_import_from_aff_buf() [all …]
|
H A D | eckcdsa.c | 205 const ec_pub_key *pub_key; in _eckcdsa_sign_init() local 221 pub_key = &(ctx->key_pair->pub_key); in _eckcdsa_sign_init() 222 p_len = (u8)BYTECEIL(pub_key->params->ec_fp.p_bitlen); in _eckcdsa_sign_init() 241 ret = prj_pt_to_aff(&y_aff, &(pub_key->y)); EG(ret, err); in _eckcdsa_sign_init() 246 dbg_pub_key_print("Y", pub_key); in _eckcdsa_sign_init() 262 PTR_NULLIFY(pub_key); in _eckcdsa_sign_init() 552 const ec_pub_key *pub_key; in _eckcdsa_verify_init() local 565 ret = pub_key_check_initialized_and_type(ctx->pub_key, ECKCDSA); EG(ret, err); in _eckcdsa_verify_init() 571 pub_key = ctx->pub_key; in _eckcdsa_verify_init() 572 p_len = (u8)BYTECEIL(pub_key->params->ec_fp.p_bitlen); in _eckcdsa_verify_init() [all …]
|
H A D | ecfsdsa.c | 159 dbg_pub_key_print("Y", &(ctx->key_pair->pub_key)); in _ecfsdsa_sign_init() 433 ret = pub_key_check_initialized_and_type(ctx->pub_key, ECFSDSA); EG(ret, err); in _ecfsdsa_verify_init() 439 q = &(ctx->pub_key->params->ec_gen_order); in _ecfsdsa_verify_init() 440 p_bit_len = ctx->pub_key->params->ec_fp.p_bitlen; in _ecfsdsa_verify_init() 441 q_bit_len = ctx->pub_key->params->ec_gen_order_bitlen; in _ecfsdsa_verify_init() 453 ret = fp_init(&rx, ctx->pub_key->params->ec_curve.a.ctx); EG(ret, err); in _ecfsdsa_verify_init() 455 ret = fp_init(&ry, ctx->pub_key->params->ec_curve.a.ctx); EG(ret, err); in _ecfsdsa_verify_init() 459 ret = is_on_shortw_curve(&rx, &ry, &(ctx->pub_key->params->ec_curve), &on_curve); EG(ret, err); in _ecfsdsa_verify_init() 569 G = &(ctx->pub_key->params->ec_gen); in _ecfsdsa_verify_finalize() 570 Y = &(ctx->pub_key->y); in _ecfsdsa_verify_finalize() [all …]
|
H A D | eddsa.c | 222 ret = eddsa_pub_key_sanity_check(&(key_pair->pub_key)); EG(ret, err); in eddsa_key_pair_sanity_check() 223 MUST_HAVE((key_pair->priv_key.key_type == key_pair->pub_key.key_type), ret, err); in eddsa_key_pair_sanity_check() 865 int eddsa_import_pub_key(ec_pub_key *pub_key, const u8 *buf, u16 buflen, argument 893 MUST_HAVE((pub_key != NULL) && (shortw_curve_params != NULL) && (buf != NULL), ret, err); 912 pub_key_y = &(pub_key->y); 939 ret = prj_pt_mul(&(pub_key->y), &tmp, pub_key_y); EG(ret, err1); 947 pub_key->key_type = sig_type; 948 pub_key->params = shortw_curve_params; 949 pub_key->magic = PUB_KEY_MAGIC; 952 ret = eddsa_pub_key_sanity_check(pub_key); [all …]
|
H A D | bip0340.c | 172 const ec_pub_key *pub_key; in _bip0340_sign() local 205 pub_key = &(key_pair->pub_key); in _bip0340_sign() 216 ret = prj_pt_copy(&Y, &(pub_key->y)); EG(ret, err); in _bip0340_sign() 362 PTR_NULLIFY(pub_key); in _bip0340_sign() 399 ret = pub_key_check_initialized_and_type(ctx->pub_key, BIP0340); EG(ret, err); in _bip0340_verify_init() 408 q = &(ctx->pub_key->params->ec_gen_order); in _bip0340_verify_init() 409 p_bit_len = ctx->pub_key->params->ec_fp.p_bitlen; in _bip0340_verify_init() 410 q_bit_len = ctx->pub_key->params->ec_gen_order_bitlen; in _bip0340_verify_init() 423 ret = prj_pt_copy(&Y, &(ctx->pub_key->y)); EG(ret, err); in _bip0340_verify_init() 427 ret = fp_init(rx, ctx->pub_key->params->ec_curve.a.ctx); EG(ret, err); in _bip0340_verify_init() [all …]
|
H A D | sm2.c | 137 const ec_pub_key *pub_key, hash_alg_type hash_type) in sm2_compute_Z() argument 149 MUST_HAVE((id != NULL) && (pub_key != NULL), ret, err); in sm2_compute_Z() 152 ret = pub_key_check_initialized_and_type(pub_key, SM2); EG(ret, err); in sm2_compute_Z() 162 G = &(pub_key->params->ec_gen); in sm2_compute_Z() 163 Y = &(pub_key->y); in sm2_compute_Z() 164 p_bit_len = pub_key->params->ec_fp.p_bitlen; in sm2_compute_Z() 167 a = &(pub_key->params->ec_curve.a); in sm2_compute_Z() 168 b = &(pub_key->params->ec_curve.b); in sm2_compute_Z() 273 &(ctx->key_pair->pub_key), ctx->h->type); EG(ret, err); in _sm2_sign_init() 354 dbg_pub_key_print("Y", &(ctx->key_pair->pub_key)); in _sm2_sign_finalize() [all …]
|
/freebsd/crypto/openssl/crypto/ec/ |
H A D | ec_key.c | 98 EC_POINT_free(r->pub_key); in EC_KEY_free() 135 if (src->pub_key != NULL) { in EC_KEY_copy() 136 EC_POINT_free(dest->pub_key); in EC_KEY_copy() 137 dest->pub_key = EC_POINT_new(src->group); in EC_KEY_copy() 138 if (dest->pub_key == NULL) in EC_KEY_copy() 140 if (!EC_POINT_copy(dest->pub_key, src->pub_key)) in EC_KEY_copy() 257 EC_POINT *pub_key = NULL; in ec_generate_key() local 307 if (eckey->pub_key == NULL) { in ec_generate_key() 308 pub_key = EC_POINT_new(group); in ec_generate_key() 309 if (pub_key == NULL) in ec_generate_key() [all …]
|
/freebsd/crypto/openssl/crypto/dh/ |
H A D | dh_key.c | 40 int ossl_dh_compute_key(unsigned char *key, const BIGNUM *pub_key, DH *dh) in ossl_dh_compute_key() argument 86 if (!dh->meth->bn_mod_exp(dh, z, pub_key, dh->priv_key, dh->params.p, ctx, in ossl_dh_compute_key() 114 int DH_compute_key(unsigned char *key, const BIGNUM *pub_key, DH *dh) in DH_compute_key() argument 121 ret = ossl_dh_compute_key(key, pub_key, dh); in DH_compute_key() 123 ret = dh->meth->compute_key(key, pub_key, dh); in DH_compute_key() 144 int DH_compute_key_padded(unsigned char *key, const BIGNUM *pub_key, DH *dh) in DH_compute_key_padded() argument 150 rv = ossl_dh_compute_key(key, pub_key, dh); in DH_compute_key_padded() 152 rv = dh->meth->compute_key(key, pub_key, dh); in DH_compute_key_padded() 226 const BIGNUM *priv_key, BIGNUM *pub_key) in ossl_dh_generate_public_key() argument 252 if (!dh->meth->bn_mod_exp(dh, pub_key, dh->params.g, prk, dh->params.p, in ossl_dh_generate_public_key() [all …]
|
H A D | dh_check.c | 230 int DH_check_pub_key_ex(const DH *dh, const BIGNUM *pub_key) in DH_check_pub_key_ex() argument 234 if (!DH_check_pub_key(dh, pub_key, &errflags)) in DH_check_pub_key_ex() 250 int DH_check_pub_key(const DH *dh, const BIGNUM *pub_key, int *ret) in DH_check_pub_key() argument 264 return ossl_ffc_validate_public_key(&dh->params, pub_key, ret); in DH_check_pub_key() 272 int ossl_dh_check_pub_key_partial(const DH *dh, const BIGNUM *pub_key, int *ret) in ossl_dh_check_pub_key_partial() argument 274 return ossl_ffc_validate_public_key_partial(&dh->params, pub_key, ret) in ossl_dh_check_pub_key_partial() 336 BIGNUM *pub_key = NULL; in ossl_dh_check_pairwise() local 341 || dh->pub_key == NULL) in ossl_dh_check_pairwise() 347 pub_key = BN_new(); in ossl_dh_check_pairwise() 348 if (pub_key == NULL) in ossl_dh_check_pairwise() [all …]
|
H A D | dh_ameth.c | 96 if ((dh->pub_key = ASN1_INTEGER_to_BN(public_key, NULL)) == NULL) { in dh_pub_decode() 118 ASN1_INTEGER *pub_key = NULL; in dh_pub_encode() local 134 pub_key = BN_to_ASN1_INTEGER(dh->pub_key, NULL); in dh_pub_encode() 135 if (pub_key == NULL) in dh_pub_encode() 138 penclen = i2d_ASN1_INTEGER(pub_key, &penc); in dh_pub_encode() 140 ASN1_INTEGER_free(pub_key); in dh_pub_encode() 248 BIGNUM *priv_key, *pub_key; in do_dh_print() local 256 pub_key = x->pub_key; in do_dh_print() 258 pub_key = NULL; in do_dh_print() 261 || (ptype > 0 && pub_key == NULL)) { in do_dh_print() [all …]
|
H A D | dh_lib.c | 158 BN_clear_free(r->pub_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 257 if (pub_key != NULL) in DH_get0_key() 258 *pub_key = dh->pub_key; in DH_get0_key() 263 int DH_set0_key(DH *dh, BIGNUM *pub_key, BIGNUM *priv_key) in DH_set0_key() argument 265 if (pub_key != NULL) { in DH_set0_key() 266 BN_clear_free(dh->pub_key); in DH_set0_key() 267 dh->pub_key = pub_key; in DH_set0_key() 300 return dh->pub_key; in DH_get0_pub_key()
|
H A D | dh_backend.c | 69 BIGNUM *priv_key = NULL, *pub_key = NULL; in ossl_dh_key_fromdata() local 83 && !OSSL_PARAM_get_BN(param_pub_key, &pub_key)) in ossl_dh_key_fromdata() 86 if (!DH_set0_key(dh, pub_key, priv_key)) in ossl_dh_key_fromdata() 93 BN_free(pub_key); in ossl_dh_key_fromdata() 165 || !dh_bn_dup_check(&dupkey->pub_key, dh->pub_key))) in ossl_dh_dup()
|
/freebsd/crypto/libecc/include/libecc/sig/ |
H A D | ec_key.h | 135 #define EC_PUB_KEY_EXPORT_SIZE(pub_key) \ argument 136 (3 * BYTECEIL((pub_key)->params->ec_curve.a.ctx->p_bitlen)) 142 #define EC_STRUCTURED_PUB_KEY_EXPORT_SIZE(pub_key) \ argument 143 ((u8)(EC_PUB_KEY_EXPORT_SIZE(pub_key) + (u8)(3 * sizeof(u8)))) 149 ATTRIBUTE_WARN_UNUSED_RET int ec_pub_key_import_from_buf(ec_pub_key *pub_key, const ec_params *para… 152 ATTRIBUTE_WARN_UNUSED_RET int ec_pub_key_export_to_buf(const ec_pub_key *pub_key, u8 *pub_key_buf, 155 ATTRIBUTE_WARN_UNUSED_RET int ec_pub_key_import_from_aff_buf(ec_pub_key *pub_key, const ec_params *… 159 ATTRIBUTE_WARN_UNUSED_RET int ec_pub_key_export_to_aff_buf(const ec_pub_key *pub_key, u8 *pub_key_b… 162 ATTRIBUTE_WARN_UNUSED_RET int ec_structured_pub_key_import_from_buf(ec_pub_key *pub_key, 167 ATTRIBUTE_WARN_UNUSED_RET int ec_structured_pub_key_export_to_buf(const ec_pub_key *pub_key, [all …]
|
/freebsd/crypto/openssl/util/perl/TLSProxy/ |
H A D | ServerKeyExchange.pm | 35 $self->{pub_key} = ""; 65 my $pub_key = substr($self->data, $ptr, $pub_key_len); 88 $self->pub_key($pub_key); 104 $data .= pack('n', length($self->pub_key)); 105 $data .= $self->pub_key; 133 sub pub_key subroutine 137 $self->{pub_key} = shift; 139 return $self->{pub_key};
|
/freebsd/crypto/openssl/crypto/ffc/ |
H A D | ffc_key_validate.c | 20 const BIGNUM *pub_key, int *ret) in ossl_ffc_validate_public_key_partial() argument 27 if (params == NULL || pub_key == NULL || params->p == NULL) { in ossl_ffc_validate_public_key_partial() 42 if (BN_cmp(pub_key, tmp) <= 0) in ossl_ffc_validate_public_key_partial() 48 if (BN_cmp(pub_key, tmp) >= 0) in ossl_ffc_validate_public_key_partial() 63 const BIGNUM *pub_key, int *ret) in ossl_ffc_validate_public_key() argument 69 if (!ossl_ffc_validate_public_key_partial(params, pub_key, ret)) in ossl_ffc_validate_public_key() 81 || !BN_mod_exp(tmp, pub_key, params->q, params->p, ctx)) in ossl_ffc_validate_public_key()
|
/freebsd/crypto/openssh/ |
H A D | kexdh.c | 117 const BIGNUM *pub_key; in kex_dh_keypair() local 123 DH_get0_key(kex->dh, &pub_key, NULL); in kex_dh_keypair() 126 if ((r = sshbuf_put_bignum2(buf, pub_key)) != 0 || in kex_dh_keypair() 132 BN_print_fp(stderr, pub_key); in kex_dh_keypair() 146 const BIGNUM *pub_key; in kex_dh_enc() local 155 DH_get0_key(kex->dh, &pub_key, NULL); in kex_dh_enc() 160 if ((r = sshbuf_put_bignum2(server_blob, pub_key)) != 0 || in kex_dh_enc()
|
H A D | kexgexc.c | 99 const BIGNUM *pub_key; in input_kex_dh_gex_group() local 123 DH_get0_key(kex->dh, &pub_key, NULL); in input_kex_dh_gex_group() 125 (r = sshpkt_put_bignum2(ssh, pub_key)) != 0 || in input_kex_dh_gex_group() 132 BN_print_fp(stderr, pub_key); in input_kex_dh_gex_group() 149 const BIGNUM *pub_key, *dh_p, *dh_g; in input_kex_dh_gex_reply() local 187 DH_get0_key(kex->dh, &pub_key, NULL); in input_kex_dh_gex_reply() 199 pub_key, in input_kex_dh_gex_reply()
|
/freebsd/crypto/openssl/apps/ |
H A D | testdsa.h | 219 BIGNUM *priv_key, *pub_key, *p, *q, *g; in get_dsa() local 243 pub_key = BN_bin2bn(dsa_t.pub, dsa_t.pub_l, NULL); in get_dsa() 247 if (priv_key == NULL || pub_key == NULL || p == NULL || q == NULL in get_dsa() 261 pub_key) in get_dsa() 273 BN_free(pub_key); in get_dsa()
|
/freebsd/contrib/ntp/libntp/ |
H A D | libssl_compat.c | 303 *ppub_key = pdsa->pub_key; in sslshim_DSA_get0_key() 311 BIGNUM * pub_key, in sslshim_DSA_set0_key() argument 316 if (!(pdsa->pub_key || pub_key)) in sslshim_DSA_set0_key() 319 replace_bn_nn(&pdsa->pub_key, pub_key); in sslshim_DSA_set0_key()
|
/freebsd/crypto/libecc/src/tests/ |
H A D | ec_self_tests_core.c | 77 pub_key_buf_len = EC_STRUCTURED_PUB_KEY_EXPORT_SIZE(&(kp->pub_key)); in ec_gen_import_export_kp() 81 ret = ec_structured_pub_key_export_to_buf(&(kp->pub_key), pub_key_buf, in ec_gen_import_export_kp() 96 ret = ec_structured_pub_key_import_from_buf(&(imported_kp.pub_key), in ec_gen_import_export_kp() 173 …N_UNUSED_RET static int random_split_ec_verify(const u8 *sig, u8 siglen, const ec_pub_key *pub_key, in random_split_ec_verify() argument 183 ret = ec_verify_init(&ctx, pub_key, sig, siglen, sig_type, hash_type, adata, adata_len); in random_split_ec_verify() 336 ret = ec_verify(sig, siglen, &(kp.pub_key), msg, msglen, in ec_import_export_test() 347 ret = ec_verify(sig_tmp2, siglen, &(kp.pub_key), msg, msglen, in ec_import_export_test() 351 ret = ec_verify(sig, siglen, &(kp.pub_key), msg, msglen, in ec_import_export_test() 360 ret = random_split_ec_verify(sig_tmp1, siglen, &(kp.pub_key), msg, msglen, in ec_import_export_test() 364 ret = random_split_ec_verify(sig, siglen, &(kp.pub_key), msg, msglen, in ec_import_export_test() [all …]
|