openssl: add 'const's required in OpenSSL master

* ext/openssl/ossl_pkey.h, ext/openssl/ossl_pkey_dh.c,
  ext/openssl/ossl_pkey_dsa.c, ext/openssl/ossl_pkey_rsa.c: A few days
  ago, OpenSSL changed {DH,DSA,RSA}_get0_*() to take const BIGNUM **.
  https://git.openssl.org/gitweb/?p=openssl.git;a=commit;h=fd809cfdbd6e32b6b67b68c59f6d55fbed7a9327
  [ruby-core:75225] [Feature #12324]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55450 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
rhe 2016-06-19 05:31:28 +00:00
parent 0ce3fab422
commit 31388c4a73
6 changed files with 25 additions and 17 deletions

View File

@ -1,3 +1,11 @@
Sun Jun 19 14:31:07 2016 Kazuki Yamaguchi <k@rhe.jp>
* ext/openssl/ossl_pkey.h, ext/openssl/ossl_pkey_dh.c,
ext/openssl/ossl_pkey_dsa.c, ext/openssl/ossl_pkey_rsa.c: A few days
ago, OpenSSL changed {DH,DSA,RSA}_get0_*() to take const BIGNUM **.
https://git.openssl.org/gitweb/?p=openssl.git;a=commit;h=fd809cfdbd6e32b6b67b68c59f6d55fbed7a9327
[ruby-core:75225] [Feature #12324]
Sun Jun 19 11:19:43 2016 Nobuyoshi Nakada <nobu@ruby-lang.org> Sun Jun 19 11:19:43 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
* variable.c (rb_path_to_class): consider the string length * variable.c (rb_path_to_class): consider the string length

View File

@ -179,7 +179,7 @@ void X509_REQ_get0_signature(ASN1_BIT_STRING **psig, X509_ALGOR **palg, X509_REQ
static inline _type *EVP_PKEY_get0_##_type(EVP_PKEY *pkey) { \ static inline _type *EVP_PKEY_get0_##_type(EVP_PKEY *pkey) { \
return pkey->pkey._name; } return pkey->pkey._name; }
#define IMPL_KEY_ACCESSOR2(_type, _group, a1, a2, _fail_cond) \ #define IMPL_KEY_ACCESSOR2(_type, _group, a1, a2, _fail_cond) \
static inline void _type##_get0_##_group(_type *obj, BIGNUM **a1, BIGNUM **a2) { \ static inline void _type##_get0_##_group(_type *obj, const BIGNUM **a1, const BIGNUM **a2) { \
if (a1) *a1 = obj->a1; \ if (a1) *a1 = obj->a1; \
if (a2) *a2 = obj->a2; } \ if (a2) *a2 = obj->a2; } \
static inline int _type##_set0_##_group(_type *obj, BIGNUM *a1, BIGNUM *a2) { \ static inline int _type##_set0_##_group(_type *obj, BIGNUM *a1, BIGNUM *a2) { \
@ -188,7 +188,7 @@ static inline int _type##_set0_##_group(_type *obj, BIGNUM *a1, BIGNUM *a2) { \
BN_clear_free(obj->a2); obj->a2 = a2; \ BN_clear_free(obj->a2); obj->a2 = a2; \
return 1; } return 1; }
#define IMPL_KEY_ACCESSOR3(_type, _group, a1, a2, a3, _fail_cond) \ #define IMPL_KEY_ACCESSOR3(_type, _group, a1, a2, a3, _fail_cond) \
static inline void _type##_get0_##_group(_type *obj, BIGNUM **a1, BIGNUM **a2, BIGNUM **a3) { \ static inline void _type##_get0_##_group(_type *obj, const BIGNUM **a1, const BIGNUM **a2, const BIGNUM **a3) { \
if (a1) *a1 = obj->a1; \ if (a1) *a1 = obj->a1; \
if (a2) *a2 = obj->a2; \ if (a2) *a2 = obj->a2; \
if (a3) *a3 = obj->a3; } \ if (a3) *a3 = obj->a3; } \

View File

@ -103,7 +103,7 @@ void Init_ossl_ec(void);
static VALUE ossl_##_keytype##_get_##_name(VALUE self) \ static VALUE ossl_##_keytype##_get_##_name(VALUE self) \
{ \ { \
_type *obj; \ _type *obj; \
BIGNUM *bn; \ const BIGNUM *bn; \
\ \
Get##_type(self, obj); \ Get##_type(self, obj); \
_get; \ _get; \

View File

@ -249,7 +249,7 @@ static VALUE
ossl_dh_is_public(VALUE self) ossl_dh_is_public(VALUE self)
{ {
DH *dh; DH *dh;
BIGNUM *bn; const BIGNUM *bn;
GetDH(self, dh); GetDH(self, dh);
DH_get0_key(dh, &bn, NULL); DH_get0_key(dh, &bn, NULL);
@ -268,7 +268,7 @@ static VALUE
ossl_dh_is_private(VALUE self) ossl_dh_is_private(VALUE self)
{ {
DH *dh; DH *dh;
BIGNUM *bn; const BIGNUM *bn;
GetDH(self, dh); GetDH(self, dh);
DH_get0_key(dh, NULL, &bn); DH_get0_key(dh, NULL, &bn);
@ -352,7 +352,7 @@ ossl_dh_get_params(VALUE self)
{ {
DH *dh; DH *dh;
VALUE hash; VALUE hash;
BIGNUM *p, *q, *g, *pub_key, *priv_key; const BIGNUM *p, *q, *g, *pub_key, *priv_key;
GetDH(self, dh); GetDH(self, dh);
DH_get0_pqg(dh, &p, &q, &g); DH_get0_pqg(dh, &p, &q, &g);
@ -498,7 +498,7 @@ static VALUE
ossl_dh_compute_key(VALUE self, VALUE pub) ossl_dh_compute_key(VALUE self, VALUE pub)
{ {
DH *dh; DH *dh;
BIGNUM *pub_key, *dh_p; const BIGNUM *pub_key, *dh_p;
VALUE str; VALUE str;
int len; int len;

View File

@ -26,7 +26,7 @@
static inline int static inline int
DSA_HAS_PRIVATE(DSA *dsa) DSA_HAS_PRIVATE(DSA *dsa)
{ {
BIGNUM *bn; const BIGNUM *bn;
DSA_get0_key(dsa, NULL, &bn); DSA_get0_key(dsa, NULL, &bn);
return !!bn; return !!bn;
} }
@ -280,7 +280,7 @@ static VALUE
ossl_dsa_is_public(VALUE self) ossl_dsa_is_public(VALUE self)
{ {
DSA *dsa; DSA *dsa;
BIGNUM *bn; const BIGNUM *bn;
GetDSA(self, dsa); GetDSA(self, dsa);
DSA_get0_key(dsa, &bn, NULL); DSA_get0_key(dsa, &bn, NULL);
@ -402,7 +402,7 @@ ossl_dsa_get_params(VALUE self)
{ {
DSA *dsa; DSA *dsa;
VALUE hash; VALUE hash;
BIGNUM *p, *q, *g, *pub_key, *priv_key; const BIGNUM *p, *q, *g, *pub_key, *priv_key;
GetDSA(self, dsa); GetDSA(self, dsa);
DSA_get0_pqg(dsa, &p, &q, &g); DSA_get0_pqg(dsa, &p, &q, &g);
@ -509,7 +509,7 @@ static VALUE
ossl_dsa_sign(VALUE self, VALUE data) ossl_dsa_sign(VALUE self, VALUE data)
{ {
DSA *dsa; DSA *dsa;
BIGNUM *dsa_q; const BIGNUM *dsa_q;
unsigned int buf_len; unsigned int buf_len;
VALUE str; VALUE str;

View File

@ -26,7 +26,7 @@
static inline int static inline int
RSA_HAS_PRIVATE(RSA *rsa) RSA_HAS_PRIVATE(RSA *rsa)
{ {
BIGNUM *p, *q; const BIGNUM *p, *q;
RSA_get0_factors(rsa, &p, &q); RSA_get0_factors(rsa, &p, &q);
return p && q; /* d? why? */ return p && q; /* d? why? */
@ -398,7 +398,7 @@ static VALUE
ossl_rsa_public_encrypt(int argc, VALUE *argv, VALUE self) ossl_rsa_public_encrypt(int argc, VALUE *argv, VALUE self)
{ {
RSA *rsa; RSA *rsa;
BIGNUM *rsa_n; const BIGNUM *rsa_n;
int buf_len, pad; int buf_len, pad;
VALUE str, buffer, padding; VALUE str, buffer, padding;
@ -430,7 +430,7 @@ static VALUE
ossl_rsa_public_decrypt(int argc, VALUE *argv, VALUE self) ossl_rsa_public_decrypt(int argc, VALUE *argv, VALUE self)
{ {
RSA *rsa; RSA *rsa;
BIGNUM *rsa_n; const BIGNUM *rsa_n;
int buf_len, pad; int buf_len, pad;
VALUE str, buffer, padding; VALUE str, buffer, padding;
@ -462,7 +462,7 @@ static VALUE
ossl_rsa_private_encrypt(int argc, VALUE *argv, VALUE self) ossl_rsa_private_encrypt(int argc, VALUE *argv, VALUE self)
{ {
RSA *rsa; RSA *rsa;
BIGNUM *rsa_n; const BIGNUM *rsa_n;
int buf_len, pad; int buf_len, pad;
VALUE str, buffer, padding; VALUE str, buffer, padding;
@ -496,7 +496,7 @@ static VALUE
ossl_rsa_private_decrypt(int argc, VALUE *argv, VALUE self) ossl_rsa_private_decrypt(int argc, VALUE *argv, VALUE self)
{ {
RSA *rsa; RSA *rsa;
BIGNUM *rsa_n; const BIGNUM *rsa_n;
int buf_len, pad; int buf_len, pad;
VALUE str, buffer, padding; VALUE str, buffer, padding;
@ -534,7 +534,7 @@ ossl_rsa_get_params(VALUE self)
{ {
RSA *rsa; RSA *rsa;
VALUE hash; VALUE hash;
BIGNUM *n, *e, *d, *p, *q, *dmp1, *dmq1, *iqmp; const BIGNUM *n, *e, *d, *p, *q, *dmp1, *dmq1, *iqmp;
GetRSA(self, rsa); GetRSA(self, rsa);
RSA_get0_key(rsa, &n, &e, &d); RSA_get0_key(rsa, &n, &e, &d);