summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ext/digest/sha2/sha2.c2
-rw-r--r--ext/openssl/ossl.c6
-rw-r--r--ext/openssl/ossl_asn1.c2
-rw-r--r--ext/openssl/ossl_bn.c8
-rw-r--r--ext/openssl/ossl_cipher.c6
-rw-r--r--ext/openssl/ossl_config.c2
-rw-r--r--ext/openssl/ossl_digest.c2
-rw-r--r--ext/openssl/ossl_hmac.c12
-rw-r--r--ext/openssl/ossl_ns_spki.c22
-rw-r--r--ext/openssl/ossl_pkcs7.c10
-rw-r--r--ext/openssl/ossl_pkey.c14
-rw-r--r--ext/openssl/ossl_pkey_dh.c8
-rw-r--r--ext/openssl/ossl_pkey_dsa.c12
-rw-r--r--ext/openssl/ossl_pkey_ec.c4
-rw-r--r--ext/openssl/ossl_pkey_rsa.c12
-rw-r--r--ext/openssl/ossl_rand.c10
-rw-r--r--ext/openssl/ossl_x509cert.c44
-rw-r--r--ext/openssl/ossl_x509crl.c8
-rw-r--r--ext/openssl/ossl_x509ext.c10
-rw-r--r--ext/openssl/ossl_x509name.c4
-rw-r--r--ext/openssl/ossl_x509req.c18
-rw-r--r--ext/openssl/ossl_x509revoked.c6
-rw-r--r--ext/socket/getaddrinfo.c16
-rw-r--r--ext/socket/getnameinfo.c8
24 files changed, 123 insertions, 123 deletions
diff --git a/ext/digest/sha2/sha2.c b/ext/digest/sha2/sha2.c
index 60e47c2..ac7f7b5 100644
--- a/ext/digest/sha2/sha2.c
+++ b/ext/digest/sha2/sha2.c
@@ -490,7 +490,7 @@ void SHA256_Transform(SHA256_CTX* context, const sha2_word32* data) {
/* Part of the message block expansion: */
s0 = W256[(j+1)&0x0f];
s0 = sigma0_256(s0);
- s1 = W256[(j+14)&0x0f];
+ s1 = W256[(j+14)&0x0f];
s1 = sigma1_256(s1);
/* Apply the SHA-256 compression function to update a..h */
diff --git a/ext/openssl/ossl.c b/ext/openssl/ossl.c
index 510fbdf..b3f76c2 100644
--- a/ext/openssl/ossl.c
+++ b/ext/openssl/ossl.c
@@ -143,7 +143,7 @@ ossl_buf2str(char *buf, int len)
*/
static VALUE
ossl_pem_passwd_cb0(VALUE flag)
-{
+{
VALUE pass;
pass = rb_yield(flag);
@@ -360,7 +360,7 @@ void
ossl_debug(const char *fmt, ...)
{
va_list args;
-
+
if (dOSSL == Qtrue) {
fprintf(stderr, "OSSL_DEBUG: ");
va_start(args, fmt);
@@ -393,7 +393,7 @@ ossl_debug_set(VALUE self, VALUE val)
{
VALUE old = dOSSL;
dOSSL = val;
-
+
if (old != dOSSL) {
if (dOSSL == Qtrue) {
CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON);
diff --git a/ext/openssl/ossl_asn1.c b/ext/openssl/ossl_asn1.c
index 5068876..6682cb7 100644
--- a/ext/openssl/ossl_asn1.c
+++ b/ext/openssl/ossl_asn1.c
@@ -30,7 +30,7 @@ asn1time_to_time(ASN1_TIME *time)
if (!time || !time->data) return Qnil;
memset(&tm, 0, sizeof(struct tm));
-
+
switch (time->type) {
case V_ASN1_UTCTIME:
if (sscanf((const char *)time->data, "%2d%2d%2d%2d%2d%2dZ", &tm.tm_year, &tm.tm_mon,
diff --git a/ext/openssl/ossl_bn.c b/ext/openssl/ossl_bn.c
index 350e465..bec5135 100644
--- a/ext/openssl/ossl_bn.c
+++ b/ext/openssl/ossl_bn.c
@@ -91,7 +91,7 @@ ossl_bn_alloc(VALUE klass)
{
BIGNUM *bn;
VALUE obj;
-
+
if (!(bn = BN_new())) {
ossl_raise(eBNError, NULL);
}
@@ -573,7 +573,7 @@ ossl_bn_s_generate_prime(int argc, VALUE *argv, VALUE klass)
VALUE vnum, vsafe, vadd, vrem, obj;
rb_scan_args(argc, argv, "13", &vnum, &vsafe, &vadd, &vrem);
-
+
num = NUM2INT(vnum);
if (vsafe == Qfalse) {
@@ -745,7 +745,7 @@ Init_ossl_bn()
rb_define_alloc_func(cBN, ossl_bn_alloc);
rb_define_method(cBN, "initialize", ossl_bn_initialize, -1);
-
+
rb_define_copy_func(cBN, ossl_bn_copy);
rb_define_method(cBN, "copy", ossl_bn_copy, 1);
@@ -830,7 +830,7 @@ Init_ossl_bn()
rb_define_alias(cBN, "to_int", "to_i");
rb_define_method(cBN, "to_bn", ossl_bn_to_bn, 0);
rb_define_method(cBN, "coerce", ossl_bn_coerce, 1);
-
+
/*
* TODO:
* But how to: from_bin, from_mpi? PACK?
diff --git a/ext/openssl/ossl_cipher.c b/ext/openssl/ossl_cipher.c
index 73f2c58..41dc6b7 100644
--- a/ext/openssl/ossl_cipher.c
+++ b/ext/openssl/ossl_cipher.c
@@ -79,7 +79,7 @@ ossl_cipher_alloc(VALUE klass)
MakeCipher(obj, klass, ctx);
EVP_CIPHER_CTX_init(ctx);
-
+
return obj;
}
@@ -112,7 +112,7 @@ static VALUE
ossl_cipher_copy(VALUE self, VALUE other)
{
EVP_CIPHER_CTX *ctx1, *ctx2;
-
+
rb_check_frozen(self);
if (self == other) return self;
@@ -170,7 +170,7 @@ ossl_cipher_reset(VALUE self)
GetCipher(self, ctx);
if (EVP_CipherInit_ex(ctx, NULL, NULL, NULL, NULL, -1) != 1)
ossl_raise(eCipherError, NULL);
-
+
return self;
}
diff --git a/ext/openssl/ossl_config.c b/ext/openssl/ossl_config.c
index c7a2bf4..aae3b94 100644
--- a/ext/openssl/ossl_config.c
+++ b/ext/openssl/ossl_config.c
@@ -298,7 +298,7 @@ ossl_config_get_section(VALUE self, VALUE section)
return hash;
}
for (i=0; i<entries; i++) {
- entry = sk_CONF_VALUE_value(sk, i);
+ entry = sk_CONF_VALUE_value(sk, i);
rb_hash_aset(hash, rb_str_new2(entry->name), rb_str_new2(entry->value));
}
diff --git a/ext/openssl/ossl_digest.c b/ext/openssl/ossl_digest.c
index 506d480..04679d3 100644
--- a/ext/openssl/ossl_digest.c
+++ b/ext/openssl/ossl_digest.c
@@ -241,7 +241,7 @@ Init_ossl_digest()
cDigest = rb_define_class_under(mOSSL, "Digest", rb_path2class("Digest::Class"));
eDigestError = rb_define_class_under(cDigest, "DigestError", eOSSLError);
-
+
rb_define_alloc_func(cDigest, ossl_digest_alloc);
rb_define_method(cDigest, "initialize", ossl_digest_initialize, -1);
diff --git a/ext/openssl/ossl_hmac.c b/ext/openssl/ossl_hmac.c
index f26a6f5..d9a425e 100644
--- a/ext/openssl/ossl_hmac.c
+++ b/ext/openssl/ossl_hmac.c
@@ -53,7 +53,7 @@ ossl_hmac_alloc(VALUE klass)
MakeHMAC(obj, klass, ctx);
HMAC_CTX_init(ctx);
-
+
return obj;
}
@@ -135,7 +135,7 @@ ossl_hmac_digest(VALUE self)
unsigned char *buf;
unsigned int buf_len;
VALUE digest;
-
+
GetHMAC(self, ctx);
hmac_final(ctx, &buf, &buf_len);
digest = ossl_buf2str((char *)buf, buf_len);
@@ -156,7 +156,7 @@ ossl_hmac_hexdigest(VALUE self)
char *hexbuf;
unsigned int buf_len;
VALUE hexdigest;
-
+
GetHMAC(self, ctx);
hmac_final(ctx, &buf, &buf_len);
if (string2hex(buf, buf_len, &hexbuf, NULL) != 2 * buf_len) {
@@ -195,7 +195,7 @@ ossl_hmac_s_digest(VALUE klass, VALUE digest, VALUE key, VALUE data)
{
unsigned char *buf;
unsigned int buf_len;
-
+
StringValue(key);
StringValue(data);
buf = HMAC(GetDigestPtr(digest), RSTRING_PTR(key), RSTRING_LEN(key),
@@ -219,7 +219,7 @@ ossl_hmac_s_hexdigest(VALUE klass, VALUE digest, VALUE key, VALUE data)
StringValue(key);
StringValue(data);
-
+
buf = HMAC(GetDigestPtr(digest), RSTRING_PTR(key), RSTRING_LEN(key),
(unsigned char *)RSTRING_PTR(data), RSTRING_LEN(data), NULL, &buf_len);
if (string2hex(buf, buf_len, &hexbuf, NULL) != 2 * buf_len) {
@@ -241,7 +241,7 @@ Init_ossl_hmac()
#endif
eHMACError = rb_define_class_under(mOSSL, "HMACError", eOSSLError);
-
+
cHMAC = rb_define_class_under(mOSSL, "HMAC", rb_cObject);
rb_define_alloc_func(cHMAC, ossl_hmac_alloc);
diff --git a/ext/openssl/ossl_ns_spki.c b/ext/openssl/ossl_ns_spki.c
index 2ebad18..b67dd22 100644
--- a/ext/openssl/ossl_ns_spki.c
+++ b/ext/openssl/ossl_ns_spki.c
@@ -42,12 +42,12 @@ ossl_spki_alloc(VALUE klass)
{
NETSCAPE_SPKI *spki;
VALUE obj;
-
+
if (!(spki = NETSCAPE_SPKI_new())) {
ossl_raise(eSPKIError, NULL);
- }
+ }
WrapSPKI(klass, obj, spki);
-
+
return obj;
}
@@ -57,7 +57,7 @@ ossl_spki_initialize(int argc, VALUE *argv, VALUE self)
NETSCAPE_SPKI *spki;
VALUE buffer;
const unsigned char *p;
-
+
if (rb_scan_args(argc, argv, "01", &buffer) == 0) {
return self;
}
@@ -101,7 +101,7 @@ ossl_spki_to_pem(VALUE self)
NETSCAPE_SPKI *spki;
char *data;
VALUE str;
-
+
GetSPKI(self, spki);
if (!(data = NETSCAPE_SPKI_b64_encode(spki))) {
ossl_raise(eSPKIError, NULL);
@@ -118,7 +118,7 @@ ossl_spki_print(VALUE self)
BIO *out;
BUF_MEM *buf;
VALUE str;
-
+
GetSPKI(self, spki);
if (!(out = BIO_new(BIO_s_mem()))) {
ossl_raise(eSPKIError, NULL);
@@ -130,7 +130,7 @@ ossl_spki_print(VALUE self)
BIO_get_mem_ptr(out, &buf);
str = rb_str_new(buf->data, buf->length);
BIO_free(out);
-
+
return str;
}
@@ -235,14 +235,14 @@ void
Init_ossl_ns_spki()
{
mNetscape = rb_define_module_under(mOSSL, "Netscape");
-
+
eSPKIError = rb_define_class_under(mNetscape, "SPKIError", eOSSLError);
-
+
cSPKI = rb_define_class_under(mNetscape, "SPKI", rb_cObject);
-
+
rb_define_alloc_func(cSPKI, ossl_spki_alloc);
rb_define_method(cSPKI, "initialize", ossl_spki_initialize, -1);
-
+
rb_define_method(cSPKI, "to_der", ossl_spki_to_der, 0);
rb_define_method(cSPKI, "to_pem", ossl_spki_to_pem, 0);
rb_define_alias(cSPKI, "to_s", "to_pem");
diff --git a/ext/openssl/ossl_pkcs7.c b/ext/openssl/ossl_pkcs7.c
index e61c022..68494c2 100644
--- a/ext/openssl/ossl_pkcs7.c
+++ b/ext/openssl/ossl_pkcs7.c
@@ -97,7 +97,7 @@ static PKCS7_SIGNER_INFO *
DupPKCS7SignerPtr(VALUE obj)
{
PKCS7_SIGNER_INFO *p7si, *pkcs7;
-
+
SafeGetPKCS7si(obj, p7si);
if (!(pkcs7 = PKCS7_SIGNER_INFO_dup(p7si))) {
ossl_raise(ePKCS7Error, NULL);
@@ -123,7 +123,7 @@ static PKCS7_RECIP_INFO *
DupPKCS7RecipientPtr(VALUE obj)
{
PKCS7_RECIP_INFO *p7ri, *pkcs7;
-
+
SafeGetPKCS7ri(obj, p7ri);
if (!(pkcs7 = PKCS7_RECIP_INFO_dup(p7ri))) {
ossl_raise(ePKCS7Error, NULL);
@@ -814,7 +814,7 @@ ossl_pkcs7_to_pem(VALUE self)
PKCS7 *pkcs7;
BIO *out;
VALUE str;
-
+
GetPKCS7(self, pkcs7);
if (!(out = BIO_new(BIO_s_mem()))) {
ossl_raise(ePKCS7Error, NULL);
@@ -889,9 +889,9 @@ ossl_pkcs7si_get_signed_time(VALUE self)
{
PKCS7_SIGNER_INFO *p7si;
ASN1_TYPE *asn1obj;
-
+
GetPKCS7si(self, p7si);
-
+
if (!(asn1obj = PKCS7_get_signed_attribute(p7si, NID_pkcs9_signingTime))) {
ossl_raise(ePKCS7Error, NULL);
}
diff --git a/ext/openssl/ossl_pkey.c b/ext/openssl/ossl_pkey.c
index 37a9f8c..16ceff4 100644
--- a/ext/openssl/ossl_pkey.c
+++ b/ext/openssl/ossl_pkey.c
@@ -99,7 +99,7 @@ EVP_PKEY *
GetPrivPKeyPtr(VALUE obj)
{
EVP_PKEY *pkey;
-
+
if (rb_funcall(obj, id_private_q, 0, NULL) != Qtrue) {
ossl_raise(rb_eArgError, "Private key is needed.");
}
@@ -112,7 +112,7 @@ EVP_PKEY *
DupPKeyPtr(VALUE obj)
{
EVP_PKEY *pkey;
-
+
SafeGetPKey(obj, pkey);
CRYPTO_add(&pkey->references, 1, CRYPTO_LOCK_EVP_PKEY);
@@ -123,7 +123,7 @@ EVP_PKEY *
DupPrivPKeyPtr(VALUE obj)
{
EVP_PKEY *pkey;
-
+
if (rb_funcall(obj, id_private_q, 0, NULL) != Qtrue) {
ossl_raise(rb_eArgError, "Private key is needed.");
}
@@ -216,19 +216,19 @@ Init_ossl_pkey()
#endif
mPKey = rb_define_module_under(mOSSL, "PKey");
-
+
ePKeyError = rb_define_class_under(mPKey, "PKeyError", eOSSLError);
cPKey = rb_define_class_under(mPKey, "PKey", rb_cObject);
-
+
rb_define_alloc_func(cPKey, ossl_pkey_alloc);
rb_define_method(cPKey, "initialize", ossl_pkey_initialize, 0);
rb_define_method(cPKey, "sign", ossl_pkey_sign, 2);
rb_define_method(cPKey, "verify", ossl_pkey_verify, 3);
-
+
id_private_q = rb_intern("private?");
-
+
/*
* INIT rsa, dsa, dh, ec
*/
diff --git a/ext/openssl/ossl_pkey_dh.c b/ext/openssl/ossl_pkey_dh.c
index 4ce8264..97535db 100644
--- a/ext/openssl/ossl_pkey_dh.c
+++ b/ext/openssl/ossl_pkey_dh.c
@@ -42,7 +42,7 @@ dh_instance(VALUE klass, DH *dh)
{
EVP_PKEY *pkey;
VALUE obj;
-
+
if (!dh) {
return Qfalse;
}
@@ -114,7 +114,7 @@ ossl_dh_s_generate(int argc, VALUE *argv, VALUE klass)
DH *dh ;
int g = 2;
VALUE size, gen, obj;
-
+
if (rb_scan_args(argc, argv, "11", &size, &gen) == 2) {
g = NUM2INT(gen);
}
@@ -208,7 +208,7 @@ ossl_dh_is_private(VALUE self)
EVP_PKEY *pkey;
GetPKeyDH(self, pkey);
-
+
return (DH_PRIVATE(pkey->pkey.dh)) ? Qtrue : Qfalse;
}
@@ -328,7 +328,7 @@ ossl_dh_to_public_key(VALUE self)
EVP_PKEY *pkey;
DH *dh;
VALUE obj;
-
+
GetPKeyDH(self, pkey);
dh = DHparams_dup(pkey->pkey.dh); /* err check perfomed by dh_instance */
obj = dh_instance(CLASS_OF(self), dh);
diff --git a/ext/openssl/ossl_pkey_dsa.c b/ext/openssl/ossl_pkey_dsa.c
index 7b2db70..a6e7f8d 100644
--- a/ext/openssl/ossl_pkey_dsa.c
+++ b/ext/openssl/ossl_pkey_dsa.c
@@ -36,7 +36,7 @@ dsa_instance(VALUE klass, DSA *dsa)
{
EVP_PKEY *pkey;
VALUE obj;
-
+
if (!dsa) {
return Qfalse;
}
@@ -145,7 +145,7 @@ ossl_dsa_initialize(int argc, VALUE *argv, VALUE self)
BIO *in;
char *passwd = NULL;
VALUE arg, pass;
-
+
GetPKey(self, pkey);
if(rb_scan_args(argc, argv, "02", &arg, &pass) == 0) {
dsa = DSA_new();
@@ -211,9 +211,9 @@ static VALUE
ossl_dsa_is_private(VALUE self)
{
EVP_PKEY *pkey;
-
+
GetPKeyDSA(self, pkey);
-
+
return (DSA_PRIVATE(self, pkey->pkey.dsa)) ? Qtrue : Qfalse;
}
@@ -364,7 +364,7 @@ ossl_dsa_to_public_key(VALUE self)
EVP_PKEY *pkey;
DSA *dsa;
VALUE obj;
-
+
GetPKeyDSA(self, pkey);
/* err check performed by dsa_instance */
dsa = DSAPublicKey_dup(pkey->pkey.dsa);
@@ -453,7 +453,7 @@ Init_ossl_dsa()
eDSAError = rb_define_class_under(mPKey, "DSAError", ePKeyError);
cDSA = rb_define_class_under(mPKey, "DSA", cPKey);
-
+
rb_define_singleton_method(cDSA, "generate", ossl_dsa_s_generate, 1);
rb_define_method(cDSA, "initialize", ossl_dsa_initialize, -1);
diff --git a/ext/openssl/ossl_pkey_ec.c b/ext/openssl/ossl_pkey_ec.c
index a7907cd..52e910c 100644
--- a/ext/openssl/ossl_pkey_ec.c
+++ b/ext/openssl/ossl_pkey_ec.c
@@ -110,7 +110,7 @@ static VALUE ec_instance(VALUE klass, EC_KEY *ec)
{
EVP_PKEY *pkey;
VALUE obj;
-
+
if (!ec) {
return Qfalse;
}
@@ -163,7 +163,7 @@ static VALUE ossl_ec_key_initialize(int argc, VALUE *argv, VALUE self)
EC_KEY *ec = NULL;
VALUE arg, pass;
VALUE group = Qnil;
-
+
GetPKey(self, pkey);
if (pkey->pkey.ec)
rb_raise(eECError, "EC_KEY already initialized");
diff --git a/ext/openssl/ossl_pkey_rsa.c b/ext/openssl/ossl_pkey_rsa.c
index 0421ec5..bfaeb43 100644
--- a/ext/openssl/ossl_pkey_rsa.c
+++ b/ext/openssl/ossl_pkey_rsa.c
@@ -36,7 +36,7 @@ rsa_instance(VALUE klass, RSA *rsa)
{
EVP_PKEY *pkey;
VALUE obj;
-
+
if (!rsa) {
return Qfalse;
}
@@ -48,7 +48,7 @@ rsa_instance(VALUE klass, RSA *rsa)
return Qfalse;
}
WrapPKey(klass, obj, pkey);
-
+
return obj;
}
@@ -136,7 +136,7 @@ ossl_rsa_initialize(int argc, VALUE *argv, VALUE self)
BIO *in;
char *passwd = NULL;
VALUE arg, pass;
-
+
GetPKey(self, pkey);
if(rb_scan_args(argc, argv, "02", &arg, &pass) == 0) {
rsa = RSA_new();
@@ -209,7 +209,7 @@ static VALUE
ossl_rsa_is_private(VALUE self)
{
EVP_PKEY *pkey;
-
+
GetPKeyRSA(self, pkey);
return (RSA_PRIVATE(self, pkey->pkey.rsa)) ? Qtrue : Qfalse;
@@ -365,7 +365,7 @@ ossl_rsa_private_encrypt(int argc, VALUE *argv, VALUE self)
GetPKeyRSA(self, pkey);
if (!RSA_PRIVATE(self, pkey->pkey.rsa)) {
ossl_raise(eRSAError, "private key needed.");
- }
+ }
rb_scan_args(argc, argv, "11", &buffer, &padding);
pad = (argc == 1) ? RSA_PKCS1_PADDING : NUM2INT(padding);
StringValue(buffer);
@@ -547,7 +547,7 @@ Init_ossl_rsa()
rb_define_singleton_method(cRSA, "generate", ossl_rsa_s_generate, -1);
rb_define_method(cRSA, "initialize", ossl_rsa_initialize, -1);
-
+
rb_define_method(cRSA, "public?", ossl_rsa_is_public, 0);
rb_define_method(cRSA, "private?", ossl_rsa_is_private, 0);
rb_define_method(cRSA, "to_text", ossl_rsa_to_text, 0);
diff --git a/ext/openssl/ossl_rand.c b/ext/openssl/ossl_rand.c
index af61fe3..97a1b9f 100644
--- a/ext/openssl/ossl_rand.c
+++ b/ext/openssl/ossl_rand.c
@@ -65,7 +65,7 @@ static VALUE
ossl_rand_load_file(VALUE self, VALUE filename)
{
SafeStringValue(filename);
-
+
if(!RAND_load_file(RSTRING_PTR(filename), -1)) {
ossl_raise(eRandomError, NULL);
}
@@ -134,7 +134,7 @@ static VALUE
ossl_rand_egd(VALUE self, VALUE filename)
{
SafeStringValue(filename);
-
+
if(!RAND_egd(RSTRING_PTR(filename))) {
ossl_raise(eRandomError, NULL);
}
@@ -186,9 +186,9 @@ Init_ossl_rand()
#endif
mRandom = rb_define_module_under(mOSSL, "Random");
-
+
eRandomError = rb_define_class_under(mRandom, "RandomError", eOSSLError);
-
+
DEFMETH(mRandom, "seed", ossl_rand_seed, 1);
DEFMETH(mRandom, "random_add", ossl_rand_add, 2);
DEFMETH(mRandom, "load_random_file", ossl_rand_load_file, 1);
@@ -196,7 +196,7 @@ Init_ossl_rand()
DEFMETH(mRandom, "random_bytes", ossl_rand_bytes, 1);
DEFMETH(mRandom, "pseudo_bytes", ossl_rand_pseudo_bytes, 1);
DEFMETH(mRandom, "egd", ossl_rand_egd, 1);
- DEFMETH(mRandom, "egd_bytes", ossl_rand_egd_bytes, 2);
+ DEFMETH(mRandom, "egd_bytes", ossl_rand_egd_bytes, 2);
DEFMETH(mRandom, "status?", ossl_rand_status, 0)
}
diff --git a/ext/openssl/ossl_x509cert.c b/ext/openssl/ossl_x509cert.c
index 09f4d6b..0217ffc 100644
--- a/ext/openssl/ossl_x509cert.c
+++ b/ext/openssl/ossl_x509cert.c
@@ -51,7 +51,7 @@ ossl_x509_new(X509 *x509)
ossl_raise(eX509CertError, NULL);
}
WrapX509(cX509Cert, obj, new);
-
+
return obj;
}
@@ -90,9 +90,9 @@ X509 *
GetX509CertPtr(VALUE obj)
{
X509 *x509;
-
+
SafeGetX509(obj, x509);
-
+
return x509;
}
@@ -100,11 +100,11 @@ X509 *
DupX509CertPtr(VALUE obj)
{
X509 *x509;
-
+
SafeGetX509(obj, x509);
-
+
CRYPTO_add(&x509->references, 1, CRYPTO_LOCK_X509);
-
+
return x509;
}
@@ -160,7 +160,7 @@ static VALUE
ossl_x509_copy(VALUE self, VALUE other)
{
X509 *a, *b, *x509;
-
+
rb_check_frozen(self);
if (self == other) return self;
@@ -210,7 +210,7 @@ ossl_x509_to_pem(VALUE self)
X509 *x509;
BIO *out;
VALUE str;
-
+
GetX509(self, x509);
out = BIO_new(BIO_s_mem());
if (!out) ossl_raise(eX509CertError, NULL);
@@ -234,7 +234,7 @@ ossl_x509_to_text(VALUE self)
X509 *x509;
BIO *out;
VALUE str;
-
+
GetX509(self, x509);
out = BIO_new(BIO_s_mem());
@@ -281,7 +281,7 @@ ossl_x509_get_version(VALUE self)
X509 *x509;
GetX509(self, x509);
-
+
return LONG2NUM(X509_get_version(x509));
}
@@ -316,7 +316,7 @@ ossl_x509_get_serial(VALUE self)
X509 *x509;
GetX509(self, x509);
-
+
return asn1integer_to_num(X509_get_serialNumber(x509));
}
@@ -333,7 +333,7 @@ ossl_x509_set_serial(VALUE self, VALUE num)
x509->cert_info->serialNumber =
num_to_asn1integer(num, X509_get_serialNumber(x509));
-
+
return num;
}
@@ -370,7 +370,7 @@ ossl_x509_get_subject(VALUE self)
{
X509 *x509;
X509_NAME *name;
-
+
GetX509(self, x509);
if (!(name = X509_get_subject_name(x509))) { /* NO DUP - don't free! */
ossl_raise(eX509CertError, NULL);
@@ -387,7 +387,7 @@ static VALUE
ossl_x509_set_subject(VALUE self, VALUE subject)
{
X509 *x509;
-
+
GetX509(self, x509);
if (!X509_set_subject_name(x509, GetX509NamePtr(subject))) { /* DUPs name */
ossl_raise(eX509CertError, NULL);
@@ -458,7 +458,7 @@ ossl_x509_set_not_before(VALUE self, VALUE time)
{
X509 *x509;
time_t sec;
-
+
sec = time_to_time_t(time);
GetX509(self, x509);
if (!X509_time_adj(X509_get_notBefore(x509), 0, &sec)) {
@@ -495,7 +495,7 @@ ossl_x509_set_not_after(VALUE self, VALUE time)
{
X509 *x509;
time_t sec;
-
+
sec = time_to_time_t(time);
GetX509(self, x509);
if (!X509_time_adj(X509_get_notAfter(x509), 0, &sec)) {
@@ -597,7 +597,7 @@ ossl_x509_check_private_key(VALUE self, VALUE key)
{
X509 *x509;
EVP_PKEY *pkey;
-
+
/* not needed private key, but should be */
pkey = GetPrivPKeyPtr(key); /* NO NEED TO DUP */
GetX509(self, x509);
@@ -645,7 +645,7 @@ ossl_x509_set_extensions(VALUE self, VALUE ary)
X509 *x509;
X509_EXTENSION *ext;
int i;
-
+
Check_Type(ary, T_ARRAY);
/* All ary's members should be X509Extension */
for (i=0; i<RARRAY_LEN(ary); i++) {
@@ -656,7 +656,7 @@ ossl_x509_set_extensions(VALUE self, VALUE ary)
x509->cert_info->extensions = NULL;
for (i=0; i<RARRAY_LEN(ary); i++) {
ext = DupX509ExtPtr(RARRAY_PTR(ary)[i]);
-
+
if (!X509_add_ext(x509, ext, -1)) { /* DUPs ext - FREE it */
X509_EXTENSION_free(ext);
ossl_raise(eX509CertError, NULL);
@@ -676,7 +676,7 @@ ossl_x509_add_extension(VALUE self, VALUE extension)
{
X509 *x509;
X509_EXTENSION *ext;
-
+
GetX509(self, x509);
ext = DupX509ExtPtr(extension);
if (!X509_add_ext(x509, ext, -1)) { /* DUPs ext - FREE it */
@@ -729,9 +729,9 @@ void
Init_ossl_x509cert()
{
eX509CertError = rb_define_class_under(mX509, "CertificateError", eOSSLError);
-
+
cX509Cert = rb_define_class_under(mX509, "Certificate", rb_cObject);
-
+
rb_define_alloc_func(cX509Cert, ossl_x509_alloc);
rb_define_method(cX509Cert, "initialize", ossl_x509_initialize, -1);
rb_define_copy_func(cX509Cert, ossl_x509_copy);
diff --git a/ext/openssl/ossl_x509crl.c b/ext/openssl/ossl_x509crl.c
index ef03fe1..d0221a1 100644
--- a/ext/openssl/ossl_x509crl.c
+++ b/ext/openssl/ossl_x509crl.c
@@ -116,7 +116,7 @@ static VALUE
ossl_x509crl_copy(VALUE self, VALUE other)
{
X509_CRL *a, *b, *crl;
-
+
rb_check_frozen(self);
if (self == other) return self;
GetX509CRL(self, a);
@@ -421,7 +421,7 @@ ossl_x509crl_to_text(VALUE self)
BIO_get_mem_ptr(out, &buf);
str = rb_str_new(buf->data, buf->length);
BIO_free(out);
-
+
return str;
}
@@ -460,7 +460,7 @@ ossl_x509crl_set_extensions(VALUE self, VALUE ary)
X509_CRL *crl;
X509_EXTENSION *ext;
int i;
-
+
Check_Type(ary, T_ARRAY);
/* All ary members should be X509 Extensions */
for (i=0; i<RARRAY_LEN(ary); i++) {
@@ -507,7 +507,7 @@ Init_ossl_x509crl()
eX509CRLError = rb_define_class_under(mX509, "CRLError", eOSSLError);
cX509CRL = rb_define_class_under(mX509, "CRL", rb_cObject);
-
+
rb_define_alloc_func(cX509CRL, ossl_x509crl_alloc);
rb_define_method(cX509CRL, "initialize", ossl_x509crl_initialize, -1);
rb_define_copy_func(cX509CRL, ossl_x509crl_copy);
diff --git a/ext/openssl/ossl_x509ext.c b/ext/openssl/ossl_x509ext.c
index d703edc..c2019b9 100644
--- a/ext/openssl/ossl_x509ext.c
+++ b/ext/openssl/ossl_x509ext.c
@@ -64,7 +64,7 @@ ossl_x509ext_new(X509_EXTENSION *ext)
ossl_raise(eX509ExtError, NULL);
}
WrapX509Ext(cX509Ext, obj, new);
-
+
return obj;
}
@@ -186,7 +186,7 @@ ossl_x509extfactory_initialize(int argc, VALUE *argv, VALUE self)
{
/*X509V3_CTX *ctx;*/
VALUE issuer_cert, subject_cert, subject_req, crl;
-
+
/*GetX509ExtFactory(self, ctx);*/
rb_scan_args(argc, argv, "04",
@@ -429,10 +429,10 @@ Init_ossl_x509ext()
eX509ExtError = rb_define_class_under(mX509, "ExtensionError", eOSSLError);
cX509ExtFactory = rb_define_class_under(mX509, "ExtensionFactory", rb_cObject);
-
+
rb_define_alloc_func(cX509ExtFactory, ossl_x509extfactory_alloc);
rb_define_method(cX509ExtFactory, "initialize", ossl_x509extfactory_initialize, -1);
-
+
rb_attr(cX509ExtFactory, rb_intern("issuer_certificate"), 1, 0, Qfalse);
rb_attr(cX509ExtFactory, rb_intern("subject_certificate"), 1, 0, Qfalse);
rb_attr(cX509ExtFactory, rb_intern("subject_request"), 1, 0, Qfalse);
@@ -445,7 +445,7 @@ Init_ossl_x509ext()
rb_define_method(cX509ExtFactory, "crl=", ossl_x509extfactory_set_crl, 1);
rb_define_method(cX509ExtFactory, "config=", ossl_x509extfactory_set_config, 1);
rb_define_method(cX509ExtFactory, "create_ext", ossl_x509extfactory_create_ext, -1);
-
+
cX509Ext = rb_define_class_under(mX509, "Extension", rb_cObject);
rb_define_alloc_func(cX509Ext, ossl_x509ext_alloc);
rb_define_method(cX509Ext, "initialize", ossl_x509ext_initialize, -1);
diff --git a/ext/openssl/ossl_x509name.c b/ext/openssl/ossl_x509name.c
index 12e8022..e716f10 100644
--- a/ext/openssl/ossl_x509name.c
+++ b/ext/openssl/ossl_x509name.c
@@ -78,7 +78,7 @@ ossl_x509name_alloc(VALUE klass)
{
X509_NAME *name;
VALUE obj;
-
+
if (!(name = X509_NAME_new())) {
ossl_raise(eX509NameError, NULL);
}
@@ -231,7 +231,7 @@ ossl_x509name_to_a(VALUE self)
char long_name[512];
const char *short_name;
VALUE ary, ret;
-
+
GetX509Name(self, name);
entries = X509_NAME_entry_count(name);
if (entries < 0) {
diff --git a/ext/openssl/ossl_x509req.c b/ext/openssl/ossl_x509req.c
index 1821a43..368bff2 100644
--- a/ext/openssl/ossl_x509req.c
+++ b/ext/openssl/ossl_x509req.c
@@ -124,7 +124,7 @@ static VALUE
ossl_x509req_copy(VALUE self, VALUE other)
{
X509_REQ *a, *b, *req;
-
+
rb_check_frozen(self);
if (self == other) return self;
GetX509Req(self, a);
@@ -145,7 +145,7 @@ ossl_x509req_to_pem(VALUE self)
BIO *out;
BUF_MEM *buf;
VALUE str;
-
+
GetX509Req(self, req);
if (!(out = BIO_new(BIO_s_mem()))) {
ossl_raise(eX509ReqError, NULL);
@@ -213,7 +213,7 @@ ossl_x509req_to_x509(VALUE self, VALUE days, VALUE key)
{
X509_REQ *req;
X509 *x509;
-
+
GetX509Req(self, req);
...
if (!(x509 = X509_REQ_to_X509(req, d, pkey))) {
@@ -271,7 +271,7 @@ static VALUE
ossl_x509req_set_subject(VALUE self, VALUE subject)
{
X509_REQ *req;
-
+
GetX509Req(self, req);
/* DUPs name */
if (!X509_REQ_set_subject_name(req, GetX509NamePtr(subject))) {
@@ -290,7 +290,7 @@ ossl_x509req_get_signature_algorithm(VALUE self)
VALUE str;
GetX509Req(self, req);
-
+
if (!(out = BIO_new(BIO_s_mem()))) {
ossl_raise(eX509ReqError, NULL);
}
@@ -379,7 +379,7 @@ ossl_x509req_get_attributes(VALUE self)
int count, i;
X509_ATTRIBUTE *attr;
VALUE ary;
-
+
GetX509Req(self, req);
count = X509_REQ_get_attr_count(req);
@@ -441,13 +441,13 @@ void
Init_ossl_x509req()
{
eX509ReqError = rb_define_class_under(mX509, "RequestError", eOSSLError);
-
+
cX509Req = rb_define_class_under(mX509, "Request", rb_cObject);
-
+
rb_define_alloc_func(cX509Req, ossl_x509req_alloc);
rb_define_method(cX509Req, "initialize", ossl_x509req_initialize, -1);
rb_define_copy_func(cX509Req, ossl_x509req_copy);
-
+
rb_define_method(cX509Req, "to_pem", ossl_x509req_to_pem, 0);
rb_define_method(cX509Req, "to_der", ossl_x509req_to_der, 0);
rb_define_alias(cX509Req, "to_s", "to_pem");
diff --git a/ext/openssl/ossl_x509revoked.c b/ext/openssl/ossl_x509revoked.c
index 1654cc6..6ba73b1 100644
--- a/ext/openssl/ossl_x509revoked.c
+++ b/ext/openssl/ossl_x509revoked.c
@@ -117,7 +117,7 @@ static VALUE
ossl_x509revoked_get_time(VALUE self)
{
X509_REVOKED *rev;
-
+
GetX509Rev(self, rev);
return asn1time_to_time(rev->revocationDate);
@@ -214,10 +214,10 @@ Init_ossl_x509revoked()
eX509RevError = rb_define_class_under(mX509, "RevokedError", eOSSLError);
cX509Rev = rb_define_class_under(mX509, "Revoked", rb_cObject);
-
+
rb_define_alloc_func(cX509Rev, ossl_x509revoked_alloc);
rb_define_method(cX509Rev, "initialize", ossl_x509revoked_initialize, -1);
-
+
rb_define_method(cX509Rev, "serial", ossl_x509revoked_get_serial, 0);
rb_define_method(cX509Rev, "serial=", ossl_x509revoked_set_serial, 1);
rb_define_method(cX509Rev, "time", ossl_x509revoked_get_time, 0);
diff --git a/ext/socket/getaddrinfo.c b/ext/socket/getaddrinfo.c
index a4f01c0..3382f00 100644
--- a/ext/socket/getaddrinfo.c
+++ b/ext/socket/getaddrinfo.c
@@ -114,7 +114,7 @@ static const struct afd {
int a_socklen;
int a_off;
const char *a_addrany;
- const char *a_loopback;
+ const char *a_loopback;
} afdl [] = {
#ifdef INET6
#define N_INET6 0
@@ -145,7 +145,7 @@ static int get_name __P((const char *, const struct afd *,
static int get_addr __P((const char *, int, struct addrinfo **,
struct addrinfo *, int));
static int str_isnumber __P((const char *));
-
+
static const char *const ai_errlist[] = {
"success.",
"address family for hostname not supported.", /* EAI_ADDRFAMILY */
@@ -302,7 +302,7 @@ getaddrinfo(const char *hostname, const char *servname, const struct addrinfo *h
pai->ai_addr = NULL;
pai->ai_next = NULL;
port = ANY;
-
+
if (hostname == NULL && servname == NULL)
return EAI_NONAME;
if (hints) {
@@ -409,7 +409,7 @@ getaddrinfo(const char *hostname, const char *servname, const struct addrinfo *h
ERR(EAI_PROTOCOL); /*xxx*/
}
}
-
+
/*
* hostname == NULL.
* passive socket -> anyaddr (0.0.0.0 or ::)
@@ -458,7 +458,7 @@ getaddrinfo(const char *hostname, const char *servname, const struct addrinfo *h
else
ERR(EAI_FAMILY);
}
-
+
/* hostname as numeric name */
for (i = 0; afdl[i].a_af; i++) {
if (inet_pton(afdl[i].a_af, hostname, pton)) {
@@ -484,7 +484,7 @@ getaddrinfo(const char *hostname, const char *servname, const struct addrinfo *h
break;
#endif
}
-
+
if (pai->ai_family == afdl[i].a_af ||
pai->ai_family == PF_UNSPEC) {
if (! (pai->ai_flags & AI_CANONNAME)) {
@@ -549,7 +549,7 @@ get_name(const char *addr, const struct afd *afd, struct addrinfo **res, char *n
GET_CANONNAME(cur, hp->h_name);
} else
GET_AI(cur, afd, numaddr, port);
-
+
#ifdef INET6
if (hp)
freehostent(hp);
@@ -612,7 +612,7 @@ get_addr(const char *hostname, int af, struct addrinfo **res, struct addrinfo *p
if ((hp->h_name == NULL) || (hp->h_name[0] == 0) ||
(hp->h_addr_list[0] == NULL))
ERR(EAI_FAIL);
-
+
for (i = 0; (ap = hp->h_addr_list[i]) != NULL; i++) {
switch (af) {
#ifdef INET6
diff --git a/ext/socket/getnameinfo.c b/ext/socket/getnameinfo.c
index fca3bcf..3ee83eb 100644
--- a/ext/socket/getnameinfo.c
+++ b/ext/socket/getnameinfo.c
@@ -156,7 +156,7 @@ getnameinfo(const struct sockaddr *sa, socklen_t salen, char *host, socklen_t ho
len = SA_LEN(sa);
if (len != salen) return ENI_SALEN;
-
+
family = sa->sa_family;
for (i = 0; afdl[i].a_af; i++)
if (afdl[i].a_af == family) {
@@ -164,10 +164,10 @@ getnameinfo(const struct sockaddr *sa, socklen_t salen, char *host, socklen_t ho
goto found;
}
return ENI_FAMILY;
-
+
found:
if (len != afd->a_socklen) return ENI_SALEN;
-
+
port = ((struct sockinet *)sa)->si_port; /* network byte order */
addr = (char *)sa + afd->a_off;
@@ -199,7 +199,7 @@ getnameinfo(const struct sockaddr *sa, socklen_t salen, char *host, socklen_t ho
flags |= NI_NUMERICHOST;
v4a >>= IN_CLASSA_NSHIFT;
if (v4a == 0)
- flags |= NI_NUMERICHOST;
+ flags |= NI_NUMERICHOST;
break;
#ifdef INET6
case AF_INET6: