Lines Matching refs:key

129     const ECX_KEY *key = keydata;  in ecx_has()  local
132 if (ossl_prov_is_running() && key != NULL) { in ecx_has()
140 ok = ok && key->haspubkey; in ecx_has()
143 ok = ok && key->privkey != NULL; in ecx_has()
198 ECX_KEY *key = keydata; in ecx_import() local
202 if (!ossl_prov_is_running() || key == NULL) in ecx_import()
209 ok = ok && ossl_ecx_key_fromdata(key, params, include_private); in ecx_import()
214 static int key_to_params(ECX_KEY *key, OSSL_PARAM_BLD *tmpl, in key_to_params() argument
217 if (key == NULL) in key_to_params()
222 key->pubkey, key->keylen)) in key_to_params()
226 && key->privkey != NULL in key_to_params()
229 key->privkey, key->keylen)) in key_to_params()
238 ECX_KEY *key = keydata; in ecx_export() local
243 if (!ossl_prov_is_running() || key == NULL) in ecx_export()
256 if (!key_to_params(key, tmpl, NULL, include_private)) in ecx_export()
286 static int ecx_get_params(void *key, OSSL_PARAM params[], int bits, int secbits, in ecx_get_params() argument
289 ECX_KEY *ecx = key; in ecx_get_params()
321 static int ed_get_params(void *key, OSSL_PARAM params[]) in ed_get_params() argument
332 static int x25519_get_params(void *key, OSSL_PARAM params[]) in x25519_get_params() argument
334 return ecx_get_params(key, params, X25519_BITS, X25519_SECURITY_BITS, in x25519_get_params()
338 static int x448_get_params(void *key, OSSL_PARAM params[]) in x448_get_params() argument
340 return ecx_get_params(key, params, X448_BITS, X448_SECURITY_BITS, in x448_get_params()
344 static int ed25519_get_params(void *key, OSSL_PARAM params[]) in ed25519_get_params() argument
346 return ecx_get_params(key, params, ED25519_BITS, ED25519_SECURITY_BITS, in ed25519_get_params()
348 && ed_get_params(key, params); in ed25519_get_params()
351 static int ed448_get_params(void *key, OSSL_PARAM params[]) in ed448_get_params() argument
353 return ecx_get_params(key, params, ED448_BITS, ED448_SECURITY_BITS, in ed448_get_params()
355 && ed_get_params(key, params); in ed448_get_params()
409 static int ecx_set_params(void *key, const OSSL_PARAM params[]) in ecx_set_params() argument
411 ECX_KEY *ecxkey = key; in ecx_set_params()
439 static int x25519_set_params(void *key, const OSSL_PARAM params[]) in x25519_set_params() argument
441 return ecx_set_params(key, params); in x25519_set_params()
444 static int x448_set_params(void *key, const OSSL_PARAM params[]) in x448_set_params() argument
446 return ecx_set_params(key, params); in x448_set_params()
449 static int ed25519_set_params(void *key, const OSSL_PARAM params[]) in ed25519_set_params() argument
454 static int ed448_set_params(void *key, const OSSL_PARAM params[]) in ed448_set_params() argument
683 ECX_KEY *key; in ecx_gen() local
688 if ((key = ossl_ecx_key_new(gctx->libctx, gctx->type, 0, in ecx_gen()
696 return key; in ecx_gen()
698 if ((privkey = ossl_ecx_key_allocate_privkey(key)) == NULL) { in ecx_gen()
707 if (!ossl_ecx_dhkem_derive_private(key, privkey, in ecx_gen()
713 if (RAND_priv_bytes_ex(gctx->libctx, privkey, key->keylen, 0) <= 0) in ecx_gen()
722 ossl_x25519_public_from_private(key->pubkey, privkey); in ecx_gen()
727 ossl_x448_public_from_private(key->pubkey, privkey); in ecx_gen()
730 if (!ossl_ed25519_public_from_private(gctx->libctx, key->pubkey, privkey, in ecx_gen()
735 if (!ossl_ed448_public_from_private(gctx->libctx, key->pubkey, privkey, in ecx_gen()
740 key->haspubkey = 1; in ecx_gen()
741 return key; in ecx_gen()
743 ossl_ecx_key_free(key); in ecx_gen()
777 ECX_KEY *key = NULL; in ed25519_gen() local
788 key = s390x_ecd_keygen25519(gctx); in ed25519_gen()
792 key = ecx_gen(gctx); in ed25519_gen()
797 if (!key || ((gctx->selection & OSSL_KEYMGMT_SELECT_KEYPAIR) == 0)) in ed25519_gen()
798 return key; in ed25519_gen()
799 if (ecd_fips140_pairwise_test(key, ECX_KEY_TYPE_ED25519, 1) != 1) { in ed25519_gen()
801 ossl_ecx_key_free(key); in ed25519_gen()
806 return key; in ed25519_gen()
811 ECX_KEY *key = NULL; in ed448_gen() local
821 key = s390x_ecd_keygen448(gctx); in ed448_gen()
825 key = ecx_gen(gctx); in ed448_gen()
830 if (!key || ((gctx->selection & OSSL_KEYMGMT_SELECT_KEYPAIR) == 0)) in ed448_gen()
831 return key; in ed448_gen()
832 if (ecd_fips140_pairwise_test(key, ECX_KEY_TYPE_ED448, 1) != 1) { in ed448_gen()
834 ossl_ecx_key_free(key); in ed448_gen()
839 return key; in ed448_gen()
853 ECX_KEY *key = NULL; in ecx_load() local
855 if (ossl_prov_is_running() && reference_sz == sizeof(key)) { in ecx_load()
857 key = *(ECX_KEY **)reference; in ecx_load()
860 return key; in ecx_load()
1035 ECX_KEY *key = ossl_ecx_key_new(gctx->libctx, ECX_KEY_TYPE_X25519, 1, in MAKE_KEYMGMT_FUNCTIONS() local
1039 if (key == NULL) { in MAKE_KEYMGMT_FUNCTIONS()
1046 return key; in MAKE_KEYMGMT_FUNCTIONS()
1048 pubkey = key->pubkey; in MAKE_KEYMGMT_FUNCTIONS()
1050 privkey = ossl_ecx_key_allocate_privkey(key); in MAKE_KEYMGMT_FUNCTIONS()
1060 if (!ossl_ecx_dhkem_derive_private(key, privkey, in MAKE_KEYMGMT_FUNCTIONS()
1076 key->haspubkey = 1; in MAKE_KEYMGMT_FUNCTIONS()
1077 return key; in MAKE_KEYMGMT_FUNCTIONS()
1079 ossl_ecx_key_free(key); in MAKE_KEYMGMT_FUNCTIONS()
1092 ECX_KEY *key = ossl_ecx_key_new(gctx->libctx, ECX_KEY_TYPE_X448, 1, in s390x_ecx_keygen448() local
1096 if (key == NULL) { in s390x_ecx_keygen448()
1103 return key; in s390x_ecx_keygen448()
1105 pubkey = key->pubkey; in s390x_ecx_keygen448()
1107 privkey = ossl_ecx_key_allocate_privkey(key); in s390x_ecx_keygen448()
1117 if (!ossl_ecx_dhkem_derive_private(key, privkey, in s390x_ecx_keygen448()
1132 key->haspubkey = 1; in s390x_ecx_keygen448()
1133 return key; in s390x_ecx_keygen448()
1135 ossl_ecx_key_free(key); in s390x_ecx_keygen448()
1152 ECX_KEY *key = ossl_ecx_key_new(gctx->libctx, ECX_KEY_TYPE_ED25519, 1, in s390x_ecd_keygen25519() local
1159 if (key == NULL) { in s390x_ecd_keygen25519()
1166 return key; in s390x_ecd_keygen25519()
1168 pubkey = key->pubkey; in s390x_ecd_keygen25519()
1170 privkey = ossl_ecx_key_allocate_privkey(key); in s390x_ecd_keygen25519()
1196 key->haspubkey = 1; in s390x_ecd_keygen25519()
1197 return key; in s390x_ecd_keygen25519()
1199 ossl_ecx_key_free(key); in s390x_ecd_keygen25519()
1220 ECX_KEY *key = ossl_ecx_key_new(gctx->libctx, ECX_KEY_TYPE_ED448, 1, in s390x_ecd_keygen448() local
1226 if (key == NULL) { in s390x_ecd_keygen448()
1233 return key; in s390x_ecd_keygen448()
1235 pubkey = key->pubkey; in s390x_ecd_keygen448()
1237 privkey = ossl_ecx_key_allocate_privkey(key); in s390x_ecd_keygen448()
1270 key->haspubkey = 1; in s390x_ecd_keygen448()
1271 return key; in s390x_ecd_keygen448()
1273 ossl_ecx_key_free(key); in s390x_ecd_keygen448()