Lines Matching refs:gctx

89 static void *s390x_ecx_keygen25519(struct ecx_gen_ctx *gctx);
90 static void *s390x_ecx_keygen448(struct ecx_gen_ctx *gctx);
91 static void *s390x_ecd_keygen25519(struct ecx_gen_ctx *gctx);
92 static void *s390x_ecd_keygen448(struct ecx_gen_ctx *gctx);
494 struct ecx_gen_ctx *gctx = NULL; in ecx_gen_init() local
499 if ((gctx = OPENSSL_zalloc(sizeof(*gctx))) != NULL) { in ecx_gen_init()
500 gctx->libctx = libctx; in ecx_gen_init()
501 gctx->type = type; in ecx_gen_init()
502 gctx->selection = selection; in ecx_gen_init()
507 OPENSSL_free(gctx); in ecx_gen_init()
512 if (!ecx_gen_set_params(gctx, params)) { in ecx_gen_init()
513 OPENSSL_free(gctx); in ecx_gen_init()
514 gctx = NULL; in ecx_gen_init()
516 return gctx; in ecx_gen_init()
545 struct ecx_gen_ctx *gctx = genctx; in ecx_gen_set_params() local
548 if (gctx == NULL) in ecx_gen_set_params()
560 switch (gctx->type) { in ecx_gen_set_params()
582 OPENSSL_free(gctx->propq); in ecx_gen_set_params()
583 gctx->propq = OPENSSL_strdup(p->data); in ecx_gen_set_params()
584 if (gctx->propq == NULL) in ecx_gen_set_params()
590 OPENSSL_free(gctx->dhkem_ikm); in ecx_gen_set_params()
591 gctx->dhkem_ikm = NULL; in ecx_gen_set_params()
592 if (!OSSL_PARAM_get_octet_string(p, (void **)&gctx->dhkem_ikm, 0, in ecx_gen_set_params()
593 &gctx->dhkem_ikmlen)) in ecx_gen_set_params()
681 static void *ecx_gen(struct ecx_gen_ctx *gctx) in ecx_gen() argument
686 if (gctx == NULL) in ecx_gen()
688 if ((key = ossl_ecx_key_new(gctx->libctx, gctx->type, 0, in ecx_gen()
689 gctx->propq)) == NULL) { in ecx_gen()
695 if ((gctx->selection & OSSL_KEYMGMT_SELECT_KEYPAIR) == 0) in ecx_gen()
703 if (gctx->dhkem_ikm != NULL && gctx->dhkem_ikmlen != 0) { in ecx_gen()
704 if (gctx->type == ECX_KEY_TYPE_ED25519 in ecx_gen()
705 || gctx->type == ECX_KEY_TYPE_ED448) in ecx_gen()
708 gctx->dhkem_ikm, gctx->dhkem_ikmlen)) in ecx_gen()
713 if (RAND_priv_bytes_ex(gctx->libctx, privkey, key->keylen, 0) <= 0) in ecx_gen()
717 switch (gctx->type) { in ecx_gen()
730 if (!ossl_ed25519_public_from_private(gctx->libctx, key->pubkey, privkey, in ecx_gen()
731 gctx->propq)) in ecx_gen()
735 if (!ossl_ed448_public_from_private(gctx->libctx, key->pubkey, privkey, in ecx_gen()
736 gctx->propq)) in ecx_gen()
749 struct ecx_gen_ctx *gctx = genctx; in x25519_gen() local
756 return s390x_ecx_keygen25519(gctx); in x25519_gen()
758 return ecx_gen(gctx); in x25519_gen()
763 struct ecx_gen_ctx *gctx = genctx; in x448_gen() local
770 return s390x_ecx_keygen448(gctx); in x448_gen()
772 return ecx_gen(gctx); in x448_gen()
778 struct ecx_gen_ctx *gctx = genctx; 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()
812 struct ecx_gen_ctx *gctx = genctx; 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()
844 struct ecx_gen_ctx *gctx = genctx; in ecx_gen_cleanup() local
846 OPENSSL_clear_free(gctx->dhkem_ikm, gctx->dhkem_ikmlen); in ecx_gen_cleanup()
847 OPENSSL_free(gctx->propq); in ecx_gen_cleanup()
848 OPENSSL_free(gctx); in ecx_gen_cleanup()
1028 static void *s390x_ecx_keygen25519(struct ecx_gen_ctx *gctx) in MAKE_KEYMGMT_FUNCTIONS()
1035 ECX_KEY *key = ossl_ecx_key_new(gctx->libctx, ECX_KEY_TYPE_X25519, 1, in MAKE_KEYMGMT_FUNCTIONS()
1036 gctx->propq); in MAKE_KEYMGMT_FUNCTIONS()
1045 if ((gctx->selection & OSSL_KEYMGMT_SELECT_KEYPAIR) == 0) in MAKE_KEYMGMT_FUNCTIONS()
1057 if (gctx->dhkem_ikm != NULL && gctx->dhkem_ikmlen != 0) { in MAKE_KEYMGMT_FUNCTIONS()
1058 if (gctx->type != ECX_KEY_TYPE_X25519) in MAKE_KEYMGMT_FUNCTIONS()
1061 gctx->dhkem_ikm, gctx->dhkem_ikmlen)) in MAKE_KEYMGMT_FUNCTIONS()
1066 if (RAND_priv_bytes_ex(gctx->libctx, privkey, X25519_KEYLEN, 0) <= 0) in MAKE_KEYMGMT_FUNCTIONS()
1083 static void *s390x_ecx_keygen448(struct ecx_gen_ctx *gctx) in s390x_ecx_keygen448() argument
1092 ECX_KEY *key = ossl_ecx_key_new(gctx->libctx, ECX_KEY_TYPE_X448, 1, in s390x_ecx_keygen448()
1093 gctx->propq); in s390x_ecx_keygen448()
1102 if ((gctx->selection & OSSL_KEYMGMT_SELECT_KEYPAIR) == 0) in s390x_ecx_keygen448()
1114 if (gctx->dhkem_ikm != NULL && gctx->dhkem_ikmlen != 0) { in s390x_ecx_keygen448()
1115 if (gctx->type != ECX_KEY_TYPE_X448) in s390x_ecx_keygen448()
1118 gctx->dhkem_ikm, gctx->dhkem_ikmlen)) in s390x_ecx_keygen448()
1123 if (RAND_priv_bytes_ex(gctx->libctx, privkey, X448_KEYLEN, 0) <= 0) in s390x_ecx_keygen448()
1139 static void *s390x_ecd_keygen25519(struct ecx_gen_ctx *gctx) in s390x_ecd_keygen25519() argument
1152 ECX_KEY *key = ossl_ecx_key_new(gctx->libctx, ECX_KEY_TYPE_ED25519, 1, in s390x_ecd_keygen25519()
1153 gctx->propq); in s390x_ecd_keygen25519()
1165 if ((gctx->selection & OSSL_KEYMGMT_SELECT_KEYPAIR) == 0) in s390x_ecd_keygen25519()
1176 if (RAND_priv_bytes_ex(gctx->libctx, privkey, ED25519_KEYLEN, 0) <= 0) in s390x_ecd_keygen25519()
1179 sha = EVP_MD_fetch(gctx->libctx, "SHA512", gctx->propq); in s390x_ecd_keygen25519()
1203 static void *s390x_ecd_keygen448(struct ecx_gen_ctx *gctx) in s390x_ecd_keygen448() argument
1220 ECX_KEY *key = ossl_ecx_key_new(gctx->libctx, ECX_KEY_TYPE_ED448, 1, in s390x_ecd_keygen448()
1221 gctx->propq); in s390x_ecd_keygen448()
1232 if ((gctx->selection & OSSL_KEYMGMT_SELECT_KEYPAIR) == 0) in s390x_ecd_keygen448()
1243 shake = EVP_MD_fetch(gctx->libctx, "SHAKE256", gctx->propq); in s390x_ecd_keygen448()
1246 if (RAND_priv_bytes_ex(gctx->libctx, privkey, ED448_KEYLEN, 0) <= 0) in s390x_ecd_keygen448()