Ruby
2.7.2p137(2020-10-01revision5445e0435260b449decf2ac16f9d09bae3cafe72)
|
Go to the documentation of this file.
18 static ID id_private_q;
31 call_check_ints(
void *
arg)
35 return (
void *)(
VALUE)state;
60 if (
arg->interrupted) {
79 ossl_evp_pkey_free(
void *
ptr)
90 0, ossl_evp_pkey_free,
96 pkey_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())) {
288 ossl_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);
EVP_PKEY * GetPKeyPtr(VALUE obj)
void rb_thread_check_ints(void)
VALUE rb_define_module_under(VALUE outer, const char *name)
BIO * ossl_obj2bio(volatile VALUE *pobj)
void rb_ary_store(VALUE ary, long idx, VALUE val)
#define OSSL_BIO_reset(bio)
#define RSTRING_LENINT(str)
VALUE rb_define_module(const char *name)
void ossl_clear_error(void)
void rb_define_method(VALUE klass, const char *name, VALUE(*func)(ANYARGS), int argc)
int ossl_pem_passwd_cb(char *buf, int max_len, int flag, void *pwd_)
const rb_data_type_t ossl_evp_pkey_type
VALUE rb_protect(VALUE(*proc)(VALUE), VALUE data, int *pstate)
Protects a function call from potential global escapes from the function.
void Init_ossl_pkey(void)
void ossl_pkey_check_public_key(const EVP_PKEY *pkey)
VALUE ossl_dh_new(EVP_PKEY *)
VALUE ossl_ec_new(EVP_PKEY *)
VALUE rb_obj_is_instance_of(VALUE, VALUE)
Determines if obj is an instance of c.
void ossl_generate_cb_stop(void *ptr)
void rb_jump_tag(int tag)
Continues the exception caught by rb_protect() and rb_eval_string_protect().
VALUE ossl_pem_passwd_value(VALUE pass)
#define GetPKey(obj, pkey)
VALUE ossl_dsa_new(EVP_PKEY *)
void ossl_raise(VALUE exc, const char *fmt,...)
EVP_PKEY * DupPKeyPtr(VALUE obj)
void rb_str_set_len(VALUE, long)
#define BN_GENCB_get_arg(cb)
void rb_define_module_function(VALUE module, const char *name, VALUE(*func)(ANYARGS), int argc)
Defines a module function for module.
RUBY_EXTERN VALUE rb_cObject
char str[HTML_ESCAPE_MAX_LEN+1]
#define RUBY_TYPED_FREE_IMMEDIATELY
#define EVP_PKEY_up_ref(x)
#define SetPKey(obj, pkey)
VALUE rb_define_class_under(VALUE outer, const char *name, VALUE super)
Defines a class under the namespace of outer.
EVP_PKEY * GetPrivPKeyPtr(VALUE obj)
const EVP_MD * ossl_evp_get_digestbyname(VALUE obj)
void rb_define_alloc_func(VALUE, rb_alloc_func_t)
VALUE type(ANYARGS)
ANYARGS-ed function type.
RUBY_SYMBOL_EXPORT_BEGIN void * rb_thread_call_with_gvl(void *(*func)(void *), void *data1)
VALUE ossl_rsa_new(EVP_PKEY *)
int ossl_generate_cb_2(int p, int n, BN_GENCB *cb)
VALUE ossl_pkey_new(EVP_PKEY *pkey)