Lines Matching refs:pkey
31 static int ecx_pub_encode(X509_PUBKEY *pk, const EVP_PKEY *pkey) in ecx_pub_encode() argument
33 const ECX_KEY *ecxkey = pkey->pkey.ecx; in ecx_pub_encode()
41 penc = OPENSSL_memdup(ecxkey->pubkey, KEYLEN(pkey)); in ecx_pub_encode()
45 if (!X509_PUBKEY_set0_param(pk, OBJ_nid2obj(pkey->ameth->pkey_id), in ecx_pub_encode()
46 V_ASN1_UNDEF, NULL, penc, KEYLEN(pkey))) { in ecx_pub_encode()
54 static int ecx_pub_decode(EVP_PKEY *pkey, const X509_PUBKEY *pubkey) in ecx_pub_decode() argument
64 ecx = ossl_ecx_key_op(palg, p, pklen, pkey->ameth->pkey_id, in ecx_pub_decode()
68 EVP_PKEY_assign(pkey, pkey->ameth->pkey_id, ecx); in ecx_pub_decode()
75 const ECX_KEY *akey = a->pkey.ecx; in ecx_pub_cmp()
76 const ECX_KEY *bkey = b->pkey.ecx; in ecx_pub_cmp()
84 static int ecx_priv_decode_ex(EVP_PKEY *pkey, const PKCS8_PRIV_KEY_INFO *p8, in ecx_priv_decode_ex() argument
92 EVP_PKEY_assign(pkey, pkey->ameth->pkey_id, ecx); in ecx_priv_decode_ex()
98 static int ecx_priv_encode(PKCS8_PRIV_KEY_INFO *p8, const EVP_PKEY *pkey) in ecx_priv_encode() argument
100 const ECX_KEY *ecxkey = pkey->pkey.ecx; in ecx_priv_encode()
111 oct.length = KEYLEN(pkey); in ecx_priv_encode()
120 if (!PKCS8_pkey_set0(p8, OBJ_nid2obj(pkey->ameth->pkey_id), 0, in ecx_priv_encode()
130 static int ecx_size(const EVP_PKEY *pkey) in ecx_size() argument
132 return KEYLEN(pkey); in ecx_size()
135 static int ecx_bits(const EVP_PKEY *pkey) in ecx_bits() argument
137 if (IS25519(pkey->ameth->pkey_id)) { in ecx_bits()
139 } else if (ISX448(pkey->ameth->pkey_id)) { in ecx_bits()
146 static int ecx_security_bits(const EVP_PKEY *pkey) in ecx_security_bits() argument
148 if (IS25519(pkey->ameth->pkey_id)) { in ecx_security_bits()
155 static void ecx_free(EVP_PKEY *pkey) in ecx_free() argument
157 ossl_ecx_key_free(pkey->pkey.ecx); in ecx_free()
166 static int ecx_key_print(BIO *bp, const EVP_PKEY *pkey, int indent, in ecx_key_print() argument
169 const ECX_KEY *ecxkey = pkey->pkey.ecx; in ecx_key_print()
170 const char *nm = OBJ_nid2ln(pkey->ameth->pkey_id); in ecx_key_print()
182 if (ASN1_buf_print(bp, ecxkey->privkey, KEYLEN(pkey), in ecx_key_print()
197 if (ASN1_buf_print(bp, ecxkey->pubkey, KEYLEN(pkey), in ecx_key_print()
203 static int ecx_priv_print(BIO *bp, const EVP_PKEY *pkey, int indent, in ecx_priv_print() argument
206 return ecx_key_print(bp, pkey, indent, ctx, KEY_OP_PRIVATE); in ecx_priv_print()
209 static int ecx_pub_print(BIO *bp, const EVP_PKEY *pkey, int indent, in ecx_pub_print() argument
212 return ecx_key_print(bp, pkey, indent, ctx, KEY_OP_PUBLIC); in ecx_pub_print()
215 static int ecx_ctrl(EVP_PKEY *pkey, int op, long arg1, void *arg2) in ecx_ctrl() argument
220 ECX_KEY *ecx = ossl_ecx_key_op(NULL, arg2, arg1, pkey->ameth->pkey_id, in ecx_ctrl()
224 EVP_PKEY_assign(pkey, pkey->ameth->pkey_id, ecx); in ecx_ctrl()
230 if (pkey->pkey.ecx != NULL) { in ecx_ctrl()
233 *ppt = OPENSSL_memdup(pkey->pkey.ecx->pubkey, KEYLEN(pkey)); in ecx_ctrl()
235 return KEYLEN(pkey); in ecx_ctrl()
245 static int ecd_ctrl(EVP_PKEY *pkey, int op, long arg1, void *arg2) in ecd_ctrl() argument
259 static int ecx_set_priv_key(EVP_PKEY *pkey, const unsigned char *priv, in ecx_set_priv_key() argument
265 if (pkey->keymgmt != NULL) in ecx_set_priv_key()
266 libctx = ossl_provider_libctx(EVP_KEYMGMT_get0_provider(pkey->keymgmt)); in ecx_set_priv_key()
268 ecx = ossl_ecx_key_op(NULL, priv, len, pkey->ameth->pkey_id, in ecx_set_priv_key()
272 EVP_PKEY_assign(pkey, pkey->ameth->pkey_id, ecx); in ecx_set_priv_key()
278 static int ecx_set_pub_key(EVP_PKEY *pkey, const unsigned char *pub, size_t len) in ecx_set_pub_key() argument
283 if (pkey->keymgmt != NULL) in ecx_set_pub_key()
284 libctx = ossl_provider_libctx(EVP_KEYMGMT_get0_provider(pkey->keymgmt)); in ecx_set_pub_key()
286 ecx = ossl_ecx_key_op(NULL, pub, len, pkey->ameth->pkey_id, in ecx_set_pub_key()
290 EVP_PKEY_assign(pkey, pkey->ameth->pkey_id, ecx); in ecx_set_pub_key()
296 static int ecx_get_priv_key(const EVP_PKEY *pkey, unsigned char *priv, in ecx_get_priv_key() argument
299 const ECX_KEY *key = pkey->pkey.ecx; in ecx_get_priv_key()
302 *len = KEYLENID(pkey->ameth->pkey_id); in ecx_get_priv_key()
308 || *len < (size_t)KEYLENID(pkey->ameth->pkey_id)) in ecx_get_priv_key()
311 *len = KEYLENID(pkey->ameth->pkey_id); in ecx_get_priv_key()
317 static int ecx_get_pub_key(const EVP_PKEY *pkey, unsigned char *pub, in ecx_get_pub_key() argument
320 const ECX_KEY *key = pkey->pkey.ecx; in ecx_get_pub_key()
323 *len = KEYLENID(pkey->ameth->pkey_id); in ecx_get_pub_key()
328 || *len < (size_t)KEYLENID(pkey->ameth->pkey_id)) in ecx_get_pub_key()
331 *len = KEYLENID(pkey->ameth->pkey_id); in ecx_get_pub_key()
337 static size_t ecx_pkey_dirty_cnt(const EVP_PKEY *pkey) in ecx_pkey_dirty_cnt() argument
350 const ECX_KEY *key = from->pkey.ecx; in ecx_pkey_export_to()
388 EVP_PKEY *pkey = EVP_PKEY_CTX_get0_pkey(pctx); in ecx_generic_import_from() local
398 || !EVP_PKEY_assign(pkey, keytype, ecx)) { in ecx_generic_import_from()
407 ECX_KEY *ecx = from->pkey.ecx, *dupkey = NULL; in ecx_pkey_copy()
530 static int ecd_size25519(const EVP_PKEY *pkey) in ecd_size25519() argument
535 static int ecd_size448(const EVP_PKEY *pkey) in ecd_size448() argument
542 const ASN1_BIT_STRING *str, EVP_PKEY *pkey) in ecd_item_verify() argument
556 if (!EVP_DigestVerifyInit(ctx, NULL, NULL, NULL, pkey)) in ecd_item_verify()
711 static int pkey_ecx_keygen(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey) in pkey_ecx_keygen() argument
717 EVP_PKEY_assign(pkey, ctx->pmeth->pkey_id, ecx); in pkey_ecx_keygen()
730 if (ctx->pkey == NULL || ctx->peerkey == NULL) { in validate_ecx_derive()
734 ecxkey = evp_pkey_get_legacy(ctx->pkey); in validate_ecx_derive()
808 const ECX_KEY *edkey = evp_pkey_get_legacy(EVP_MD_CTX_get_pkey_ctx(ctx)->pkey); in pkey_ecd_digestsign25519()
837 const ECX_KEY *edkey = evp_pkey_get_legacy(EVP_MD_CTX_get_pkey_ctx(ctx)->pkey); in pkey_ecd_digestsign448()
864 const ECX_KEY *edkey = evp_pkey_get_legacy(EVP_MD_CTX_get_pkey_ctx(ctx)->pkey); in pkey_ecd_digestverify25519()
884 const ECX_KEY *edkey = evp_pkey_get_legacy(EVP_MD_CTX_get_pkey_ctx(ctx)->pkey); in pkey_ecd_digestverify448()
939 static int s390x_pkey_ecx_keygen25519(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey) in s390x_pkey_ecx_keygen25519() argument
973 EVP_PKEY_assign(pkey, ctx->pmeth->pkey_id, key); in s390x_pkey_ecx_keygen25519()
980 static int s390x_pkey_ecx_keygen448(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey) in s390x_pkey_ecx_keygen448() argument
1015 EVP_PKEY_assign(pkey, ctx->pmeth->pkey_id, key); in s390x_pkey_ecx_keygen448()
1022 static int s390x_pkey_ecd_keygen25519(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey) in s390x_pkey_ecd_keygen25519() argument
1077 EVP_PKEY_assign(pkey, ctx->pmeth->pkey_id, key); in s390x_pkey_ecd_keygen25519()
1084 static int s390x_pkey_ecd_keygen448(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey) in s390x_pkey_ecd_keygen448() argument
1152 EVP_PKEY_assign(pkey, ctx->pmeth->pkey_id, key); in s390x_pkey_ecd_keygen448()
1199 const ECX_KEY *edkey = evp_pkey_get_legacy(EVP_MD_CTX_get_pkey_ctx(ctx)->pkey); in s390x_pkey_ecd_digestsign25519()
1244 const ECX_KEY *edkey = evp_pkey_get_legacy(EVP_MD_CTX_get_pkey_ctx(ctx)->pkey); in s390x_pkey_ecd_digestsign448()
1292 const ECX_KEY *edkey = evp_pkey_get_legacy(EVP_MD_CTX_get_pkey_ctx(ctx)->pkey); in s390x_pkey_ecd_digestverify25519()
1324 const ECX_KEY *edkey = evp_pkey_get_legacy(EVP_MD_CTX_get_pkey_ctx(ctx)->pkey); in s390x_pkey_ecd_digestverify448()