/external/boringssl/src/crypto/fipsmodule/ec/ |
D | ec_key.c | 172 EC_POINT_free(r->pub_key); in EC_KEY_free() 194 (src->pub_key != NULL && in EC_KEY_dup() 195 !EC_KEY_set_public_key(ret, src->pub_key)) || in EC_KEY_dup() 229 assert(key->pub_key == NULL); in EC_KEY_set_group() 261 return key->pub_key; in EC_KEY_get0_public_key() 264 int EC_KEY_set_public_key(EC_KEY *key, const EC_POINT *pub_key) { in EC_KEY_set_public_key() argument 270 if (pub_key != NULL && EC_GROUP_cmp(key->group, pub_key->group, NULL) != 0) { in EC_KEY_set_public_key() 275 EC_POINT_free(key->pub_key); in EC_KEY_set_public_key() 276 key->pub_key = EC_POINT_dup(pub_key, key->group); in EC_KEY_set_public_key() 277 return (key->pub_key == NULL) ? 0 : 1; in EC_KEY_set_public_key() [all …]
|
/external/rust/crates/quiche/deps/boringssl/src/crypto/fipsmodule/ec/ |
D | ec_key.c | 172 EC_POINT_free(r->pub_key); in EC_KEY_free() 194 (src->pub_key != NULL && in EC_KEY_dup() 195 !EC_KEY_set_public_key(ret, src->pub_key)) || in EC_KEY_dup() 229 assert(key->pub_key == NULL); in EC_KEY_set_group() 261 return key->pub_key; in EC_KEY_get0_public_key() 264 int EC_KEY_set_public_key(EC_KEY *key, const EC_POINT *pub_key) { in EC_KEY_set_public_key() argument 270 if (pub_key != NULL && EC_GROUP_cmp(key->group, pub_key->group, NULL) != 0) { in EC_KEY_set_public_key() 275 EC_POINT_free(key->pub_key); in EC_KEY_set_public_key() 276 key->pub_key = EC_POINT_dup(pub_key, key->group); in EC_KEY_set_public_key() 277 return (key->pub_key == NULL) ? 0 : 1; in EC_KEY_set_public_key() [all …]
|
/external/boringssl/src/crypto/fipsmodule/dh/ |
D | dh.c | 104 BN_clear_free(dh->pub_key); in DH_free() 111 const BIGNUM *DH_get0_pub_key(const DH *dh) { return dh->pub_key; } in DH_get0_pub_key() 124 *out_pub_key = dh->pub_key; in DH_get0_key() 131 int DH_set0_key(DH *dh, BIGNUM *pub_key, BIGNUM *priv_key) { in DH_set0_key() argument 132 if (pub_key != NULL) { in DH_set0_key() 133 BN_free(dh->pub_key); in DH_set0_key() 134 dh->pub_key = pub_key; in DH_set0_key() 191 BIGNUM *pub_key = NULL, *priv_key = NULL; in DH_generate_key() local 213 if (dh->pub_key == NULL) { in DH_generate_key() 214 pub_key = BN_new(); in DH_generate_key() [all …]
|
D | check.c | 62 int DH_check_pub_key(const DH *dh, const BIGNUM *pub_key, int *out_flags) { in DH_check_pub_key() argument 79 if (BN_cmp(pub_key, tmp) <= 0) { in DH_check_pub_key() 88 if (BN_cmp(pub_key, tmp) >= 0) { in DH_check_pub_key() 96 if (!BN_mod_exp_mont(tmp, pub_key, dh->q, dh->p, ctx, NULL)) { in DH_check_pub_key()
|
/external/openssh/openbsd-compat/ |
D | libressl-api-compat.c | 200 DSA_get0_key(const DSA *d, const BIGNUM **pub_key, const BIGNUM **priv_key) in DSA_get0_key() argument 202 if (pub_key != NULL) in DSA_get0_key() 203 *pub_key = d->pub_key; in DSA_get0_key() 211 DSA_set0_key(DSA *d, BIGNUM *pub_key, BIGNUM *priv_key) in DSA_set0_key() argument 213 if (d->pub_key == NULL && pub_key == NULL) in DSA_set0_key() 216 if (pub_key != NULL) { in DSA_set0_key() 217 BN_free(d->pub_key); in DSA_set0_key() 218 d->pub_key = pub_key; in DSA_set0_key() 489 DH_get0_key(const DH *dh, const BIGNUM **pub_key, const BIGNUM **priv_key) in DH_get0_key() argument 491 if (pub_key != NULL) in DH_get0_key() [all …]
|
/external/rust/crates/quiche/deps/boringssl/src/crypto/dh/ |
D | dh.c | 109 BN_clear_free(dh->pub_key); in DH_free() 116 const BIGNUM *DH_get0_pub_key(const DH *dh) { return dh->pub_key; } in DH_get0_pub_key() 129 *out_pub_key = dh->pub_key; in DH_get0_key() 136 int DH_set0_key(DH *dh, BIGNUM *pub_key, BIGNUM *priv_key) { in DH_set0_key() argument 137 if (pub_key != NULL) { in DH_set0_key() 138 BN_free(dh->pub_key); in DH_set0_key() 139 dh->pub_key = pub_key; in DH_set0_key() 310 BIGNUM *pub_key = NULL, *priv_key = NULL; in DH_generate_key() local 332 if (dh->pub_key == NULL) { in DH_generate_key() 333 pub_key = BN_new(); in DH_generate_key() [all …]
|
D | dh_test.cc | 158 BN_print_fp(stdout, a->pub_key); in RunBasicTests() 167 BN_print_fp(stdout, b->pub_key); in RunBasicTests() 171 int ret = DH_compute_key(key1.data(), b->pub_key, a.get()); in RunBasicTests() 184 ret = DH_compute_key(key2.data(), a->pub_key, b.get()); in RunBasicTests() 296 bssl::UniquePtr<BIGNUM> pub_key( in TestBadY() local 298 if (!dh || !pub_key || !DH_generate_key(dh.get())) { in TestBadY() 303 if (!DH_check_pub_key(dh.get(), pub_key.get(), &flags)) { in TestBadY() 312 if (DH_compute_key(result.data(), pub_key.get(), dh.get()) >= 0) { in TestBadY()
|
D | check.c | 62 int DH_check_pub_key(const DH *dh, const BIGNUM *pub_key, int *out_flags) { in DH_check_pub_key() argument 79 if (BN_cmp(pub_key, tmp) <= 0) { in DH_check_pub_key() 88 if (BN_cmp(pub_key, tmp) >= 0) { in DH_check_pub_key() 96 if (!BN_mod_exp_mont(tmp, pub_key, dh->q, dh->p, ctx, NULL)) { in DH_check_pub_key()
|
/external/python/rsa/rsa/ |
D | pkcs1.py | 164 def encrypt(message: bytes, pub_key: key.PublicKey) -> bytes: 186 keylength = common.byte_size(pub_key.n) 190 encrypted = core.encrypt_int(payload, pub_key.e, pub_key.n) 334 def verify(message: bytes, signature: bytes, pub_key: key.PublicKey) -> str: 349 keylength = common.byte_size(pub_key.n) 351 decrypted = core.decrypt_int(encrypted, pub_key.e, pub_key.n) 372 def find_signature_hash(signature: bytes, pub_key: key.PublicKey) -> str: 383 keylength = common.byte_size(pub_key.n) 385 decrypted = core.decrypt_int(encrypted, pub_key.e, pub_key.n)
|
D | cli.py | 67 (pub_key, priv_key) = rsa.newkeys(keysize) 72 data = pub_key.save_pkcs1(format=cli.form) 203 def perform_operation(self, indata: bytes, pub_key: rsa.key.AbstractKey, 206 assert isinstance(pub_key, rsa.key.PublicKey) 207 return rsa.encrypt(indata, pub_key) 271 def perform_operation(self, indata: bytes, pub_key: rsa.key.AbstractKey, 274 assert isinstance(pub_key, rsa.key.PublicKey) 282 rsa.verify(indata, signature, pub_key)
|
/external/python/cryptography/src/cryptography/hazmat/backends/openssl/ |
D | dh.py | 129 pub_key = self._backend._ffi.new("BIGNUM **") 131 self._backend._lib.DH_get0_key(self._dh_cdata, pub_key, priv_key) 132 self._backend.openssl_assert(pub_key[0] != self._backend._ffi.NULL) 141 y=self._backend._bn_to_int(pub_key[0]) 149 pub_key = self._backend._ffi.new("BIGNUM **") 150 self._backend._lib.DH_get0_key(peer_public_key._dh_cdata, pub_key, 152 self._backend.openssl_assert(pub_key[0] != self._backend._ffi.NULL) 155 pub_key[0], 175 pub_key = self._backend._ffi.new("BIGNUM **") 177 pub_key, self._backend._ffi.NULL) [all …]
|
D | dsa.py | 133 pub_key = self._backend._ffi.new("BIGNUM **") 139 self._backend._lib.DSA_get0_key(self._dsa_cdata, pub_key, priv_key) 140 self._backend.openssl_assert(pub_key[0] != self._backend._ffi.NULL) 149 y=self._backend._bn_to_int(pub_key[0]) 160 pub_key = self._backend._ffi.new("BIGNUM **") 162 self._dsa_cdata, pub_key, self._backend._ffi.NULL 164 self._backend.openssl_assert(pub_key[0] != self._backend._ffi.NULL) 165 pub_key_dup = self._backend._lib.BN_dup(pub_key[0]) 225 pub_key = self._backend._ffi.new("BIGNUM **") 231 self._dsa_cdata, pub_key, self._backend._ffi.NULL [all …]
|
/external/boringssl/src/crypto/dsa/ |
D | dsa.c | 120 BN_clear_free(dsa->pub_key); in DSA_free() 133 const BIGNUM *DSA_get0_pub_key(const DSA *dsa) { return dsa->pub_key; } in DSA_get0_pub_key() 146 *out_pub_key = dsa->pub_key; in DSA_get0_key() 166 int DSA_set0_key(DSA *dsa, BIGNUM *pub_key, BIGNUM *priv_key) { in DSA_set0_key() argument 167 if (dsa->pub_key == NULL && pub_key == NULL) { in DSA_set0_key() 171 if (pub_key != NULL) { in DSA_set0_key() 172 BN_free(dsa->pub_key); in DSA_set0_key() 173 dsa->pub_key = pub_key; in DSA_set0_key() 482 BIGNUM *pub_key = NULL, *priv_key = NULL; in DSA_generate_key() local 501 pub_key = dsa->pub_key; in DSA_generate_key() [all …]
|
/external/rust/crates/quiche/deps/boringssl/src/crypto/dsa/ |
D | dsa.c | 121 BN_clear_free(dsa->pub_key); in DSA_free() 134 const BIGNUM *DSA_get0_pub_key(const DSA *dsa) { return dsa->pub_key; } in DSA_get0_pub_key() 147 *out_pub_key = dsa->pub_key; in DSA_get0_key() 167 int DSA_set0_key(DSA *dsa, BIGNUM *pub_key, BIGNUM *priv_key) { in DSA_set0_key() argument 168 if (dsa->pub_key == NULL && pub_key == NULL) { in DSA_set0_key() 172 if (pub_key != NULL) { in DSA_set0_key() 173 BN_free(dsa->pub_key); in DSA_set0_key() 174 dsa->pub_key = pub_key; in DSA_set0_key() 483 BIGNUM *pub_key = NULL, *priv_key = NULL; in DSA_generate_key() local 502 pub_key = dsa->pub_key; in DSA_generate_key() [all …]
|
/external/rust/crates/quiche/deps/boringssl/src/crypto/evp/ |
D | p_dsa_asn1.c | 85 dsa->pub_key = BN_new(); in dsa_pub_decode() 86 if (dsa->pub_key == NULL) { in dsa_pub_decode() 90 if (!BN_parse_asn1_unsigned(key, dsa->pub_key) || in dsa_pub_decode() 118 !BN_marshal_asn1(&key_bitstring, dsa->pub_key) || in dsa_pub_encode() 139 dsa->pub_key = BN_new(); in dsa_priv_decode() 140 if (dsa->priv_key == NULL || dsa->pub_key == NULL) { in dsa_priv_decode() 154 !BN_mod_exp_mont_consttime(dsa->pub_key, dsa->g, dsa->priv_key, dsa->p, in dsa_priv_decode() 241 return BN_cmp(b->pkey.dsa->pub_key, a->pkey.dsa->pub_key) == 0; in dsa_pub_cmp()
|
/external/boringssl/src/crypto/evp/ |
D | p_dsa_asn1.c | 85 dsa->pub_key = BN_new(); in dsa_pub_decode() 86 if (dsa->pub_key == NULL) { in dsa_pub_decode() 90 if (!BN_parse_asn1_unsigned(key, dsa->pub_key) || in dsa_pub_decode() 118 !BN_marshal_asn1(&key_bitstring, dsa->pub_key) || in dsa_pub_encode() 139 dsa->pub_key = BN_new(); in dsa_priv_decode() 140 if (dsa->priv_key == NULL || dsa->pub_key == NULL) { in dsa_priv_decode() 158 !BN_mod_exp_mont_consttime(dsa->pub_key, dsa->g, dsa->priv_key, dsa->p, in dsa_priv_decode() 245 return BN_cmp(b->pkey.dsa->pub_key, a->pkey.dsa->pub_key) == 0; in dsa_pub_cmp()
|
/external/openssh/ |
D | kexdh.c | 116 const BIGNUM *pub_key; in kex_dh_keypair() local 122 DH_get0_key(kex->dh, &pub_key, NULL); in kex_dh_keypair() 125 if ((r = sshbuf_put_bignum2(buf, pub_key)) != 0 || in kex_dh_keypair() 131 BN_print_fp(stderr, pub_key); in kex_dh_keypair() 145 const BIGNUM *pub_key; in kex_dh_enc() local 154 DH_get0_key(kex->dh, &pub_key, NULL); in kex_dh_enc() 159 if ((r = sshbuf_put_bignum2(server_blob, pub_key)) != 0 || in kex_dh_enc()
|
D | kexgexc.c | 98 const BIGNUM *pub_key; in input_kex_dh_gex_group() local 121 DH_get0_key(kex->dh, &pub_key, NULL); in input_kex_dh_gex_group() 123 (r = sshpkt_put_bignum2(ssh, pub_key)) != 0 || in input_kex_dh_gex_group() 130 BN_print_fp(stderr, pub_key); in input_kex_dh_gex_group() 147 const BIGNUM *pub_key, *dh_p, *dh_g; in input_kex_dh_gex_reply() local 183 DH_get0_key(kex->dh, &pub_key, NULL); in input_kex_dh_gex_reply() 195 pub_key, in input_kex_dh_gex_reply()
|
/external/boringssl/src/crypto/dh_extra/ |
D | dh_test.cc | 159 BN_print_fp(stdout, a->pub_key); in RunBasicTests() 168 BN_print_fp(stdout, b->pub_key); in RunBasicTests() 172 int ret = DH_compute_key(key1.data(), b->pub_key, a.get()); in RunBasicTests() 185 ret = DH_compute_key(key2.data(), a->pub_key, b.get()); in RunBasicTests() 297 bssl::UniquePtr<BIGNUM> pub_key( in TestBadY() local 299 if (!dh || !pub_key || !DH_generate_key(dh.get())) { in TestBadY() 304 if (!DH_check_pub_key(dh.get(), pub_key.get(), &flags)) { in TestBadY() 313 if (DH_compute_key(result.data(), pub_key.get(), dh.get()) >= 0) { in TestBadY()
|
/external/boringssl/src/crypto/ec_extra/ |
D | ec_asn1.c | 131 ret->pub_key = EC_POINT_new(group); in EC_KEY_parse_private_key() 132 if (priv_key == NULL || ret->pub_key == NULL || in EC_KEY_parse_private_key() 149 !EC_POINT_oct2point(group, ret->pub_key, CBS_data(&public_key), in EC_KEY_parse_private_key() 162 if (!ec_point_mul_scalar_base(group, &ret->pub_key->raw, in EC_KEY_parse_private_key() 221 if (!(enc_flags & EC_PKEY_NO_PUBKEY) && key->pub_key != NULL) { in EC_KEY_marshal_private_key() 228 !EC_POINT_point2cbb(&public_key, key->group, key->pub_key, in EC_KEY_marshal_private_key() 505 if (ret->pub_key == NULL && in o2i_ECPublicKey() 506 (ret->pub_key = EC_POINT_new(ret->group)) == NULL) { in o2i_ECPublicKey() 510 if (!EC_POINT_oct2point(ret->group, ret->pub_key, *inp, len, NULL)) { in o2i_ECPublicKey() 529 buf_len = EC_POINT_point2oct(key->group, key->pub_key, key->conv_form, NULL, in i2o_ECPublicKey() [all …]
|
/external/boringssl/src/crypto/fipsmodule/ecdh/ |
D | ecdh.c | 80 int ECDH_compute_key_fips(uint8_t *out, size_t out_len, const EC_POINT *pub_key, in ECDH_compute_key_fips() argument 88 if (EC_GROUP_cmp(group, pub_key->group, NULL) != 0) { in ECDH_compute_key_fips() 96 if (!ec_point_mul_scalar(group, &shared_point, &pub_key->raw, priv) || in ECDH_compute_key_fips()
|
/external/rust/crates/quiche/deps/boringssl/src/crypto/fipsmodule/ecdh/ |
D | ecdh.c | 80 int ECDH_compute_key_fips(uint8_t *out, size_t out_len, const EC_POINT *pub_key, in ECDH_compute_key_fips() argument 88 if (EC_GROUP_cmp(group, pub_key->group, NULL) != 0) { in ECDH_compute_key_fips() 96 if (!ec_point_mul_scalar(group, &shared_point, &pub_key->raw, priv) || in ECDH_compute_key_fips()
|
/external/rust/crates/quiche/deps/boringssl/src/crypto/ec_extra/ |
D | ec_asn1.c | 131 ret->pub_key = EC_POINT_new(group); in EC_KEY_parse_private_key() 132 if (priv_key == NULL || ret->pub_key == NULL || in EC_KEY_parse_private_key() 149 !EC_POINT_oct2point(group, ret->pub_key, CBS_data(&public_key), in EC_KEY_parse_private_key() 162 if (!ec_point_mul_scalar_base(group, &ret->pub_key->raw, in EC_KEY_parse_private_key() 221 if (!(enc_flags & EC_PKEY_NO_PUBKEY) && key->pub_key != NULL) { in EC_KEY_marshal_private_key() 228 !EC_POINT_point2cbb(&public_key, key->group, key->pub_key, in EC_KEY_marshal_private_key() 520 if (ret->pub_key == NULL && in o2i_ECPublicKey() 521 (ret->pub_key = EC_POINT_new(ret->group)) == NULL) { in o2i_ECPublicKey() 525 if (!EC_POINT_oct2point(ret->group, ret->pub_key, *inp, len, NULL)) { in o2i_ECPublicKey() 544 buf_len = EC_POINT_point2oct(key->group, key->pub_key, key->conv_form, NULL, in i2o_ECPublicKey() [all …]
|
/external/boringssl/src/crypto/ecdh_extra/ |
D | ecdh_extra.c | 80 int ECDH_compute_key(void *out, size_t out_len, const EC_POINT *pub_key, in ECDH_compute_key() argument 90 if (EC_GROUP_cmp(group, pub_key->group, NULL) != 0) { in ECDH_compute_key() 98 if (!ec_point_mul_scalar(group, &shared_point, &pub_key->raw, priv) || in ECDH_compute_key()
|
/external/rust/crates/quiche/deps/boringssl/src/crypto/ecdh_extra/ |
D | ecdh_extra.c | 80 int ECDH_compute_key(void *out, size_t out_len, const EC_POINT *pub_key, in ECDH_compute_key() argument 90 if (EC_GROUP_cmp(group, pub_key->group, NULL) != 0) { in ECDH_compute_key() 98 if (!ec_point_mul_scalar(group, &shared_point, &pub_key->raw, priv) || in ECDH_compute_key()
|