rubysl-openssl 2.2.1 → 2.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +4 -4
- data/MRI_LICENSE +56 -0
- data/ext/rubysl/openssl/openssl_missing.c +1 -1
- data/ext/rubysl/openssl/openssl_missing.h +1 -1
- data/ext/rubysl/openssl/ossl.c +17 -16
- data/ext/rubysl/openssl/ossl.h +7 -7
- data/ext/rubysl/openssl/ossl_asn1.c +5 -5
- data/ext/rubysl/openssl/ossl_asn1.h +1 -1
- data/ext/rubysl/openssl/ossl_bio.c +2 -2
- data/ext/rubysl/openssl/ossl_bio.h +1 -1
- data/ext/rubysl/openssl/ossl_bn.c +37 -13
- data/ext/rubysl/openssl/ossl_bn.h +1 -1
- data/ext/rubysl/openssl/ossl_cipher.c +64 -17
- data/ext/rubysl/openssl/ossl_cipher.h +1 -1
- data/ext/rubysl/openssl/ossl_config.c +3 -3
- data/ext/rubysl/openssl/ossl_config.h +1 -1
- data/ext/rubysl/openssl/ossl_digest.c +19 -7
- data/ext/rubysl/openssl/ossl_digest.h +1 -1
- data/ext/rubysl/openssl/ossl_engine.c +24 -17
- data/ext/rubysl/openssl/ossl_engine.h +1 -1
- data/ext/rubysl/openssl/ossl_hmac.c +15 -7
- data/ext/rubysl/openssl/ossl_hmac.h +1 -1
- data/ext/rubysl/openssl/ossl_ns_spki.c +19 -4
- data/ext/rubysl/openssl/ossl_ns_spki.h +1 -1
- data/ext/rubysl/openssl/ossl_ocsp.c +518 -60
- data/ext/rubysl/openssl/ossl_ocsp.h +1 -1
- data/ext/rubysl/openssl/ossl_pkcs12.c +18 -4
- data/ext/rubysl/openssl/ossl_pkcs12.h +1 -1
- data/ext/rubysl/openssl/ossl_pkcs5.c +1 -1
- data/ext/rubysl/openssl/ossl_pkcs7.c +59 -15
- data/ext/rubysl/openssl/ossl_pkcs7.h +1 -1
- data/ext/rubysl/openssl/ossl_pkey.c +16 -2
- data/ext/rubysl/openssl/ossl_pkey.h +4 -3
- data/ext/rubysl/openssl/ossl_pkey_dh.c +3 -3
- data/ext/rubysl/openssl/ossl_pkey_dsa.c +3 -3
- data/ext/rubysl/openssl/ossl_pkey_ec.c +32 -12
- data/ext/rubysl/openssl/ossl_pkey_rsa.c +3 -3
- data/ext/rubysl/openssl/ossl_rand.c +58 -34
- data/ext/rubysl/openssl/ossl_rand.h +1 -1
- data/ext/rubysl/openssl/ossl_ssl.c +75 -46
- data/ext/rubysl/openssl/ossl_ssl.h +8 -2
- data/ext/rubysl/openssl/ossl_ssl_session.c +16 -15
- data/ext/rubysl/openssl/ossl_version.h +1 -1
- data/ext/rubysl/openssl/ossl_x509.c +2 -2
- data/ext/rubysl/openssl/ossl_x509.h +1 -1
- data/ext/rubysl/openssl/ossl_x509attr.c +18 -4
- data/ext/rubysl/openssl/ossl_x509cert.c +27 -33
- data/ext/rubysl/openssl/ossl_x509crl.c +18 -4
- data/ext/rubysl/openssl/ossl_x509ext.c +29 -7
- data/ext/rubysl/openssl/ossl_x509name.c +22 -7
- data/ext/rubysl/openssl/ossl_x509req.c +18 -4
- data/ext/rubysl/openssl/ossl_x509revoked.c +18 -4
- data/ext/rubysl/openssl/ossl_x509store.c +33 -8
- data/ext/rubysl/openssl/ruby_missing.h +1 -1
- data/lib/openssl/bn.rb +8 -1
- data/lib/openssl/buffering.rb +1 -1
- data/lib/openssl/cipher.rb +1 -1
- data/lib/openssl/digest.rb +1 -1
- data/lib/openssl/ssl.rb +65 -7
- data/lib/openssl/x509.rb +22 -2
- data/lib/rubysl/openssl.rb +1 -1
- data/lib/rubysl/openssl/version.rb +1 -1
- metadata +4 -3
@@ -1,17 +1,17 @@
|
|
1
1
|
/*
|
2
2
|
* This program is licenced under the same licence as Ruby.
|
3
3
|
* (See the file 'LICENCE'.)
|
4
|
-
* $Id$
|
4
|
+
* $Id: ossl_pkcs12.c 48802 2014-12-12 22:37:53Z nobu $
|
5
5
|
*/
|
6
6
|
#include "ossl.h"
|
7
7
|
|
8
8
|
#define WrapPKCS12(klass, obj, p12) do { \
|
9
9
|
if(!(p12)) ossl_raise(rb_eRuntimeError, "PKCS12 wasn't initialized."); \
|
10
|
-
(obj) =
|
10
|
+
(obj) = TypedData_Wrap_Struct((klass), &ossl_pkcs12_type, (p12)); \
|
11
11
|
} while (0)
|
12
12
|
|
13
13
|
#define GetPKCS12(obj, p12) do { \
|
14
|
-
|
14
|
+
TypedData_Get_Struct((obj), PKCS12, &ossl_pkcs12_type, (p12)); \
|
15
15
|
if(!(p12)) ossl_raise(rb_eRuntimeError, "PKCS12 wasn't initialized."); \
|
16
16
|
} while (0)
|
17
17
|
|
@@ -36,6 +36,20 @@ VALUE ePKCS12Error;
|
|
36
36
|
/*
|
37
37
|
* Private
|
38
38
|
*/
|
39
|
+
static void
|
40
|
+
ossl_pkcs12_free(void *ptr)
|
41
|
+
{
|
42
|
+
PKCS12_free(ptr);
|
43
|
+
}
|
44
|
+
|
45
|
+
static const rb_data_type_t ossl_pkcs12_type = {
|
46
|
+
"OpenSSL/PKCS12",
|
47
|
+
{
|
48
|
+
0, ossl_pkcs12_free,
|
49
|
+
},
|
50
|
+
0, 0, RUBY_TYPED_FREE_IMMEDIATELY,
|
51
|
+
};
|
52
|
+
|
39
53
|
static VALUE
|
40
54
|
ossl_pkcs12_s_allocate(VALUE klass)
|
41
55
|
{
|
@@ -192,7 +206,7 @@ ossl_pkcs12_to_der(VALUE self)
|
|
192
206
|
}
|
193
207
|
|
194
208
|
void
|
195
|
-
Init_ossl_pkcs12()
|
209
|
+
Init_ossl_pkcs12(void)
|
196
210
|
{
|
197
211
|
/*
|
198
212
|
* Defines a file format commonly used to store private keys with
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/*
|
2
|
-
* $Id$
|
2
|
+
* $Id: ossl_pkcs7.c 48805 2014-12-12 22:38:01Z nobu $
|
3
3
|
* 'OpenSSL for Ruby' project
|
4
4
|
* Copyright (C) 2001-2002 Michal Rokos <m.rokos@sh.cvut.cz>
|
5
5
|
* All rights reserved.
|
@@ -14,10 +14,10 @@
|
|
14
14
|
if (!(pkcs7)) { \
|
15
15
|
ossl_raise(rb_eRuntimeError, "PKCS7 wasn't initialized."); \
|
16
16
|
} \
|
17
|
-
(obj) =
|
17
|
+
(obj) = TypedData_Wrap_Struct((klass), &ossl_pkcs7_type, (pkcs7)); \
|
18
18
|
} while (0)
|
19
19
|
#define GetPKCS7(obj, pkcs7) do { \
|
20
|
-
|
20
|
+
TypedData_Get_Struct((obj), PKCS7, &ossl_pkcs7_type, (pkcs7)); \
|
21
21
|
if (!(pkcs7)) { \
|
22
22
|
ossl_raise(rb_eRuntimeError, "PKCS7 wasn't initialized."); \
|
23
23
|
} \
|
@@ -31,10 +31,10 @@
|
|
31
31
|
if (!(p7si)) { \
|
32
32
|
ossl_raise(rb_eRuntimeError, "PKCS7si wasn't initialized."); \
|
33
33
|
} \
|
34
|
-
(obj) =
|
34
|
+
(obj) = TypedData_Wrap_Struct((klass), &ossl_pkcs7_signer_info_type, (p7si)); \
|
35
35
|
} while (0)
|
36
36
|
#define GetPKCS7si(obj, p7si) do { \
|
37
|
-
|
37
|
+
TypedData_Get_Struct((obj), PKCS7_SIGNER_INFO, &ossl_pkcs7_signer_info_type, (p7si)); \
|
38
38
|
if (!(p7si)) { \
|
39
39
|
ossl_raise(rb_eRuntimeError, "PKCS7si wasn't initialized."); \
|
40
40
|
} \
|
@@ -48,10 +48,10 @@
|
|
48
48
|
if (!(p7ri)) { \
|
49
49
|
ossl_raise(rb_eRuntimeError, "PKCS7ri wasn't initialized."); \
|
50
50
|
} \
|
51
|
-
(obj) =
|
51
|
+
(obj) = TypedData_Wrap_Struct((klass), &ossl_pkcs7_recip_info_type, (p7ri)); \
|
52
52
|
} while (0)
|
53
53
|
#define GetPKCS7ri(obj, p7ri) do { \
|
54
|
-
|
54
|
+
TypedData_Get_Struct((obj), PKCS7_RECIP_INFO, &ossl_pkcs7_recip_info_type, (p7ri)); \
|
55
55
|
if (!(p7ri)) { \
|
56
56
|
ossl_raise(rb_eRuntimeError, "PKCS7ri wasn't initialized."); \
|
57
57
|
} \
|
@@ -76,6 +76,48 @@ VALUE cPKCS7Signer;
|
|
76
76
|
VALUE cPKCS7Recipient;
|
77
77
|
VALUE ePKCS7Error;
|
78
78
|
|
79
|
+
static void
|
80
|
+
ossl_pkcs7_free(void *ptr)
|
81
|
+
{
|
82
|
+
PKCS7_free(ptr);
|
83
|
+
}
|
84
|
+
|
85
|
+
static const rb_data_type_t ossl_pkcs7_type = {
|
86
|
+
"OpenSSL/PKCS7",
|
87
|
+
{
|
88
|
+
0, ossl_pkcs7_free,
|
89
|
+
},
|
90
|
+
0, 0, RUBY_TYPED_FREE_IMMEDIATELY,
|
91
|
+
};
|
92
|
+
|
93
|
+
static void
|
94
|
+
ossl_pkcs7_signer_info_free(void *ptr)
|
95
|
+
{
|
96
|
+
PKCS7_SIGNER_INFO_free(ptr);
|
97
|
+
}
|
98
|
+
|
99
|
+
static const rb_data_type_t ossl_pkcs7_signer_info_type = {
|
100
|
+
"OpenSSL/PKCS7/SIGNER_INFO",
|
101
|
+
{
|
102
|
+
0, ossl_pkcs7_signer_info_free,
|
103
|
+
},
|
104
|
+
0, 0, RUBY_TYPED_FREE_IMMEDIATELY,
|
105
|
+
};
|
106
|
+
|
107
|
+
static void
|
108
|
+
ossl_pkcs7_recip_info_free(void *ptr)
|
109
|
+
{
|
110
|
+
PKCS7_RECIP_INFO_free(ptr);
|
111
|
+
}
|
112
|
+
|
113
|
+
static const rb_data_type_t ossl_pkcs7_recip_info_type = {
|
114
|
+
"OpenSSL/PKCS7/RECIP_INFO",
|
115
|
+
{
|
116
|
+
0, ossl_pkcs7_recip_info_free,
|
117
|
+
},
|
118
|
+
0, 0, RUBY_TYPED_FREE_IMMEDIATELY,
|
119
|
+
};
|
120
|
+
|
79
121
|
/*
|
80
122
|
* Public
|
81
123
|
* (MADE PRIVATE UNTIL SOMEBODY WILL NEED THEM)
|
@@ -362,9 +404,10 @@ ossl_pkcs7_sym2typeid(VALUE sym)
|
|
362
404
|
{
|
363
405
|
int i, ret = Qnil;
|
364
406
|
const char *s;
|
407
|
+
size_t l;
|
365
408
|
|
366
|
-
static struct {
|
367
|
-
|
409
|
+
static const struct {
|
410
|
+
char name[20];
|
368
411
|
int nid;
|
369
412
|
} p7_type_tab[] = {
|
370
413
|
{ "signed", NID_pkcs7_signed },
|
@@ -373,14 +416,15 @@ ossl_pkcs7_sym2typeid(VALUE sym)
|
|
373
416
|
{ "enveloped", NID_pkcs7_enveloped },
|
374
417
|
{ "encrypted", NID_pkcs7_encrypted },
|
375
418
|
{ "digest", NID_pkcs7_digest },
|
376
|
-
{ NULL, 0 },
|
377
419
|
};
|
378
420
|
|
379
|
-
if(
|
380
|
-
else
|
381
|
-
|
382
|
-
|
421
|
+
if (RB_TYPE_P(sym, T_SYMBOL)) sym = rb_sym2str(sym);
|
422
|
+
else StringValue(sym);
|
423
|
+
RSTRING_GETMEM(sym, s, l);
|
424
|
+
for(i = 0; ; i++){
|
425
|
+
if(i == numberof(p7_type_tab))
|
383
426
|
ossl_raise(ePKCS7Error, "unknown type \"%s\"", s);
|
427
|
+
if(strlen(p7_type_tab[i].name) != l) continue;
|
384
428
|
if(strcmp(p7_type_tab[i].name, s) == 0){
|
385
429
|
ret = p7_type_tab[i].nid;
|
386
430
|
break;
|
@@ -978,7 +1022,7 @@ ossl_pkcs7ri_get_enc_key(VALUE self)
|
|
978
1022
|
* INIT
|
979
1023
|
*/
|
980
1024
|
void
|
981
|
-
Init_ossl_pkcs7()
|
1025
|
+
Init_ossl_pkcs7(void)
|
982
1026
|
{
|
983
1027
|
cPKCS7 = rb_define_class_under(mOSSL, "PKCS7", rb_cObject);
|
984
1028
|
ePKCS7Error = rb_define_class_under(cPKCS7, "PKCS7Error", eOSSLError);
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/*
|
2
|
-
* $Id$
|
2
|
+
* $Id: ossl_pkey.c 48806 2014-12-12 23:19:07Z nobu $
|
3
3
|
* 'OpenSSL for Ruby' project
|
4
4
|
* Copyright (C) 2001-2002 Michal Rokos <m.rokos@sh.cvut.cz>
|
5
5
|
* All rights reserved.
|
@@ -69,9 +69,23 @@ ossl_generate_cb_stop(void *ptr)
|
|
69
69
|
}
|
70
70
|
#endif
|
71
71
|
|
72
|
+
static void
|
73
|
+
ossl_evp_pkey_free(void *ptr)
|
74
|
+
{
|
75
|
+
EVP_PKEY_free(ptr);
|
76
|
+
}
|
77
|
+
|
72
78
|
/*
|
73
79
|
* Public
|
74
80
|
*/
|
81
|
+
const rb_data_type_t ossl_evp_pkey_type = {
|
82
|
+
"OpenSSL/EVP_PKEY",
|
83
|
+
{
|
84
|
+
0, ossl_evp_pkey_free,
|
85
|
+
},
|
86
|
+
0, 0, RUBY_TYPED_FREE_IMMEDIATELY,
|
87
|
+
};
|
88
|
+
|
75
89
|
VALUE
|
76
90
|
ossl_pkey_new(EVP_PKEY *pkey)
|
77
91
|
{
|
@@ -342,7 +356,7 @@ ossl_pkey_verify(VALUE self, VALUE digest, VALUE sig, VALUE data)
|
|
342
356
|
* INIT
|
343
357
|
*/
|
344
358
|
void
|
345
|
-
Init_ossl_pkey()
|
359
|
+
Init_ossl_pkey(void)
|
346
360
|
{
|
347
361
|
#if 0
|
348
362
|
mOSSL = rb_define_module("OpenSSL"); /* let rdoc know about mOSSL */
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/*
|
2
|
-
* $Id$
|
2
|
+
* $Id: ossl_pkey.h 48806 2014-12-12 23:19:07Z nobu $
|
3
3
|
* 'OpenSSL for Ruby' project
|
4
4
|
* Copyright (C) 2001 Michal Rokos <m.rokos@sh.cvut.cz>
|
5
5
|
* All rights reserved.
|
@@ -15,6 +15,7 @@ extern VALUE mPKey;
|
|
15
15
|
extern VALUE cPKey;
|
16
16
|
extern VALUE ePKeyError;
|
17
17
|
extern ID id_private_q;
|
18
|
+
extern const rb_data_type_t ossl_evp_pkey_type;
|
18
19
|
|
19
20
|
#define OSSL_PKEY_SET_PRIVATE(obj) rb_iv_set((obj), "private", Qtrue)
|
20
21
|
#define OSSL_PKEY_SET_PUBLIC(obj) rb_iv_set((obj), "private", Qfalse)
|
@@ -24,11 +25,11 @@ extern ID id_private_q;
|
|
24
25
|
if (!(pkey)) { \
|
25
26
|
rb_raise(rb_eRuntimeError, "PKEY wasn't initialized!"); \
|
26
27
|
} \
|
27
|
-
(obj) =
|
28
|
+
(obj) = TypedData_Wrap_Struct((klass), &ossl_evp_pkey_type, (pkey)); \
|
28
29
|
OSSL_PKEY_SET_PUBLIC(obj); \
|
29
30
|
} while (0)
|
30
31
|
#define GetPKey(obj, pkey) do {\
|
31
|
-
|
32
|
+
TypedData_Get_Struct((obj), EVP_PKEY, &ossl_evp_pkey_type, (pkey)); \
|
32
33
|
if (!(pkey)) { \
|
33
34
|
rb_raise(rb_eRuntimeError, "PKEY wasn't initialized!");\
|
34
35
|
} \
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/*
|
2
|
-
* $Id$
|
2
|
+
* $Id: ossl_pkey_dh.c 47744 2014-09-30 05:25:32Z nobu $
|
3
3
|
* 'OpenSSL for Ruby' project
|
4
4
|
* Copyright (C) 2001-2002 Michal Rokos <m.rokos@sh.cvut.cz>
|
5
5
|
* All rights reserved.
|
@@ -588,7 +588,7 @@ ossl_create_dh(unsigned char *p, size_t plen, unsigned char *g, size_t glen)
|
|
588
588
|
* INIT
|
589
589
|
*/
|
590
590
|
void
|
591
|
-
Init_ossl_dh()
|
591
|
+
Init_ossl_dh(void)
|
592
592
|
{
|
593
593
|
#if 0
|
594
594
|
mOSSL = rb_define_module("OpenSSL"); /* let rdoc know about mOSSL and mPKey */
|
@@ -660,7 +660,7 @@ Init_ossl_dh()
|
|
660
660
|
|
661
661
|
#else /* defined NO_DH */
|
662
662
|
void
|
663
|
-
Init_ossl_dh()
|
663
|
+
Init_ossl_dh(void)
|
664
664
|
{
|
665
665
|
}
|
666
666
|
#endif /* NO_DH */
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/*
|
2
|
-
* $Id$
|
2
|
+
* $Id: ossl_pkey_dsa.c 47744 2014-09-30 05:25:32Z nobu $
|
3
3
|
* 'OpenSSL for Ruby' project
|
4
4
|
* Copyright (C) 2001-2002 Michal Rokos <m.rokos@sh.cvut.cz>
|
5
5
|
* All rights reserved.
|
@@ -563,7 +563,7 @@ OSSL_PKEY_BN(dsa, priv_key)
|
|
563
563
|
* INIT
|
564
564
|
*/
|
565
565
|
void
|
566
|
-
Init_ossl_dsa()
|
566
|
+
Init_ossl_dsa(void)
|
567
567
|
{
|
568
568
|
#if 0
|
569
569
|
mOSSL = rb_define_module("OpenSSL"); /* let rdoc know about mOSSL and mPKey */
|
@@ -617,7 +617,7 @@ Init_ossl_dsa()
|
|
617
617
|
|
618
618
|
#else /* defined NO_DSA */
|
619
619
|
void
|
620
|
-
Init_ossl_dsa()
|
620
|
+
Init_ossl_dsa(void)
|
621
621
|
{
|
622
622
|
}
|
623
623
|
#endif /* NO_DSA */
|
@@ -20,6 +20,8 @@ typedef struct {
|
|
20
20
|
#define EXPORT_PEM 0
|
21
21
|
#define EXPORT_DER 1
|
22
22
|
|
23
|
+
static const rb_data_type_t ossl_ec_group_type;
|
24
|
+
static const rb_data_type_t ossl_ec_point_type;
|
23
25
|
|
24
26
|
#define GetPKeyEC(obj, pkey) do { \
|
25
27
|
GetPKey((obj), (pkey)); \
|
@@ -30,7 +32,7 @@ typedef struct {
|
|
30
32
|
|
31
33
|
#define SafeGet_ec_group(obj, group) do { \
|
32
34
|
OSSL_Check_Kind((obj), cEC_GROUP); \
|
33
|
-
|
35
|
+
TypedData_Get_Struct((obj), ossl_ec_group, &ossl_ec_group_type, (group)); \
|
34
36
|
} while(0)
|
35
37
|
|
36
38
|
#define Get_EC_KEY(obj, key) do { \
|
@@ -52,7 +54,7 @@ typedef struct {
|
|
52
54
|
|
53
55
|
#define Get_EC_GROUP(obj, g) do { \
|
54
56
|
ossl_ec_group *ec_group; \
|
55
|
-
|
57
|
+
TypedData_Get_Struct((obj), ossl_ec_group, &ossl_ec_group_type, ec_group); \
|
56
58
|
if (ec_group == NULL) \
|
57
59
|
ossl_raise(eEC_GROUP, "missing ossl_ec_group structure"); \
|
58
60
|
(g) = ec_group->group; \
|
@@ -71,7 +73,7 @@ typedef struct {
|
|
71
73
|
|
72
74
|
#define Get_EC_POINT(obj, p) do { \
|
73
75
|
ossl_ec_point *ec_point; \
|
74
|
-
|
76
|
+
TypedData_Get_Struct((obj), ossl_ec_point, &ossl_ec_point_type, ec_point); \
|
75
77
|
if (ec_point == NULL) \
|
76
78
|
ossl_raise(eEC_POINT, "missing ossl_ec_point structure"); \
|
77
79
|
(p) = ec_point->point; \
|
@@ -369,7 +371,7 @@ static VALUE ossl_ec_point_dup(const EC_POINT *point, VALUE group_v)
|
|
369
371
|
ossl_ec_point *new_point;
|
370
372
|
|
371
373
|
obj = rb_obj_alloc(cEC_POINT);
|
372
|
-
|
374
|
+
TypedData_Get_Struct(obj, ossl_ec_point, &ossl_ec_point_type, new_point);
|
373
375
|
|
374
376
|
SafeRequire_EC_GROUP(group_v, group);
|
375
377
|
|
@@ -707,19 +709,28 @@ static VALUE ossl_ec_key_dsa_verify_asn1(VALUE self, VALUE data, VALUE sig)
|
|
707
709
|
UNREACHABLE;
|
708
710
|
}
|
709
711
|
|
710
|
-
static void ossl_ec_group_free(
|
712
|
+
static void ossl_ec_group_free(void *ptr)
|
711
713
|
{
|
714
|
+
ossl_ec_group *ec_group = ptr;
|
712
715
|
if (!ec_group->dont_free && ec_group->group)
|
713
716
|
EC_GROUP_clear_free(ec_group->group);
|
714
717
|
ruby_xfree(ec_group);
|
715
718
|
}
|
716
719
|
|
720
|
+
static const rb_data_type_t ossl_ec_group_type = {
|
721
|
+
"OpenSSL/ec_group",
|
722
|
+
{
|
723
|
+
0, ossl_ec_group_free,
|
724
|
+
},
|
725
|
+
0, 0, RUBY_TYPED_FREE_IMMEDIATELY,
|
726
|
+
};
|
727
|
+
|
717
728
|
static VALUE ossl_ec_group_alloc(VALUE klass)
|
718
729
|
{
|
719
730
|
ossl_ec_group *ec_group;
|
720
731
|
VALUE obj;
|
721
732
|
|
722
|
-
obj =
|
733
|
+
obj = TypedData_Make_Struct(klass, ossl_ec_group, &ossl_ec_group_type, ec_group);
|
723
734
|
|
724
735
|
return obj;
|
725
736
|
}
|
@@ -746,7 +757,7 @@ static VALUE ossl_ec_group_initialize(int argc, VALUE *argv, VALUE self)
|
|
746
757
|
ossl_ec_group *ec_group;
|
747
758
|
EC_GROUP *group = NULL;
|
748
759
|
|
749
|
-
|
760
|
+
TypedData_Get_Struct(self, ossl_ec_group, &ossl_ec_group_type, ec_group);
|
750
761
|
if (ec_group->group != NULL)
|
751
762
|
ossl_raise(rb_eRuntimeError, "EC_GROUP is already initialized");
|
752
763
|
|
@@ -1219,19 +1230,28 @@ static VALUE ossl_ec_group_to_text(VALUE self)
|
|
1219
1230
|
}
|
1220
1231
|
|
1221
1232
|
|
1222
|
-
static void ossl_ec_point_free(
|
1233
|
+
static void ossl_ec_point_free(void *ptr)
|
1223
1234
|
{
|
1235
|
+
ossl_ec_point *ec_point = ptr;
|
1224
1236
|
if (!ec_point->dont_free && ec_point->point)
|
1225
1237
|
EC_POINT_clear_free(ec_point->point);
|
1226
1238
|
ruby_xfree(ec_point);
|
1227
1239
|
}
|
1228
1240
|
|
1241
|
+
static const rb_data_type_t ossl_ec_point_type = {
|
1242
|
+
"OpenSSL/ec_point",
|
1243
|
+
{
|
1244
|
+
0, ossl_ec_point_free,
|
1245
|
+
},
|
1246
|
+
0, 0, RUBY_TYPED_FREE_IMMEDIATELY,
|
1247
|
+
};
|
1248
|
+
|
1229
1249
|
static VALUE ossl_ec_point_alloc(VALUE klass)
|
1230
1250
|
{
|
1231
1251
|
ossl_ec_point *ec_point;
|
1232
1252
|
VALUE obj;
|
1233
1253
|
|
1234
|
-
obj =
|
1254
|
+
obj = TypedData_Make_Struct(klass, ossl_ec_point, &ossl_ec_point_type, ec_point);
|
1235
1255
|
|
1236
1256
|
return obj;
|
1237
1257
|
}
|
@@ -1252,7 +1272,7 @@ static VALUE ossl_ec_point_initialize(int argc, VALUE *argv, VALUE self)
|
|
1252
1272
|
VALUE group_v = Qnil;
|
1253
1273
|
const EC_GROUP *group = NULL;
|
1254
1274
|
|
1255
|
-
|
1275
|
+
TypedData_Get_Struct(self, ossl_ec_point, &ossl_ec_point_type, ec_point);
|
1256
1276
|
if (ec_point->point)
|
1257
1277
|
ossl_raise(eEC_POINT, "EC_POINT already initialized");
|
1258
1278
|
|
@@ -1556,7 +1576,7 @@ static void no_copy(VALUE klass)
|
|
1556
1576
|
rb_undef_method(klass, "initialize_copy");
|
1557
1577
|
}
|
1558
1578
|
|
1559
|
-
void Init_ossl_ec()
|
1579
|
+
void Init_ossl_ec(void)
|
1560
1580
|
{
|
1561
1581
|
#ifdef DONT_NEED_RDOC_WORKAROUND
|
1562
1582
|
mOSSL = rb_define_module("OpenSSL");
|
@@ -1677,7 +1697,7 @@ void Init_ossl_ec()
|
|
1677
1697
|
}
|
1678
1698
|
|
1679
1699
|
#else /* defined NO_EC */
|
1680
|
-
void Init_ossl_ec()
|
1700
|
+
void Init_ossl_ec(void)
|
1681
1701
|
{
|
1682
1702
|
}
|
1683
1703
|
#endif /* NO_EC */
|