Skip to content

Commit 2334862

Browse files
committed
pkey: remove deprecated parameter setters
Remove the following methods, which have been marked as deprecated and produced a warning since version 2.0, commit 7ea72f1 ("adapt OpenSSL::PKey to OpenSSL 1.1.0 opaque structs", 2016-06-05). - OpenSSL::PKey::RSA#n=, #e=, #d=, #p=, #q=, #dmp1=, #dmq1=, #iqmp= - OpenSSL::PKey::DSA#p=, #q=, #g=, #priv_key=, #pub_key= - OpenSSL::PKey::DH#p=, #g=, #priv_key=, #pub_key= These methods could only work with OpenSSL 1.0.2 or older, which is now EOL.
1 parent 05e1c01 commit 2334862

File tree

1 file changed

+3
-52
lines changed

1 file changed

+3
-52
lines changed

ext/openssl/ossl_pkey.h

Lines changed: 3 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
* This program is licensed under the same licence as Ruby.
88
* (See the file 'LICENCE'.)
99
*/
10-
#if !defined(_OSSL_PKEY_H_)
11-
#define _OSSL_PKEY_H_
10+
#if !defined(OSSL_PKEY_H)
11+
#define OSSL_PKEY_H
1212

1313
extern VALUE mPKey;
1414
extern VALUE cPKey;
@@ -182,35 +182,6 @@ static VALUE ossl_##_keytype##_set_##_group(VALUE self, VALUE v1, VALUE v2) \
182182
return self; \
183183
}
184184

185-
#define OSSL_PKEY_BN_DEF_SETTER_OLD(_keytype, _type, _group, _name) \
186-
/* \
187-
* call-seq: \
188-
* _keytype##.##_name = bn -> bn \
189-
*/ \
190-
static VALUE ossl_##_keytype##_set_##_name(VALUE self, VALUE bignum) \
191-
{ \
192-
_type *obj; \
193-
BIGNUM *bn; \
194-
\
195-
rb_warning("#"#_name"= is deprecated; use #set_"#_group); \
196-
Get##_type(self, obj); \
197-
if (NIL_P(bignum)) { \
198-
BN_clear_free(obj->_name); \
199-
obj->_name = NULL; \
200-
return Qnil; \
201-
} \
202-
\
203-
bn = GetBNPtr(bignum); \
204-
if (obj->_name == NULL) \
205-
obj->_name = BN_new(); \
206-
if (obj->_name == NULL) \
207-
ossl_raise(eBNError, NULL); \
208-
if (BN_copy(obj->_name, bn) == NULL) \
209-
ossl_raise(eBNError, NULL); \
210-
return bignum; \
211-
}
212-
213-
#if defined(HAVE_OPAQUE_OPENSSL) /* OpenSSL 1.1.0 */
214185
#define OSSL_PKEY_BN_DEF3(_keytype, _type, _group, a1, a2, a3) \
215186
OSSL_PKEY_BN_DEF_GETTER3(_keytype, _type, _group, a1, a2, a3) \
216187
OSSL_PKEY_BN_DEF_SETTER3(_keytype, _type, _group, a1, a2, a3)
@@ -222,24 +193,4 @@ static VALUE ossl_##_keytype##_set_##_name(VALUE self, VALUE bignum) \
222193
#define DEF_OSSL_PKEY_BN(class, keytype, name) \
223194
rb_define_method((class), #name, ossl_##keytype##_get_##name, 0)
224195

225-
#else
226-
#define OSSL_PKEY_BN_DEF3(_keytype, _type, _group, a1, a2, a3) \
227-
OSSL_PKEY_BN_DEF_GETTER3(_keytype, _type, _group, a1, a2, a3) \
228-
OSSL_PKEY_BN_DEF_SETTER3(_keytype, _type, _group, a1, a2, a3) \
229-
OSSL_PKEY_BN_DEF_SETTER_OLD(_keytype, _type, _group, a1) \
230-
OSSL_PKEY_BN_DEF_SETTER_OLD(_keytype, _type, _group, a2) \
231-
OSSL_PKEY_BN_DEF_SETTER_OLD(_keytype, _type, _group, a3)
232-
233-
#define OSSL_PKEY_BN_DEF2(_keytype, _type, _group, a1, a2) \
234-
OSSL_PKEY_BN_DEF_GETTER2(_keytype, _type, _group, a1, a2) \
235-
OSSL_PKEY_BN_DEF_SETTER2(_keytype, _type, _group, a1, a2) \
236-
OSSL_PKEY_BN_DEF_SETTER_OLD(_keytype, _type, _group, a1) \
237-
OSSL_PKEY_BN_DEF_SETTER_OLD(_keytype, _type, _group, a2)
238-
239-
#define DEF_OSSL_PKEY_BN(class, keytype, name) do { \
240-
rb_define_method((class), #name, ossl_##keytype##_get_##name, 0);\
241-
rb_define_method((class), #name "=", ossl_##keytype##_set_##name, 1);\
242-
} while (0)
243-
#endif /* HAVE_OPAQUE_OPENSSL */
244-
245-
#endif /* _OSSL_PKEY_H_ */
196+
#endif /* OSSL_PKEY_H */

0 commit comments

Comments
 (0)