summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
Diffstat (limited to 'ext')
-rw-r--r--ext/bigdecimal/bigdecimal.c8
-rw-r--r--ext/openssl/ossl_cipher.c2
-rw-r--r--ext/openssl/ossl_ns_spki.c8
-rw-r--r--ext/openssl/ossl_ocsp.c48
-rw-r--r--ext/openssl/ossl_pkcs12.c12
-rw-r--r--ext/openssl/ossl_pkcs7.c38
-rw-r--r--ext/openssl/ossl_pkey.h16
-rw-r--r--ext/openssl/ossl_pkey_dh.c4
-rw-r--r--ext/openssl/ossl_pkey_dsa.c4
9 files changed, 70 insertions, 70 deletions
diff --git a/ext/bigdecimal/bigdecimal.c b/ext/bigdecimal/bigdecimal.c
index 83d090280d..53fb678d12 100644
--- a/ext/bigdecimal/bigdecimal.c
+++ b/ext/bigdecimal/bigdecimal.c
@@ -2237,11 +2237,11 @@ static int gnAlloc=0; /* Memory allocation counter */
VP_EXPORT void *
VpMemAlloc(size_t mb)
{
- void *p = xmalloc(mb);
- if (!p) {
- VpException(VP_EXCEPTION_MEMORY, "failed to allocate memory", 1);
+ void *p = xmalloc((unsigned int)mb);
+ if(!p) {
+ VpException(VP_EXCEPTION_MEMORY,"failed to allocate memory",1);
}
- memset(p, 0, mb);
+ memset(p,0,mb);
#ifdef BIGDECIMAL_DEBUG
gnAlloc++; /* Count allocation call */
#endif /* BIGDECIMAL_DEBUG */
diff --git a/ext/openssl/ossl_cipher.c b/ext/openssl/ossl_cipher.c
index 485626fe62..84b51a0101 100644
--- a/ext/openssl/ossl_cipher.c
+++ b/ext/openssl/ossl_cipher.c
@@ -202,7 +202,7 @@ ossl_cipher_init(int argc, VALUE *argv, VALUE self, int mode)
* keeping this behaviour for backward compatibility.
*/
const char *cname = rb_class2name(rb_obj_class(self));
- rb_warn("arguments for %s#encrypt and %s#decrypt were deprecated; "
+ rb_warn("argumtents for %s#encrypt and %s#decrypt were deprecated; "
"use %s#pkcs5_keyivgen to derive key and IV",
cname, cname, cname);
StringValue(pass);
diff --git a/ext/openssl/ossl_ns_spki.c b/ext/openssl/ossl_ns_spki.c
index fde8957206..b67dd225a1 100644
--- a/ext/openssl/ossl_ns_spki.c
+++ b/ext/openssl/ossl_ns_spki.c
@@ -11,14 +11,14 @@
#include "ossl.h"
#define WrapSPKI(klass, obj, spki) do { \
- if (!(spki)) { \
+ if (!spki) { \
ossl_raise(rb_eRuntimeError, "SPKI wasn't initialized!"); \
} \
- (obj) = Data_Wrap_Struct((klass), 0, NETSCAPE_SPKI_free, (spki)); \
+ obj = Data_Wrap_Struct(klass, 0, NETSCAPE_SPKI_free, spki); \
} while (0)
#define GetSPKI(obj, spki) do { \
- Data_Get_Struct((obj), NETSCAPE_SPKI, (spki)); \
- if (!(spki)) { \
+ Data_Get_Struct(obj, NETSCAPE_SPKI, spki); \
+ if (!spki) { \
ossl_raise(rb_eRuntimeError, "SPKI wasn't initialized!"); \
} \
} while (0)
diff --git a/ext/openssl/ossl_ocsp.c b/ext/openssl/ossl_ocsp.c
index dc4d4fb2af..fb01243261 100644
--- a/ext/openssl/ossl_ocsp.c
+++ b/ext/openssl/ossl_ocsp.c
@@ -14,55 +14,55 @@
#if defined(OSSL_OCSP_ENABLED)
#define WrapOCSPReq(klass, obj, req) do { \
- if(!(req)) ossl_raise(rb_eRuntimeError, "Request wasn't initialized!"); \
- (obj) = Data_Wrap_Struct((klass), 0, OCSP_REQUEST_free, (req)); \
+ if(!req) ossl_raise(rb_eRuntimeError, "Request wasn't initialized!"); \
+ obj = Data_Wrap_Struct(klass, 0, OCSP_REQUEST_free, req); \
} while (0)
#define GetOCSPReq(obj, req) do { \
- Data_Get_Struct((obj), OCSP_REQUEST, (req)); \
- if(!(req)) ossl_raise(rb_eRuntimeError, "Request wasn't initialized!"); \
+ Data_Get_Struct(obj, OCSP_REQUEST, req); \
+ if(!req) ossl_raise(rb_eRuntimeError, "Request wasn't initialized!"); \
} while (0)
#define SafeGetOCSPReq(obj, req) do { \
- OSSL_Check_Kind((obj), cOCSPReq); \
- GetOCSPReq((obj), (req)); \
+ OSSL_Check_Kind(obj, cOCSPReq); \
+ GetOCSPReq(obj, req); \
} while (0)
#define WrapOCSPRes(klass, obj, res) do { \
- if(!(res)) ossl_raise(rb_eRuntimeError, "Response wasn't initialized!"); \
- (obj) = Data_Wrap_Struct((klass), 0, OCSP_RESPONSE_free, (res)); \
+ if(!res) ossl_raise(rb_eRuntimeError, "Response wasn't initialized!"); \
+ obj = Data_Wrap_Struct(klass, 0, OCSP_RESPONSE_free, res); \
} while (0)
#define GetOCSPRes(obj, res) do { \
- Data_Get_Struct((obj), OCSP_RESPONSE, (res)); \
- if(!(res)) ossl_raise(rb_eRuntimeError, "Response wasn't initialized!"); \
+ Data_Get_Struct(obj, OCSP_RESPONSE, res); \
+ if(!res) ossl_raise(rb_eRuntimeError, "Response wasn't initialized!"); \
} while (0)
#define SafeGetOCSPRes(obj, res) do { \
- OSSL_Check_Kind((obj), cOCSPRes); \
- GetOCSPRes((obj), (res)); \
+ OSSL_Check_Kind(obj, cOCSPRes); \
+ GetOCSPRes(obj, res); \
} while (0)
#define WrapOCSPBasicRes(klass, obj, res) do { \
- if(!(res)) ossl_raise(rb_eRuntimeError, "Response wasn't initialized!"); \
- (obj) = Data_Wrap_Struct((klass), 0, OCSP_BASICRESP_free, (res)); \
+ if(!res) ossl_raise(rb_eRuntimeError, "Response wasn't initialized!"); \
+ obj = Data_Wrap_Struct(klass, 0, OCSP_BASICRESP_free, res); \
} while (0)
#define GetOCSPBasicRes(obj, res) do { \
- Data_Get_Struct((obj), OCSP_BASICRESP, (res)); \
- if(!(res)) ossl_raise(rb_eRuntimeError, "Response wasn't initialized!"); \
+ Data_Get_Struct(obj, OCSP_BASICRESP, res); \
+ if(!res) ossl_raise(rb_eRuntimeError, "Response wasn't initialized!"); \
} while (0)
#define SafeGetOCSPBasicRes(obj, res) do { \
- OSSL_Check_Kind((obj), cOCSPBasicRes); \
- GetOCSPBasicRes((obj), (res)); \
+ OSSL_Check_Kind(obj, cOCSPBasicRes); \
+ GetOCSPBasicRes(obj, res); \
} while (0)
#define WrapOCSPCertId(klass, obj, cid) do { \
- if(!(cid)) ossl_raise(rb_eRuntimeError, "Cert ID wasn't initialized!"); \
- (obj) = Data_Wrap_Struct((klass), 0, OCSP_CERTID_free, (cid)); \
+ if(!cid) ossl_raise(rb_eRuntimeError, "Cert ID wasn't initialized!"); \
+ obj = Data_Wrap_Struct(klass, 0, OCSP_CERTID_free, cid); \
} while (0)
#define GetOCSPCertId(obj, cid) do { \
- Data_Get_Struct((obj), OCSP_CERTID, (cid)); \
- if(!(cid)) ossl_raise(rb_eRuntimeError, "Cert ID wasn't initialized!"); \
+ Data_Get_Struct(obj, OCSP_CERTID, cid); \
+ if(!cid) ossl_raise(rb_eRuntimeError, "Cert ID wasn't initialized!"); \
} while (0)
#define SafeGetOCSPCertId(obj, cid) do { \
- OSSL_Check_Kind((obj), cOCSPCertId); \
- GetOCSPCertId((obj), (cid)); \
+ OSSL_Check_Kind(obj, cOCSPCertId); \
+ GetOCSPCertId(obj, cid); \
} while (0)
VALUE mOCSP;
diff --git a/ext/openssl/ossl_pkcs12.c b/ext/openssl/ossl_pkcs12.c
index 3628374b4e..85e092b251 100644
--- a/ext/openssl/ossl_pkcs12.c
+++ b/ext/openssl/ossl_pkcs12.c
@@ -6,18 +6,18 @@
#include "ossl.h"
#define WrapPKCS12(klass, obj, p12) do { \
- if(!(p12)) ossl_raise(rb_eRuntimeError, "PKCS12 wasn't initialized."); \
- (obj) = Data_Wrap_Struct((klass), 0, PKCS12_free, (p12)); \
+ if(!p12) ossl_raise(rb_eRuntimeError, "PKCS12 wasn't initialized."); \
+ obj = Data_Wrap_Struct(klass, 0, PKCS12_free, p12); \
} while (0)
#define GetPKCS12(obj, p12) do { \
- Data_Get_Struct((obj), PKCS12, (p12)); \
- if(!(p12)) ossl_raise(rb_eRuntimeError, "PKCS12 wasn't initialized."); \
+ Data_Get_Struct(obj, PKCS12, p12); \
+ if(!p12) ossl_raise(rb_eRuntimeError, "PKCS12 wasn't initialized."); \
} while (0)
#define SafeGetPKCS12(obj, p12) do { \
- OSSL_Check_Kind((obj), cPKCS12); \
- GetPKCS12((obj), (p12)); \
+ OSSL_Check_Kind(obj, cPKCS12); \
+ GetPKCS12(obj, p12); \
} while (0)
#define ossl_pkcs12_set_key(o,v) rb_iv_set((o), "@key", (v))
diff --git a/ext/openssl/ossl_pkcs7.c b/ext/openssl/ossl_pkcs7.c
index e25c8bc5c1..9842d4e941 100644
--- a/ext/openssl/ossl_pkcs7.c
+++ b/ext/openssl/ossl_pkcs7.c
@@ -11,57 +11,57 @@
#include "ossl.h"
#define WrapPKCS7(klass, obj, pkcs7) do { \
- if (!(pkcs7)) { \
+ if (!pkcs7) { \
ossl_raise(rb_eRuntimeError, "PKCS7 wasn't initialized."); \
} \
- (obj) = Data_Wrap_Struct((klass), 0, PKCS7_free, (pkcs7)); \
+ obj = Data_Wrap_Struct(klass, 0, PKCS7_free, pkcs7); \
} while (0)
#define GetPKCS7(obj, pkcs7) do { \
- Data_Get_Struct((obj), PKCS7, (pkcs7)); \
- if (!(pkcs7)) { \
+ Data_Get_Struct(obj, PKCS7, pkcs7); \
+ if (!pkcs7) { \
ossl_raise(rb_eRuntimeError, "PKCS7 wasn't initialized."); \
} \
} while (0)
#define SafeGetPKCS7(obj, pkcs7) do { \
- OSSL_Check_Kind((obj), cPKCS7); \
- GetPKCS7((obj), (pkcs7)); \
+ OSSL_Check_Kind(obj, cPKCS7); \
+ GetPKCS7(obj, pkcs7); \
} while (0)
#define WrapPKCS7si(klass, obj, p7si) do { \
- if (!(p7si)) { \
+ if (!p7si) { \
ossl_raise(rb_eRuntimeError, "PKCS7si wasn't initialized."); \
} \
- (obj) = Data_Wrap_Struct((klass), 0, PKCS7_SIGNER_INFO_free, (p7si)); \
+ obj = Data_Wrap_Struct(klass, 0, PKCS7_SIGNER_INFO_free, p7si); \
} while (0)
#define GetPKCS7si(obj, p7si) do { \
- Data_Get_Struct((obj), PKCS7_SIGNER_INFO, (p7si)); \
- if (!(p7si)) { \
+ Data_Get_Struct(obj, PKCS7_SIGNER_INFO, p7si); \
+ if (!p7si) { \
ossl_raise(rb_eRuntimeError, "PKCS7si wasn't initialized."); \
} \
} while (0)
#define SafeGetPKCS7si(obj, p7si) do { \
- OSSL_Check_Kind((obj), cPKCS7Signer); \
- GetPKCS7si((obj), (p7si)); \
+ OSSL_Check_Kind(obj, cPKCS7Signer); \
+ GetPKCS7si(obj, p7si); \
} while (0)
#define WrapPKCS7ri(klass, obj, p7ri) do { \
- if (!(p7ri)) { \
+ if (!p7ri) { \
ossl_raise(rb_eRuntimeError, "PKCS7ri wasn't initialized."); \
} \
- (obj) = Data_Wrap_Struct((klass), 0, PKCS7_RECIP_INFO_free, (p7ri)); \
+ obj = Data_Wrap_Struct(klass, 0, PKCS7_RECIP_INFO_free, p7ri); \
} while (0)
#define GetPKCS7ri(obj, p7ri) do { \
- Data_Get_Struct((obj), PKCS7_RECIP_INFO, (p7ri)); \
- if (!(p7ri)) { \
+ Data_Get_Struct(obj, PKCS7_RECIP_INFO, p7ri); \
+ if (!p7ri) { \
ossl_raise(rb_eRuntimeError, "PKCS7ri wasn't initialized."); \
} \
} while (0)
#define SafeGetPKCS7ri(obj, p7ri) do { \
- OSSL_Check_Kind((obj), cPKCS7Recipient); \
- GetPKCS7ri((obj), (p7ri)); \
+ OSSL_Check_Kind(obj, cPKCS7Recipient); \
+ GetPKCS7ri(obj, p7ri); \
} while (0)
-#define numberof(ary) (int)(sizeof(ary)/sizeof((ary)[0]))
+#define numberof(ary) (int)(sizeof(ary)/sizeof(ary[0]))
#define ossl_pkcs7_set_data(o,v) rb_iv_set((o), "@data", (v))
#define ossl_pkcs7_get_data(o) rb_iv_get((o), "@data")
diff --git a/ext/openssl/ossl_pkey.h b/ext/openssl/ossl_pkey.h
index 5e3329d326..67ff1fddd0 100644
--- a/ext/openssl/ossl_pkey.h
+++ b/ext/openssl/ossl_pkey.h
@@ -21,21 +21,21 @@ extern ID id_private_q;
#define OSSL_PKEY_IS_PRIVATE(obj) (rb_iv_get((obj), "private") == Qtrue)
#define WrapPKey(klass, obj, pkey) do { \
- if (!(pkey)) { \
+ if (!pkey) { \
rb_raise(rb_eRuntimeError, "PKEY wasn't initialized!"); \
} \
- (obj) = Data_Wrap_Struct((klass), 0, EVP_PKEY_free, (pkey)); \
+ obj = Data_Wrap_Struct(klass, 0, EVP_PKEY_free, pkey); \
OSSL_PKEY_SET_PUBLIC(obj); \
} while (0)
#define GetPKey(obj, pkey) do {\
- Data_Get_Struct((obj), EVP_PKEY, (pkey));\
- if (!(pkey)) { \
+ Data_Get_Struct(obj, EVP_PKEY, pkey);\
+ if (!pkey) { \
rb_raise(rb_eRuntimeError, "PKEY wasn't initialized!");\
} \
} while (0)
#define SafeGetPKey(obj, pkey) do { \
- OSSL_Check_Kind((obj), cPKey); \
- GetPKey((obj), (pkey)); \
+ OSSL_Check_Kind(obj, cPKey); \
+ GetPKey(obj, pkey); \
} while (0)
void ossl_generate_cb(int, int, void *);
@@ -134,8 +134,8 @@ static VALUE ossl_##keytype##_set_##name(VALUE self, VALUE bignum) \
#define DEF_OSSL_PKEY_BN(class, keytype, name) \
do { \
- rb_define_method((class), #name, ossl_##keytype##_get_##name, 0); \
- rb_define_method((class), #name "=", ossl_##keytype##_set_##name, 1);\
+ rb_define_method(class, #name, ossl_##keytype##_get_##name, 0); \
+ rb_define_method(class, #name "=", ossl_##keytype##_set_##name, 1);\
} while (0)
#endif /* _OSSL_PKEY_H_ */
diff --git a/ext/openssl/ossl_pkey_dh.c b/ext/openssl/ossl_pkey_dh.c
index 4311fa1e96..5ea575eaf9 100644
--- a/ext/openssl/ossl_pkey_dh.c
+++ b/ext/openssl/ossl_pkey_dh.c
@@ -13,8 +13,8 @@
#include "ossl.h"
#define GetPKeyDH(obj, pkey) do { \
- GetPKey((obj), (pkey)); \
- if (EVP_PKEY_type((pkey)->type) != EVP_PKEY_DH) { /* PARANOIA? */ \
+ GetPKey(obj, pkey); \
+ if (EVP_PKEY_type(pkey->type) != EVP_PKEY_DH) { /* PARANOIA? */ \
ossl_raise(rb_eRuntimeError, "THIS IS NOT A DH!") ; \
} \
} while (0)
diff --git a/ext/openssl/ossl_pkey_dsa.c b/ext/openssl/ossl_pkey_dsa.c
index 65550ca351..e66f4ed009 100644
--- a/ext/openssl/ossl_pkey_dsa.c
+++ b/ext/openssl/ossl_pkey_dsa.c
@@ -13,8 +13,8 @@
#include "ossl.h"
#define GetPKeyDSA(obj, pkey) do { \
- GetPKey((obj), (pkey)); \
- if (EVP_PKEY_type((pkey)->type) != EVP_PKEY_DSA) { /* PARANOIA? */ \
+ GetPKey(obj, pkey); \
+ if (EVP_PKEY_type(pkey->type) != EVP_PKEY_DSA) { /* PARANOIA? */ \
ossl_raise(rb_eRuntimeError, "THIS IS NOT A DSA!"); \
} \
} while (0)