summaryrefslogtreecommitdiff
path: root/ext/openssl/ossl_pkey.c
diff options
context:
space:
mode:
authorKazuki Yamaguchi <k@rhe.jp>2021-04-05 00:39:04 +0900
committerKazuki Yamaguchi <k@rhe.jp>2021-07-18 17:44:50 +0900
commit436aecb520e63f318ed515d0ca6c0b2cc6cc8115 (patch)
tree769880fb2241878481d8dee1aca252ad1e9dc24e /ext/openssl/ossl_pkey.c
parent38436d1f5cb03520a2a4acca81f013de1c20daa5 (diff)
[ruby/openssl] pkey: remove unused ossl_generate_cb_2() helper function
The previous series of commits re-implemented key generation with the low level API with the EVP API. The BN_GENCB-based callback function is no longer used. https://github.com/ruby/openssl/commit/81027b7463
Diffstat (limited to 'ext/openssl/ossl_pkey.c')
-rw-r--r--ext/openssl/ossl_pkey.c73
1 files changed, 15 insertions, 58 deletions
diff --git a/ext/openssl/ossl_pkey.c b/ext/openssl/ossl_pkey.c
index 24da196860..593788e1ef 100644
--- a/ext/openssl/ossl_pkey.c
+++ b/ext/openssl/ossl_pkey.c
@@ -17,64 +17,6 @@ VALUE cPKey;
VALUE ePKeyError;
static ID id_private_q;
-/*
- * callback for generating keys
- */
-static VALUE
-call_check_ints0(VALUE arg)
-{
- rb_thread_check_ints();
- return Qnil;
-}
-
-static void *
-call_check_ints(void *arg)
-{
- int state;
- rb_protect(call_check_ints0, Qnil, &state);
- return (void *)(VALUE)state;
-}
-
-int
-ossl_generate_cb_2(int p, int n, BN_GENCB *cb)
-{
- VALUE ary;
- struct ossl_generate_cb_arg *arg;
- int state;
-
- arg = (struct ossl_generate_cb_arg *)BN_GENCB_get_arg(cb);
- if (arg->yield) {
- ary = rb_ary_new2(2);
- rb_ary_store(ary, 0, INT2NUM(p));
- rb_ary_store(ary, 1, INT2NUM(n));
-
- /*
- * can be break by raising exception or 'break'
- */
- rb_protect(rb_yield, ary, &state);
- if (state) {
- arg->state = state;
- return 0;
- }
- }
- if (arg->interrupted) {
- arg->interrupted = 0;
- state = (int)(VALUE)rb_thread_call_with_gvl(call_check_ints, NULL);
- if (state) {
- arg->state = state;
- return 0;
- }
- }
- return 1;
-}
-
-void
-ossl_generate_cb_stop(void *ptr)
-{
- struct ossl_generate_cb_arg *arg = (struct ossl_generate_cb_arg *)ptr;
- arg->interrupted = 1;
-}
-
static void
ossl_evp_pkey_free(void *ptr)
{
@@ -257,6 +199,21 @@ pkey_gen_cb_yield(VALUE ctx_v)
return rb_yield_values2(info_num, argv);
}
+static VALUE
+call_check_ints0(VALUE arg)
+{
+ rb_thread_check_ints();
+ return Qnil;
+}
+
+static void *
+call_check_ints(void *arg)
+{
+ int state;
+ rb_protect(call_check_ints0, Qnil, &state);
+ return (void *)(VALUE)state;
+}
+
static int
pkey_gen_cb(EVP_PKEY_CTX *ctx)
{