Lines Matching defs:key

124     const ECX_KEY *key = keydata;
127 if (ossl_prov_is_running() && key != NULL) {
135 ok = ok && key->haspubkey;
138 ok = ok && key->privkey != NULL;
193 ECX_KEY *key = keydata;
197 if (!ossl_prov_is_running() || key == NULL)
204 ok = ok && ossl_ecx_key_fromdata(key, params, include_private);
209 static int key_to_params(ECX_KEY *key, OSSL_PARAM_BLD *tmpl,
212 if (key == NULL)
217 key->pubkey, key->keylen))
221 && key->privkey != NULL
224 key->privkey, key->keylen))
233 ECX_KEY *key = keydata;
238 if (!ossl_prov_is_running() || key == NULL)
248 if (!key_to_params(key, tmpl, NULL, include_private))
278 static int ecx_get_params(void *key, OSSL_PARAM params[], int bits, int secbits,
281 ECX_KEY *ecx = key;
303 static int ed_get_params(void *key, OSSL_PARAM params[])
314 static int x25519_get_params(void *key, OSSL_PARAM params[])
316 return ecx_get_params(key, params, X25519_BITS, X25519_SECURITY_BITS,
320 static int x448_get_params(void *key, OSSL_PARAM params[])
322 return ecx_get_params(key, params, X448_BITS, X448_SECURITY_BITS,
326 static int ed25519_get_params(void *key, OSSL_PARAM params[])
328 return ecx_get_params(key, params, ED25519_BITS, ED25519_SECURITY_BITS,
330 && ed_get_params(key, params);
333 static int ed448_get_params(void *key, OSSL_PARAM params[])
335 return ecx_get_params(key, params, ED448_BITS, ED448_SECURITY_BITS,
337 && ed_get_params(key, params);
392 static int ecx_set_params(void *key, const OSSL_PARAM params[])
394 ECX_KEY *ecxkey = key;
422 static int x25519_set_params(void *key, const OSSL_PARAM params[])
424 return ecx_set_params(key, params);
427 static int x448_set_params(void *key, const OSSL_PARAM params[])
429 return ecx_set_params(key, params);
432 static int ed25519_set_params(void *key, const OSSL_PARAM params[])
437 static int ed448_set_params(void *key, const OSSL_PARAM params[])
542 /* We only support this for key exchange at the moment */
578 ECX_KEY *key;
583 if ((key = ossl_ecx_key_new(gctx->libctx, gctx->type, 0,
589 /* If we're doing parameter generation then we just return a blank key */
591 return key;
593 if ((privkey = ossl_ecx_key_allocate_privkey(key)) == NULL) {
597 if (RAND_priv_bytes_ex(gctx->libctx, privkey, key->keylen, 0) <= 0)
604 ossl_x25519_public_from_private(key->pubkey, privkey);
609 ossl_x448_public_from_private(key->pubkey, privkey);
612 if (!ossl_ed25519_public_from_private(gctx->libctx, key->pubkey, privkey,
617 if (!ossl_ed448_public_from_private(gctx->libctx, key->pubkey, privkey,
622 key->haspubkey = 1;
623 return key;
625 ossl_ecx_key_free(key);
700 ECX_KEY *key = NULL;
702 if (ossl_prov_is_running() && reference_sz == sizeof(key)) {
704 key = *(ECX_KEY **)reference;
707 return key;
835 ECX_KEY *key = ossl_ecx_key_new(gctx->libctx, ECX_KEY_TYPE_X25519, 1,
839 if (key == NULL) {
844 /* If we're doing parameter generation then we just return a blank key */
846 return key;
848 pubkey = key->pubkey;
850 privkey = ossl_ecx_key_allocate_privkey(key);
865 key->haspubkey = 1;
866 return key;
868 ossl_ecx_key_free(key);
881 ECX_KEY *key = ossl_ecx_key_new(gctx->libctx, ECX_KEY_TYPE_X448, 1,
885 if (key == NULL) {
890 /* If we're doing parameter generation then we just return a blank key */
892 return key;
894 pubkey = key->pubkey;
896 privkey = ossl_ecx_key_allocate_privkey(key);
910 key->haspubkey = 1;
911 return key;
913 ossl_ecx_key_free(key);
930 ECX_KEY *key = ossl_ecx_key_new(gctx->libctx, ECX_KEY_TYPE_ED25519, 1,
937 if (key == NULL) {
942 /* If we're doing parameter generation then we just return a blank key */
944 return key;
946 pubkey = key->pubkey;
948 privkey = ossl_ecx_key_allocate_privkey(key);
974 key->haspubkey = 1;
975 return key;
977 ossl_ecx_key_free(key);
998 ECX_KEY *key = ossl_ecx_key_new(gctx->libctx, ECX_KEY_TYPE_ED448, 1,
1004 if (key == NULL) {
1009 /* If we're doing parameter generation then we just return a blank key */
1011 return key;
1013 pubkey = key->pubkey;
1015 privkey = ossl_ecx_key_allocate_privkey(key);
1048 key->haspubkey = 1;
1049 return key;
1051 ossl_ecx_key_free(key);