39 ossl_generate_cb_2(
int p,
int n, BN_GENCB *cb)
42 struct ossl_generate_cb_arg *
arg;
45 arg = (
struct ossl_generate_cb_arg *)cb->arg;
60 if (arg->stop)
return 0;
65 ossl_generate_cb_stop(
void *
ptr)
67 struct ossl_generate_cb_arg *arg = (
struct ossl_generate_cb_arg *)ptr;
81 switch (EVP_PKEY_type(pkey->type)) {
82 #if !defined(OPENSSL_NO_RSA)
86 #if !defined(OPENSSL_NO_DSA)
90 #if !defined(OPENSSL_NO_DH)
94 #if !defined(OPENSSL_NO_EC) && (OPENSSL_VERSION_NUMBER >= 0x0090802fL)
150 if (!(pkey = d2i_PrivateKey_bio(bio,
NULL))) {
157 if (!(pkey = d2i_PUBKEY_bio(bio,
NULL))) {
202 CRYPTO_add(&pkey->references, 1, CRYPTO_LOCK_EVP_PKEY);
216 CRYPTO_add(&pkey->references, 1, CRYPTO_LOCK_EVP_PKEY);
230 if (!(pkey = EVP_PKEY_new())) {
276 unsigned int buf_len;
287 if (!EVP_SignFinal(&ctx, (
unsigned char *)
RSTRING_PTR(str), &buf_len, pkey))
EVP_PKEY * GetPrivPKeyPtr(VALUE obj)
VALUE ossl_dsa_new(EVP_PKEY *)
void rb_define_alloc_func(VALUE, rb_alloc_func_t)
EVP_PKEY * DupPrivPKeyPtr(VALUE obj)
VALUE rb_protect(VALUE(*proc)(VALUE), VALUE data, int *state)
VALUE rb_funcall(VALUE, ID, int,...)
Calls a method.
VALUE rb_define_class_under(VALUE outer, const char *name, VALUE super)
Defines a class under the namespace of outer.
#define SafeStringValue(v)
#define GetPKey(obj, pkey)
VALUE ossl_rsa_new(EVP_PKEY *)
VALUE ossl_pkey_new(EVP_PKEY *pkey)
void rb_fd_fix_cloexec(int fd)
void ossl_generate_cb(int p, int n, void *arg)
VALUE rb_obj_is_instance_of(VALUE, VALUE)
#define StringValuePtr(v)
#define OSSL_BIO_reset(bio)
static VALUE ossl_pkey_initialize(VALUE self)
VALUE ossl_dh_new(EVP_PKEY *)
const EVP_MD * GetDigestPtr(VALUE obj)
void rb_ary_store(VALUE ary, long idx, VALUE val)
#define SafeGetPKey(obj, pkey)
static VALUE ossl_pkey_alloc(VALUE klass)
void rb_define_module_function(VALUE module, const char *name, VALUE(*func)(ANYARGS), int argc)
Defines a module function for module.
static VALUE ossl_pkey_new_from_data(int argc, VALUE *argv, VALUE self)
#define WrapPKey(klass, obj, pkey)
BIO * ossl_obj2bio(VALUE obj)
int rb_scan_args(int argc, const VALUE *argv, const char *fmt,...)
VALUE ossl_pkey_new_from_file(VALUE filename)
VALUE rb_define_module_under(VALUE outer, const char *name)
RUBY_EXTERN char * strerror(int)
if(RB_TYPE_P(r, T_FLOAT))
RUBY_EXTERN VALUE rb_cObject
void ossl_raise(VALUE exc, const char *fmt,...)
EVP_PKEY * GetPKeyPtr(VALUE obj)
#define RSTRING_LENINT(str)
EVP_PKEY * DupPKeyPtr(VALUE obj)
VALUE rb_ary_new2(long capa)
VALUE rb_str_new(const char *, long)
static VALUE ossl_pkey_sign(VALUE self, VALUE digest, VALUE data)
#define assert(condition)
int ossl_pem_passwd_cb(char *buf, int max_len, int flag, void *pwd)
VALUE rb_define_module(const char *name)
static VALUE ossl_pkey_verify(VALUE self, VALUE digest, VALUE sig, VALUE data)
void rb_define_method(VALUE klass, const char *name, VALUE(*func)(ANYARGS), int argc)
VALUE ossl_ec_new(EVP_PKEY *)
void rb_str_set_len(VALUE, long)