Lines Matching refs:pkey

31 static int ecx_pub_encode(X509_PUBKEY *pk, const EVP_PKEY *pkey)
33 const ECX_KEY *ecxkey = pkey->pkey.ecx;
41 penc = OPENSSL_memdup(ecxkey->pubkey, KEYLEN(pkey));
47 if (!X509_PUBKEY_set0_param(pk, OBJ_nid2obj(pkey->ameth->pkey_id),
48 V_ASN1_UNDEF, NULL, penc, KEYLEN(pkey))) {
56 static int ecx_pub_decode(EVP_PKEY *pkey, const X509_PUBKEY *pubkey)
66 ecx = ossl_ecx_key_op(palg, p, pklen, pkey->ameth->pkey_id,
70 EVP_PKEY_assign(pkey, pkey->ameth->pkey_id, ecx);
77 const ECX_KEY *akey = a->pkey.ecx;
78 const ECX_KEY *bkey = b->pkey.ecx;
86 static int ecx_priv_decode_ex(EVP_PKEY *pkey, const PKCS8_PRIV_KEY_INFO *p8,
94 EVP_PKEY_assign(pkey, pkey->ameth->pkey_id, ecx);
100 static int ecx_priv_encode(PKCS8_PRIV_KEY_INFO *p8, const EVP_PKEY *pkey)
102 const ECX_KEY *ecxkey = pkey->pkey.ecx;
113 oct.length = KEYLEN(pkey);
122 if (!PKCS8_pkey_set0(p8, OBJ_nid2obj(pkey->ameth->pkey_id), 0,
132 static int ecx_size(const EVP_PKEY *pkey)
134 return KEYLEN(pkey);
137 static int ecx_bits(const EVP_PKEY *pkey)
139 if (IS25519(pkey->ameth->pkey_id)) {
141 } else if(ISX448(pkey->ameth->pkey_id)) {
148 static int ecx_security_bits(const EVP_PKEY *pkey)
150 if (IS25519(pkey->ameth->pkey_id)) {
157 static void ecx_free(EVP_PKEY *pkey)
159 ossl_ecx_key_free(pkey->pkey.ecx);
168 static int ecx_key_print(BIO *bp, const EVP_PKEY *pkey, int indent,
171 const ECX_KEY *ecxkey = pkey->pkey.ecx;
172 const char *nm = OBJ_nid2ln(pkey->ameth->pkey_id);
184 if (ASN1_buf_print(bp, ecxkey->privkey, KEYLEN(pkey),
199 if (ASN1_buf_print(bp, ecxkey->pubkey, KEYLEN(pkey),
205 static int ecx_priv_print(BIO *bp, const EVP_PKEY *pkey, int indent,
208 return ecx_key_print(bp, pkey, indent, ctx, KEY_OP_PRIVATE);
211 static int ecx_pub_print(BIO *bp, const EVP_PKEY *pkey, int indent,
214 return ecx_key_print(bp, pkey, indent, ctx, KEY_OP_PUBLIC);
217 static int ecx_ctrl(EVP_PKEY *pkey, int op, long arg1, void *arg2)
222 ECX_KEY *ecx = ossl_ecx_key_op(NULL, arg2, arg1, pkey->ameth->pkey_id,
226 EVP_PKEY_assign(pkey, pkey->ameth->pkey_id, ecx);
232 if (pkey->pkey.ecx != NULL) {
235 *ppt = OPENSSL_memdup(pkey->pkey.ecx->pubkey, KEYLEN(pkey));
237 return KEYLEN(pkey);
247 static int ecd_ctrl(EVP_PKEY *pkey, int op, long arg1, void *arg2)
261 static int ecx_set_priv_key(EVP_PKEY *pkey, const unsigned char *priv,
267 if (pkey->keymgmt != NULL)
268 libctx = ossl_provider_libctx(EVP_KEYMGMT_get0_provider(pkey->keymgmt));
270 ecx = ossl_ecx_key_op(NULL, priv, len, pkey->ameth->pkey_id,
274 EVP_PKEY_assign(pkey, pkey->ameth->pkey_id, ecx);
280 static int ecx_set_pub_key(EVP_PKEY *pkey, const unsigned char *pub, size_t len)
285 if (pkey->keymgmt != NULL)
286 libctx = ossl_provider_libctx(EVP_KEYMGMT_get0_provider(pkey->keymgmt));
288 ecx = ossl_ecx_key_op(NULL, pub, len, pkey->ameth->pkey_id,
292 EVP_PKEY_assign(pkey, pkey->ameth->pkey_id, ecx);
298 static int ecx_get_priv_key(const EVP_PKEY *pkey, unsigned char *priv,
301 const ECX_KEY *key = pkey->pkey.ecx;
304 *len = KEYLENID(pkey->ameth->pkey_id);
310 || *len < (size_t)KEYLENID(pkey->ameth->pkey_id))
313 *len = KEYLENID(pkey->ameth->pkey_id);
319 static int ecx_get_pub_key(const EVP_PKEY *pkey, unsigned char *pub,
322 const ECX_KEY *key = pkey->pkey.ecx;
325 *len = KEYLENID(pkey->ameth->pkey_id);
330 || *len < (size_t)KEYLENID(pkey->ameth->pkey_id))
333 *len = KEYLENID(pkey->ameth->pkey_id);
339 static size_t ecx_pkey_dirty_cnt(const EVP_PKEY *pkey)
352 const ECX_KEY *key = from->pkey.ecx;
390 EVP_PKEY *pkey = EVP_PKEY_CTX_get0_pkey(pctx);
400 || !EVP_PKEY_assign(pkey, keytype, ecx)) {
409 ECX_KEY *ecx = from->pkey.ecx, *dupkey = NULL;
532 static int ecd_size25519(const EVP_PKEY *pkey)
537 static int ecd_size448(const EVP_PKEY *pkey)
544 const ASN1_BIT_STRING *str, EVP_PKEY *pkey)
558 if (!EVP_DigestVerifyInit(ctx, NULL, NULL, NULL, pkey))
712 static int pkey_ecx_keygen(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey)
718 EVP_PKEY_assign(pkey, ctx->pmeth->pkey_id, ecx);
731 if (ctx->pkey == NULL || ctx->peerkey == NULL) {
735 ecxkey = evp_pkey_get_legacy(ctx->pkey);
809 const ECX_KEY *edkey = evp_pkey_get_legacy(EVP_MD_CTX_get_pkey_ctx(ctx)->pkey);
836 const ECX_KEY *edkey = evp_pkey_get_legacy(EVP_MD_CTX_get_pkey_ctx(ctx)->pkey);
863 const ECX_KEY *edkey = evp_pkey_get_legacy(EVP_MD_CTX_get_pkey_ctx(ctx)->pkey);
881 const ECX_KEY *edkey = evp_pkey_get_legacy(EVP_MD_CTX_get_pkey_ctx(ctx)->pkey);
936 static int s390x_pkey_ecx_keygen25519(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey)
970 EVP_PKEY_assign(pkey, ctx->pmeth->pkey_id, key);
977 static int s390x_pkey_ecx_keygen448(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey)
1012 EVP_PKEY_assign(pkey, ctx->pmeth->pkey_id, key);
1019 static int s390x_pkey_ecd_keygen25519(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey)
1074 EVP_PKEY_assign(pkey, ctx->pmeth->pkey_id, key);
1081 static int s390x_pkey_ecd_keygen448(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey)
1149 EVP_PKEY_assign(pkey, ctx->pmeth->pkey_id, key);
1196 const ECX_KEY *edkey = evp_pkey_get_legacy(EVP_MD_CTX_get_pkey_ctx(ctx)->pkey);
1241 const ECX_KEY *edkey = evp_pkey_get_legacy(EVP_MD_CTX_get_pkey_ctx(ctx)->pkey);
1289 const ECX_KEY *edkey = evp_pkey_get_legacy(EVP_MD_CTX_get_pkey_ctx(ctx)->pkey);
1321 const ECX_KEY *edkey = evp_pkey_get_legacy(EVP_MD_CTX_get_pkey_ctx(ctx)->pkey);