18static ID id_private_q;
31call_check_ints(
void *
arg)
35 return (
void *)(
VALUE)state;
60 if (
arg->interrupted) {
79ossl_evp_pkey_free(
void *
ptr)
90 0, ossl_evp_pkey_free,
96pkey_new0(EVP_PKEY *pkey)
101 if (!pkey || (
type = EVP_PKEY_base_id(pkey)) == EVP_PKEY_NONE)
105#if !defined(OPENSSL_NO_RSA)
109#if !defined(OPENSSL_NO_DSA)
113#if !defined(OPENSSL_NO_DH)
117#if !defined(OPENSSL_NO_EC)
170 if (!(pkey = d2i_PrivateKey_bio(bio,
NULL))) {
174 if (!(pkey = d2i_PUBKEY_bio(bio,
NULL))) {
192 const BIGNUM *
n, *e, *pubkey;
194 if (EVP_PKEY_missing_parameters(pkey))
198 ptr = EVP_PKEY_get0((EVP_PKEY *)pkey);
199 switch (EVP_PKEY_base_id(pkey)) {
206 DSA_get0_key(
ptr, &pubkey,
NULL);
211 DH_get0_key(
ptr, &pubkey,
NULL);
215#if !defined(OPENSSL_NO_EC)
217 if (EC_KEY_get0_public_key(
ptr))
272 if (!(pkey = EVP_PKEY_new())) {
288ossl_pkey_initialize(
VALUE self)
319 unsigned int buf_len;
331 if (!EVP_SignInit_ex(ctx, md,
NULL)) {
339 result = EVP_SignFinal(ctx, (
unsigned char *)
RSTRING_PTR(
str), &buf_len, pkey);
387 if (!EVP_VerifyInit_ex(ctx, md,
NULL)) {
395 result = EVP_VerifyFinal(ctx, (
unsigned char *)
RSTRING_PTR(
sig), siglen, pkey);
char str[HTML_ESCAPE_MAX_LEN+1]
VALUE rb_define_class_under(VALUE, const char *, VALUE)
Defines a class under the namespace of outer.
VALUE rb_define_module(const char *)
VALUE rb_define_module_under(VALUE, const char *)
VALUE rb_cObject
Object class.
VALUE rb_protect(VALUE(*)(VALUE), VALUE, int *)
Protects a function call from potential global escapes from the function.
void rb_jump_tag(int tag)
Continues the exception caught by rb_protect() and rb_eval_string_protect().
VALUE rb_obj_is_instance_of(VALUE, VALUE)
Determines if obj is an instance of c.
VALUE type(ANYARGS)
ANYARGS-ed function type.
#define EVP_PKEY_up_ref(x)
#define BN_GENCB_get_arg(cb)
int ossl_pem_passwd_cb(char *buf, int max_len, int flag, void *pwd_)
VALUE ossl_pem_passwd_value(VALUE pass)
void ossl_raise(VALUE exc, const char *fmt,...)
void ossl_clear_error(void)
#define OSSL_BIO_reset(bio)
BIO * ossl_obj2bio(volatile VALUE *pobj)
const EVP_MD * ossl_evp_get_digestbyname(VALUE obj)
EVP_PKEY * GetPrivPKeyPtr(VALUE obj)
const rb_data_type_t ossl_evp_pkey_type
void ossl_pkey_check_public_key(const EVP_PKEY *pkey)
int ossl_generate_cb_2(int p, int n, BN_GENCB *cb)
void ossl_generate_cb_stop(void *ptr)
EVP_PKEY * DupPKeyPtr(VALUE obj)
EVP_PKEY * GetPKeyPtr(VALUE obj)
void Init_ossl_pkey(void)
VALUE ossl_pkey_new(EVP_PKEY *pkey)
VALUE ossl_dsa_new(EVP_PKEY *)
VALUE ossl_ec_new(EVP_PKEY *)
VALUE ossl_dh_new(EVP_PKEY *)
#define GetPKey(obj, pkey)
VALUE ossl_rsa_new(EVP_PKEY *)
#define SetPKey(obj, pkey)
RUBY_SYMBOL_EXPORT_BEGIN void * rb_thread_call_with_gvl(void *(*func)(void *), void *data1)