Home
last modified time | relevance | path

Searched refs:pkey (Results 1 – 25 of 174) sorted by relevance

1234567

/openbsd/src/lib/libcrypto/evp/
Dp_lib.c256 EVP_PKEY_get0_asn1(const EVP_PKEY *pkey) in EVP_PKEY_get0_asn1() argument
258 return pkey->ameth; in EVP_PKEY_get0_asn1()
263 EVP_PKEY_bits(const EVP_PKEY *pkey) in EVP_PKEY_bits() argument
265 if (pkey && pkey->ameth && pkey->ameth->pkey_bits) in EVP_PKEY_bits()
266 return pkey->ameth->pkey_bits(pkey); in EVP_PKEY_bits()
272 EVP_PKEY_security_bits(const EVP_PKEY *pkey) in EVP_PKEY_security_bits() argument
274 if (pkey == NULL) in EVP_PKEY_security_bits()
276 if (pkey->ameth == NULL || pkey->ameth->pkey_security_bits == NULL) in EVP_PKEY_security_bits()
279 return pkey->ameth->pkey_security_bits(pkey); in EVP_PKEY_security_bits()
284 EVP_PKEY_size(const EVP_PKEY *pkey) in EVP_PKEY_size() argument
[all …]
Devp_pkey.c74 EVP_PKEY *pkey = NULL; in EVP_PKCS82PKEY() local
81 if (!(pkey = EVP_PKEY_new())) { in EVP_PKCS82PKEY()
86 if (!EVP_PKEY_set_type(pkey, OBJ_obj2nid(algoid))) { in EVP_PKCS82PKEY()
94 if (pkey->ameth->priv_decode) { in EVP_PKCS82PKEY()
95 if (!pkey->ameth->priv_decode(pkey, p8)) { in EVP_PKCS82PKEY()
104 return pkey; in EVP_PKCS82PKEY()
107 EVP_PKEY_free(pkey); in EVP_PKCS82PKEY()
115 EVP_PKEY2PKCS8(EVP_PKEY *pkey) in EVP_PKEY2PKCS8() argument
124 if (pkey->ameth) { in EVP_PKEY2PKCS8()
125 if (pkey->ameth->priv_encode) { in EVP_PKEY2PKCS8()
[all …]
/openbsd/src/lib/libcrypto/ec/
Decx_methods.c201 ecx_pub_decode(EVP_PKEY *pkey, X509_PUBKEY *xpubkey) in ecx_pub_decode() argument
222 if (param == NULL || param_len != ecx_key_len(pkey->ameth->pkey_id)) { in ecx_pub_decode()
227 if ((ecx_key = ecx_key_new(pkey->ameth->pkey_id)) == NULL) in ecx_pub_decode()
231 if (!EVP_PKEY_assign(pkey, pkey->ameth->pkey_id, ecx_key)) in ecx_pub_decode()
244 ecx_pub_encode(X509_PUBKEY *xpubkey, const EVP_PKEY *pkey) in ecx_pub_encode() argument
246 const struct ecx_key_st *ecx_key = pkey->pkey.ecx; in ecx_pub_encode()
261 if ((aobj = OBJ_nid2obj(pkey->ameth->pkey_id)) == NULL) in ecx_pub_encode()
286 if (pkey1->pkey.ecx == NULL || pkey1->pkey.ecx->pub_key == NULL) in ecx_pub_cmp()
288 if (pkey2->pkey.ecx == NULL || pkey2->pkey.ecx->pub_key == NULL) in ecx_pub_cmp()
290 if (pkey1->pkey.ecx->pub_key_len != pkey2->pkey.ecx->pub_key_len) in ecx_pub_cmp()
[all …]
Dec_ameth.c229 eckey_pub_encode(X509_PUBKEY *pk, const EVP_PKEY *pkey) in eckey_pub_encode() argument
231 EC_KEY *eckey = pkey->pkey.ec; in eckey_pub_encode()
265 eckey_pub_decode(EVP_PKEY *pkey, X509_PUBKEY *pubkey) in eckey_pub_decode() argument
285 if (!EVP_PKEY_assign_EC_KEY(pkey, eckey)) in eckey_pub_decode()
300 const EC_GROUP *group = EC_KEY_get0_group(b->pkey.ec); in eckey_pub_cmp()
301 const EC_POINT *pa = EC_KEY_get0_public_key(a->pkey.ec); in eckey_pub_cmp()
302 const EC_POINT *pb = EC_KEY_get0_public_key(b->pkey.ec); in eckey_pub_cmp()
341 eckey_priv_decode(EVP_PKEY *pkey, const PKCS8_PRIV_KEY_INFO *p8) in eckey_priv_decode() argument
369 if (!EVP_PKEY_assign_EC_KEY(pkey, eckey)) in eckey_priv_decode()
382 eckey_priv_encode(PKCS8_PRIV_KEY_INFO *p8, const EVP_PKEY *pkey) in eckey_priv_encode() argument
[all …]
Dec_pmeth.c169 EC_KEY *ec = ctx->pkey->pkey.ec; in pkey_ec_sign()
197 EC_KEY *ec = ctx->pkey->pkey.ec; in pkey_ec_verify()
218 if (!ctx->pkey || !ctx->peerkey) { in pkey_ec_derive()
223 eckey = dctx->co_key ? dctx->co_key : ctx->pkey->pkey.ec; in pkey_ec_derive()
230 pubkey = EC_KEY_get0_public_key(ctx->peerkey->pkey.ec); in pkey_ec_derive()
315 EC_KEY *ec_key = ctx->pkey->pkey.ec; in pkey_ec_ctrl()
322 EC_KEY *ec_key = ctx->pkey->pkey.ec; in pkey_ec_ctrl()
465 pkey_ec_paramgen(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey) in pkey_ec_paramgen() argument
480 if (!EVP_PKEY_assign_EC_KEY(pkey, ec)) in pkey_ec_paramgen()
493 pkey_ec_keygen(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey) in pkey_ec_keygen() argument
[all …]
/openbsd/src/lib/libcrypto/dh/
Ddh_ameth.c73 dh_free(EVP_PKEY *pkey) in dh_free() argument
75 DH_free(pkey->pkey.dh); in dh_free()
79 dh_pub_decode(EVP_PKEY *pkey, X509_PUBKEY *pubkey) in dh_pub_decode() argument
120 if (!EVP_PKEY_assign_DH(pkey, dh)) in dh_pub_decode()
134 dh_pub_encode(X509_PUBKEY *pk, const EVP_PKEY *pkey) in dh_pub_encode() argument
136 const DH *dh = pkey->pkey.dh; in dh_pub_encode()
192 dh_priv_decode(EVP_PKEY *pkey, const PKCS8_PRIV_KEY_INFO *p8) in dh_priv_decode() argument
235 if (!EVP_PKEY_assign_DH(pkey, dh)) in dh_priv_decode()
249 dh_priv_encode(PKCS8_PRIV_KEY_INFO *p8, const EVP_PKEY *pkey) in dh_priv_encode() argument
251 const DH *dh = pkey->pkey.dh; in dh_priv_encode()
[all …]
Ddh_pmeth.c176 pkey_dh_paramgen(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey) in pkey_dh_paramgen() argument
192 if (!EVP_PKEY_assign_DH(pkey, dh)) in pkey_dh_paramgen()
204 pkey_dh_keygen(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey) in pkey_dh_keygen() argument
209 if (ctx->pkey == NULL) { in pkey_dh_keygen()
216 if (!EVP_PKEY_set1_DH(pkey, dh)) in pkey_dh_keygen()
219 if (!EVP_PKEY_copy_parameters(pkey, ctx->pkey)) in pkey_dh_keygen()
237 if (!ctx->pkey || !ctx->peerkey) { in pkey_dh_derive()
241 ret = DH_compute_key(key, ctx->peerkey->pkey.dh->pub_key, in pkey_dh_derive()
242 ctx->pkey->pkey.dh); in pkey_dh_derive()
/openbsd/src/lib/libcrypto/dsa/
Ddsa_ameth.c77 dsa_pub_decode(EVP_PKEY *pkey, X509_PUBKEY *pubkey) in dsa_pub_decode() argument
130 if (!EVP_PKEY_assign_DSA(pkey, dsa)) in dsa_pub_decode()
144 dsa_pub_encode(X509_PUBKEY *pk, const EVP_PKEY *pkey) in dsa_pub_encode() argument
146 const DSA *dsa = pkey->pkey.dsa; in dsa_pub_encode()
155 if (pkey->save_parameters > 0 && !EVP_PKEY_missing_parameters(pkey)) { in dsa_pub_encode()
205 dsa_priv_decode(EVP_PKEY *pkey, const PKCS8_PRIV_KEY_INFO *p8) in dsa_priv_decode() argument
270 if (!EVP_PKEY_assign_DSA(pkey, dsa)) in dsa_priv_decode()
286 dsa_priv_encode(PKCS8_PRIV_KEY_INFO *p8, const EVP_PKEY *pkey) in dsa_priv_encode() argument
288 const DSA *dsa = pkey->pkey.dsa; in dsa_priv_encode()
340 dsa_size(const EVP_PKEY *pkey) in dsa_size() argument
[all …]
/openbsd/src/regress/lib/libcrypto/evp/
Devp_ecx_test.c139 EVP_PKEY *pkey = NULL; in ecx_ed25519_keygen_test() local
152 if (EVP_PKEY_keygen(pkey_ctx, &pkey) <= 0) { in ecx_ed25519_keygen_test()
159 if (!PEM_write_bio_PrivateKey(bio, pkey, NULL, NULL, 0, NULL, NULL)) { in ecx_ed25519_keygen_test()
169 EVP_PKEY_free(pkey); in ecx_ed25519_keygen_test()
177 EVP_PKEY *pkey = NULL; in ecx_ed25519_raw_key_test() local
192 if ((pkey = PEM_read_bio_PrivateKey(bio, NULL, NULL, NULL)) == NULL) { in ecx_ed25519_raw_key_test()
198 if (!EVP_PKEY_get_raw_private_key(pkey, NULL, &priv_key_len)) { in ecx_ed25519_raw_key_test()
210 if (!EVP_PKEY_get_raw_private_key(pkey, priv_key, &priv_key_len)) { in ecx_ed25519_raw_key_test()
223 if (!EVP_PKEY_get_raw_public_key(pkey, NULL, &pub_key_len)) { in ecx_ed25519_raw_key_test()
235 if (!EVP_PKEY_get_raw_public_key(pkey, pub_key, &pub_key_len)) { in ecx_ed25519_raw_key_test()
[all …]
/openbsd/src/usr.sbin/acme-client/
Dkey.c43 EVP_PKEY *pkey = NULL; in rsa_key_create() local
57 if (EVP_PKEY_keygen(ctx, &pkey) <= 0) { in rsa_key_create()
64 if (!PEM_write_PrivateKey(f, pkey, NULL, NULL, 0, NULL, NULL)) { in rsa_key_create()
70 return pkey; in rsa_key_create()
73 EVP_PKEY_free(pkey); in rsa_key_create()
82 EVP_PKEY *pkey = NULL; in ec_key_create() local
96 if (EVP_PKEY_keygen(ctx, &pkey) <= 0) { in ec_key_create()
103 if (!PEM_write_PrivateKey(f, pkey, NULL, NULL, 0, NULL, NULL)) { in ec_key_create()
109 return pkey; in ec_key_create()
112 EVP_PKEY_free(pkey); in ec_key_create()
[all …]
Dacctproc.c77 op_thumb_rsa(EVP_PKEY *pkey) in op_thumb_rsa() argument
82 if ((r = EVP_PKEY_get0_RSA(pkey)) == NULL) in op_thumb_rsa()
101 op_thumb_ec(EVP_PKEY *pkey) in op_thumb_ec() argument
108 if ((ec = EVP_PKEY_get0_EC_KEY(pkey)) == NULL) in op_thumb_ec()
135 op_thumbprint(int fd, EVP_PKEY *pkey) in op_thumbprint() argument
144 switch (EVP_PKEY_base_id(pkey)) { in op_thumbprint()
146 if ((thumb = op_thumb_rsa(pkey)) != NULL) in op_thumbprint()
150 if ((thumb = op_thumb_ec(pkey)) != NULL) in op_thumbprint()
185 op_sign_rsa(char **prot, EVP_PKEY *pkey, const char *nonce, const char *url) in op_sign_rsa() argument
198 if ((r = EVP_PKEY_get0_RSA(pkey)) == NULL) in op_sign_rsa()
[all …]
/openbsd/src/lib/libcrypto/pkcs12/
Dp12_kiss.c69 EVP_PKEY **pkey, STACK_OF(X509) *ocerts);
72 int passlen, EVP_PKEY **pkey, STACK_OF(X509) *ocerts);
75 EVP_PKEY **pkey, STACK_OF(X509) *ocerts);
84 PKCS12_parse(PKCS12 *p12, const char *pass, EVP_PKEY **pkey, X509 **cert, in PKCS12_parse() argument
90 if (pkey != NULL) in PKCS12_parse()
91 *pkey = NULL; in PKCS12_parse()
128 if (!parse_pk12(p12, pass, -1, pkey, ocerts)) { in PKCS12_parse()
134 if (pkey != NULL && *pkey != NULL && in PKCS12_parse()
137 if (X509_check_private_key(x, *pkey)) { in PKCS12_parse()
162 if (pkey != NULL) in PKCS12_parse()
[all …]
/openbsd/src/lib/libssl/
Dssl_rsa.c72 static int ssl_set_pkey(SSL_CTX *ctx, SSL *ssl, EVP_PKEY *pkey);
153 EVP_PKEY *pkey = NULL; in SSL_use_RSAPrivateKey() local
160 if ((pkey = EVP_PKEY_new()) == NULL) { in SSL_use_RSAPrivateKey()
164 if (!EVP_PKEY_set1_RSA(pkey, rsa)) in SSL_use_RSAPrivateKey()
166 if (!ssl_set_pkey(NULL, ssl, pkey)) in SSL_use_RSAPrivateKey()
172 EVP_PKEY_free(pkey); in SSL_use_RSAPrivateKey()
179 ssl_set_pkey(SSL_CTX *ctx, SSL *ssl, EVP_PKEY *pkey) in ssl_set_pkey() argument
184 i = ssl_cert_type(pkey); in ssl_set_pkey()
204 EVP_PKEY_copy_parameters(pktmp, pkey); in ssl_set_pkey()
212 if (EVP_PKEY_id(pkey) != EVP_PKEY_RSA || in ssl_set_pkey()
[all …]
Dssl_sigalgs.c251 ssl_sigalg_for_legacy(SSL *s, EVP_PKEY *pkey) in ssl_sigalg_for_legacy() argument
257 switch (EVP_PKEY_id(pkey)) { in ssl_sigalg_for_legacy()
270 ssl_sigalg_pkey_ok(SSL *s, const struct ssl_sigalg *sigalg, EVP_PKEY *pkey) in ssl_sigalg_pkey_ok() argument
272 if (sigalg == NULL || pkey == NULL) in ssl_sigalg_pkey_ok()
274 if (sigalg->key_type != EVP_PKEY_id(pkey)) in ssl_sigalg_pkey_ok()
279 if (EVP_PKEY_id(pkey) != EVP_PKEY_RSA || in ssl_sigalg_pkey_ok()
280 EVP_PKEY_size(pkey) < (2 * EVP_MD_size(sigalg->md()) + 2)) in ssl_sigalg_pkey_ok()
284 if (!ssl_security_sigalg_check(s, pkey)) in ssl_sigalg_pkey_ok()
296 if (EVP_PKEY_id(pkey) == EVP_PKEY_EC) { in ssl_sigalg_pkey_ok()
300 EVP_PKEY_get0_EC_KEY(pkey))) != sigalg->group_nid) in ssl_sigalg_pkey_ok()
[all …]
/openbsd/src/lib/libcrypto/hmac/
Dhm_ameth.c75 return ASN1_OCTET_STRING_cmp(a->pkey.ptr, b->pkey.ptr) == 0; in hmac_pkey_public_cmp()
79 hmac_size(const EVP_PKEY *pkey) in hmac_size() argument
85 hmac_key_free(EVP_PKEY *pkey) in hmac_key_free() argument
89 if ((os = pkey->pkey.ptr) == NULL) in hmac_key_free()
99 hmac_pkey_ctrl(EVP_PKEY *pkey, int op, long arg1, void *arg2) in hmac_pkey_ctrl() argument
111 hmac_set_priv_key(EVP_PKEY *pkey, const unsigned char *priv, size_t len) in hmac_set_priv_key() argument
115 if (pkey->pkey.ptr != NULL) in hmac_set_priv_key()
127 pkey->pkey.ptr = os; in hmac_set_priv_key()
138 hmac_get_priv_key(const EVP_PKEY *pkey, unsigned char *priv, size_t *len) in hmac_get_priv_key() argument
143 if ((os = pkey->pkey.ptr) == NULL) in hmac_get_priv_key()
/openbsd/src/lib/libfido2/src/
Deddsa.c29 EVP_PKEY_get_raw_public_key(const EVP_PKEY *pkey, unsigned char *pub, in EVP_PKEY_get_raw_public_key() argument
32 (void)pkey; in EVP_PKEY_get_raw_public_key()
125 EVP_PKEY *pkey; in eddsa_pk_from_ptr() local
132 if ((pkey = eddsa_pk_to_EVP_PKEY(pk)) == NULL) { in eddsa_pk_from_ptr()
137 EVP_PKEY_free(pkey); in eddsa_pk_from_ptr()
145 EVP_PKEY *pkey = NULL; in eddsa_pk_to_EVP_PKEY() local
147 if ((pkey = EVP_PKEY_new_raw_public_key(EVP_PKEY_ED25519, NULL, k->x, in eddsa_pk_to_EVP_PKEY()
151 return (pkey); in eddsa_pk_to_EVP_PKEY()
155 eddsa_pk_from_EVP_PKEY(eddsa_pk_t *pk, const EVP_PKEY *pkey) in eddsa_pk_from_EVP_PKEY() argument
159 if (EVP_PKEY_base_id(pkey) != EVP_PKEY_ED25519) in eddsa_pk_from_EVP_PKEY()
[all …]
Drs256.c99 EVP_PKEY *pkey; in rs256_pk_from_ptr() local
106 if ((pkey = rs256_pk_to_EVP_PKEY(pk)) == NULL) { in rs256_pk_from_ptr()
111 EVP_PKEY_free(pkey); in rs256_pk_from_ptr()
120 EVP_PKEY *pkey = NULL; in rs256_pk_to_EVP_PKEY() local
148 if ((pkey = EVP_PKEY_new()) == NULL || in rs256_pk_to_EVP_PKEY()
149 EVP_PKEY_assign_RSA(pkey, rsa) == 0) { in rs256_pk_to_EVP_PKEY()
164 if (ok < 0 && pkey != NULL) { in rs256_pk_to_EVP_PKEY()
165 EVP_PKEY_free(pkey); in rs256_pk_to_EVP_PKEY()
166 pkey = NULL; in rs256_pk_to_EVP_PKEY()
169 return (pkey); in rs256_pk_to_EVP_PKEY()
[all …]
Des256.c182 EVP_PKEY *pkey; in es256_pk_from_ptr() local
192 if ((pkey = es256_pk_to_EVP_PKEY(pk)) == NULL) { in es256_pk_from_ptr()
198 EVP_PKEY_free(pkey); in es256_pk_from_ptr()
273 EVP_PKEY *pkey = NULL; in es256_pk_to_EVP_PKEY() local
307 if ((pkey = EVP_PKEY_new()) == NULL || in es256_pk_to_EVP_PKEY()
308 EVP_PKEY_assign_EC_KEY(pkey, ec) == 0) { in es256_pk_to_EVP_PKEY()
327 if (ok < 0 && pkey != NULL) { in es256_pk_to_EVP_PKEY()
328 EVP_PKEY_free(pkey); in es256_pk_to_EVP_PKEY()
329 pkey = NULL; in es256_pk_to_EVP_PKEY()
332 return (pkey); in es256_pk_to_EVP_PKEY()
[all …]
/openbsd/src/lib/libcrypto/rsa/
Drsa_ameth.c96 rsa_param_encode(const EVP_PKEY *pkey, ASN1_STRING **pstr, int *pstrtype) in rsa_param_encode() argument
98 const RSA *rsa = pkey->pkey.rsa; in rsa_param_encode()
103 if (pkey->ameth->pkey_id != EVP_PKEY_RSA_PSS) { in rsa_param_encode()
146 rsa_pub_encode(X509_PUBKEY *pk, const EVP_PKEY *pkey) in rsa_pub_encode() argument
154 if (!rsa_param_encode(pkey, &str, &strtype)) in rsa_pub_encode()
156 if ((penclen = i2d_RSAPublicKey(pkey->pkey.rsa, &penc)) <= 0) { in rsa_pub_encode()
160 if ((aobj = OBJ_nid2obj(pkey->ameth->pkey_id)) == NULL) in rsa_pub_encode()
175 rsa_pub_decode(EVP_PKEY *pkey, X509_PUBKEY *pubkey) in rsa_pub_decode() argument
192 if (!EVP_PKEY_assign(pkey, pkey->ameth->pkey_id, rsa)) { in rsa_pub_decode()
202 if (BN_cmp(b->pkey.rsa->n, a->pkey.rsa->n) != 0 || in rsa_pub_cmp()
[all …]
/openbsd/src/lib/libcrypto/asn1/
Dx_pubkey.c84 EVP_PKEY_free(pubkey->pkey); in pubkey_cb()
146 X509_PUBKEY_set(X509_PUBKEY **x, EVP_PKEY *pkey) in X509_PUBKEY_set() argument
155 if (pkey->ameth) { in X509_PUBKEY_set()
156 if (pkey->ameth->pub_encode) { in X509_PUBKEY_set()
157 if (!pkey->ameth->pub_encode(pk, pkey)) { in X509_PUBKEY_set()
192 if (key->pkey != NULL) in X509_PUBKEY_get0()
193 return key->pkey; in X509_PUBKEY_get0()
220 if (key->pkey) { in X509_PUBKEY_get0()
223 ret = key->pkey; in X509_PUBKEY_get0()
225 key->pkey = ret; in X509_PUBKEY_get0()
[all …]
/openbsd/src/usr.bin/ssh/
Dssh-ecdsa.c113 EVP_PKEY_free(k->pkey); in ssh_ecdsa_cleanup()
114 k->pkey = NULL; in ssh_ecdsa_cleanup()
120 if (a->pkey == NULL || b->pkey == NULL) in ssh_ecdsa_equal()
122 return EVP_PKEY_cmp(a->pkey, b->pkey) == 1; in ssh_ecdsa_equal()
131 if (key->pkey == NULL) in ssh_ecdsa_serialize_public()
135 (r = sshbuf_put_ec_pkey(b, key->pkey)) != 0) in ssh_ecdsa_serialize_public()
152 EC_KEY_get0_private_key(EVP_PKEY_get0_EC_KEY(key->pkey)))) != 0) in ssh_ecdsa_serialize_private()
177 k->pkey = res; in ssh_ecdsa_generate()
193 ec_from = EVP_PKEY_get0_EC_KEY(from->pkey); in ssh_ecdsa_copy_public()
205 EVP_PKEY_free(to->pkey); in ssh_ecdsa_copy_public()
[all …]
Dssh-rsa.c35 if (k->pkey == NULL) in ssh_rsa_size()
37 return EVP_PKEY_bits(k->pkey); in ssh_rsa_size()
43 if ((k->pkey = EVP_PKEY_new()) == NULL) in ssh_rsa_alloc()
51 EVP_PKEY_free(k->pkey); in ssh_rsa_cleanup()
52 k->pkey = NULL; in ssh_rsa_cleanup()
58 if (a->pkey == NULL || b->pkey == NULL) in ssh_rsa_equal()
60 return EVP_PKEY_cmp(a->pkey, b->pkey) == 1; in ssh_rsa_equal()
71 if (key->pkey == NULL) in ssh_rsa_serialize_public()
73 if ((rsa = EVP_PKEY_get0_RSA(key->pkey)) == NULL) in ssh_rsa_serialize_public()
92 if ((rsa = EVP_PKEY_get0_RSA(key->pkey)) == NULL) in ssh_rsa_serialize_private()
[all …]
/openbsd/src/regress/lib/libcrypto/sm2/
Dsm2evptest.c67 EVP_PKEY *pkey = NULL; in test_EVP_SM2_verify() local
74 pkey = PEM_read_bio_PUBKEY(bufio, NULL, NULL, NULL); in test_EVP_SM2_verify()
75 CHECK_GOTO(pkey != NULL); in test_EVP_SM2_verify()
77 CHECK_GOTO(EVP_PKEY_set_alias_type(pkey, EVP_PKEY_SM2)); in test_EVP_SM2_verify()
82 CHECK_GOTO(EVP_DigestVerifyInit(md_ctx_verify, &verify_ctx, EVP_sm3(), NULL, pkey)); in test_EVP_SM2_verify()
95 EVP_PKEY_free(pkey); in test_EVP_SM2_verify()
104 EVP_PKEY *pkey = NULL; in test_EVP_SM2() local
142 CHECK_GOTO(EVP_PKEY_keygen(kctx, &pkey)); in test_EVP_SM2()
144 CHECK_GOTO(EVP_PKEY_set_alias_type(pkey, EVP_PKEY_SM2)); in test_EVP_SM2()
153 CHECK_GOTO(EVP_DigestSignInit(md_ctx, &sign_ctx, EVP_sm3(), NULL, pkey)); in test_EVP_SM2()
[all …]
/openbsd/src/lib/libcrypto/sm2/
Dsm2_pmeth.c115 if ((sig_sz = ECDSA_size(ctx->pkey->pkey.ec)) <= 0) in pkey_sm2_sign()
128 if ((ret = SM2_sign(tbs, tbslen, sig, &sltmp, ctx->pkey->pkey.ec)) <= 0) in pkey_sm2_sign()
139 return SM2_verify(tbs, tbslen, sig, siglen, ctx->pkey->pkey.ec); in pkey_sm2_verify()
150 if (!SM2_ciphertext_size(ctx->pkey->pkey.ec, md, inlen, outlen)) in pkey_sm2_encrypt()
156 return SM2_encrypt(ctx->pkey->pkey.ec, md, in, inlen, out, outlen); in pkey_sm2_encrypt()
167 if (!SM2_plaintext_size(ctx->pkey->pkey.ec, md, inlen, outlen)) in pkey_sm2_decrypt()
173 return SM2_decrypt(ctx->pkey->pkey.ec, md, in, inlen, out, outlen); in pkey_sm2_decrypt()
242 ctx->pkey->pkey.ec) != 1) { in pkey_sm2_ctrl()
/openbsd/src/usr.bin/openssl/
Dgenpkey.c223 EVP_PKEY *pkey = NULL; in genpkey_main() local
265 if (EVP_PKEY_paramgen(ctx, &pkey) <= 0) { in genpkey_main()
271 if (EVP_PKEY_keygen(ctx, &pkey) <= 0) { in genpkey_main()
279 rv = PEM_write_bio_Parameters(out, pkey); in genpkey_main()
281 rv = PEM_write_bio_PrivateKey(out, pkey, cfg.cipher, in genpkey_main()
284 rv = i2d_PrivateKey_bio(out, pkey); in genpkey_main()
296 rv = EVP_PKEY_print_params(out, pkey, 0, NULL); in genpkey_main()
298 rv = EVP_PKEY_print_private(out, pkey, 0, NULL); in genpkey_main()
308 EVP_PKEY_free(pkey); in genpkey_main()
321 EVP_PKEY *pkey = NULL; in init_keygen_file() local
[all …]

1234567