diff options
Diffstat (limited to 'ext/openssl')
31 files changed, 214 insertions, 214 deletions
diff --git a/ext/openssl/openssl_missing.c b/ext/openssl/openssl_missing.c index 724f36b..2d88079 100644 --- a/ext/openssl/openssl_missing.c +++ b/ext/openssl/openssl_missing.c @@ -41,7 +41,7 @@ int X509_STORE_set_ex_data(X509_STORE *str, int idx, void *data) { return CRYPTO_set_ex_data(&str->ex_data, idx, data); } - + void *X509_STORE_get_ex_data(X509_STORE *str, int idx) { return CRYPTO_get_ex_data(&str->ex_data, idx); @@ -111,7 +111,7 @@ HMAC_CTX_cleanup(HMAC_CTX *ctx) #endif #if !defined(HAVE_EVP_CIPHER_CTX_COPY) -/* +/* * this function does not exist in OpenSSL yet... or ever?. * a future version may break this function. * tested on 0.9.7d. @@ -180,12 +180,12 @@ OSSL_X509_REVOKED_cmp(const X509_REVOKED * const *a, const X509_REVOKED * const (ASN1_STRING *)(*a)->serialNumber, (ASN1_STRING *)(*b)->serialNumber)); } - + int X509_CRL_add0_revoked(X509_CRL *crl, X509_REVOKED *rev) { X509_CRL_INFO *inf; - + inf = crl->crl; if (!inf->revoked) inf->revoked = sk_X509_REVOKED_new(OSSL_X509_REVOKED_cmp); @@ -313,7 +313,7 @@ PEM_def_callback(char *buf, int num, int w, void *key) { int i,j; const char *prompt; - + if (key) { i = strlen(key); i = (i > num) ? num : i; diff --git a/ext/openssl/ossl.c b/ext/openssl/ossl.c index 85ba654..510fbdf 100644 --- a/ext/openssl/ossl.c +++ b/ext/openssl/ossl.c @@ -48,7 +48,7 @@ string2hex(const unsigned char *buf, int buf_len, char **hexbuf, int *hexbuf_len * Data Conversion */ STACK_OF(X509) * -ossl_x509_ary2sk0(VALUE ary) +ossl_x509_ary2sk0(VALUE ary) { STACK_OF(X509) *sk; VALUE val; @@ -57,13 +57,13 @@ ossl_x509_ary2sk0(VALUE ary) Check_Type(ary, T_ARRAY); sk = sk_X509_new_null(); - if (!sk) ossl_raise(eOSSLError, NULL); + if (!sk) ossl_raise(eOSSLError, NULL); for (i = 0; i < RARRAY_LEN(ary); i++) { val = rb_ary_entry(ary, i); if (!rb_obj_is_kind_of(val, cX509Cert)) { sk_X509_pop_free(sk, X509_free); - ossl_raise(eOSSLError, "object not X509 cert in array"); + ossl_raise(eOSSLError, "object not X509 cert in array"); } x509 = DupX509CertPtr(val); /* NEED TO DUP */ sk_X509_push(sk, x509); @@ -157,7 +157,7 @@ ossl_pem_passwd_cb(char *buf, int max_len, int flag, void *pwd) { int len, status = 0; VALUE rflag, pass; - + if (pwd || !rb_block_given_p()) return PEM_def_callback(buf, max_len, flag, pwd); @@ -192,12 +192,12 @@ int ossl_verify_cb_idx; VALUE ossl_call_verify_cb_proc(struct ossl_verify_cb_args *args) -{ +{ return rb_funcall(args->proc, rb_intern("call"), 2, args->preverify_ok, args->store_ctx); } - -int + +int ossl_verify_cb(int ok, X509_STORE_CTX *ctx) { VALUE proc, rctx, ret; diff --git a/ext/openssl/ossl_asn1.c b/ext/openssl/ossl_asn1.c index 6aff2b7..5068876 100644 --- a/ext/openssl/ossl_asn1.c +++ b/ext/openssl/ossl_asn1.c @@ -27,7 +27,7 @@ asn1time_to_time(ASN1_TIME *time) { struct tm tm; VALUE argv[6]; - + if (!time || !time->data) return Qnil; memset(&tm, 0, sizeof(struct tm)); @@ -36,7 +36,7 @@ asn1time_to_time(ASN1_TIME *time) if (sscanf((const char *)time->data, "%2d%2d%2d%2d%2d%2dZ", &tm.tm_year, &tm.tm_mon, &tm.tm_mday, &tm.tm_hour, &tm.tm_min, &tm.tm_sec) != 6) { ossl_raise(rb_eTypeError, "bad UTCTIME format"); - } + } if (tm.tm_year < 69) { tm.tm_year += 2000; } else { @@ -47,7 +47,7 @@ asn1time_to_time(ASN1_TIME *time) if (sscanf((const char *)time->data, "%4d%2d%2d%2d%2d%2dZ", &tm.tm_year, &tm.tm_mon, &tm.tm_mday, &tm.tm_hour, &tm.tm_min, &tm.tm_sec) != 6) { ossl_raise(rb_eTypeError, "bad GENERALIZEDTIME format" ); - } + } break; default: rb_warning("unknown time format"); @@ -144,7 +144,7 @@ ASN1_INTEGER * num_to_asn1integer(VALUE obj, ASN1_INTEGER *ai) { BIGNUM *bn = GetBNPtr(obj); - + if (!(ai = BN_to_ASN1_INTEGER(bn, ai))) { ossl_raise(eOSSLError, NULL); } @@ -321,7 +321,7 @@ decode_int(unsigned char* der, int length) { ASN1_INTEGER *ai; const unsigned char *p; - VALUE ret; + VALUE ret; int status = 0; p = der; @@ -361,7 +361,7 @@ decode_enum(unsigned char* der, int length) { ASN1_ENUMERATED *ai; const unsigned char *p; - VALUE ret; + VALUE ret; int status = 0; p = der; @@ -524,7 +524,7 @@ ossl_asn1_get_asn1type(VALUE obj) case V_ASN1_ISO64STRING: /* FALLTHROUGH */ case V_ASN1_GENERALSTRING: /* FALLTHROUGH */ case V_ASN1_UNIVERSALSTRING: /* FALLTHROUGH */ - case V_ASN1_BMPSTRING: + case V_ASN1_BMPSTRING: ptr = obj_to_asn1str(value); free_func = ASN1_STRING_free; break; @@ -660,8 +660,8 @@ ossl_asn1data_initialize(VALUE self, VALUE value, VALUE tag, VALUE tag_class) return self; } -static VALUE -join_der_i(VALUE i, VALUE str) +static VALUE +join_der_i(VALUE i, VALUE str) { i = ossl_to_der_if_possible(i); StringValue(i); @@ -737,7 +737,7 @@ ossl_asn1_decode0(unsigned char **pp, long length, long *offset, long depth, rb_yield(arg); } length -= hlen; - off += hlen; + off += hlen; if(len > length) ossl_raise(eASN1Error, "value is too short"); if((tc & V_ASN1_PRIVATE) == V_ASN1_PRIVATE) tag_class = sPRIVATE; diff --git a/ext/openssl/ossl_asn1.h b/ext/openssl/ossl_asn1.h index 8aad9f9..718f43f 100644 --- a/ext/openssl/ossl_asn1.h +++ b/ext/openssl/ossl_asn1.h @@ -32,12 +32,12 @@ ASN1_INTEGER *num_to_asn1integer(VALUE, ASN1_INTEGER *); * ASN1 module */ extern VALUE mASN1; -extern VALUE eASN1Error; +extern VALUE eASN1Error; extern VALUE cASN1Data; extern VALUE cASN1Primitive; extern VALUE cASN1Constructive; - + extern VALUE cASN1Boolean; /* BOOLEAN */ extern VALUE cASN1Integer, cASN1Enumerated; /* INTEGER */ extern VALUE cASN1BitString; /* BIT STRING */ diff --git a/ext/openssl/ossl_bio.c b/ext/openssl/ossl_bio.c index 6db1fb9..dc8732d 100644 --- a/ext/openssl/ossl_bio.c +++ b/ext/openssl/ossl_bio.c @@ -72,7 +72,7 @@ ossl_protect_membio2str(BIO *bio, int *status) return rb_protect((VALUE(*)_((VALUE)))ossl_membio2str0, (VALUE)bio, status); } -VALUE +VALUE ossl_membio2str(BIO *bio) { VALUE ret; diff --git a/ext/openssl/ossl_bn.c b/ext/openssl/ossl_bn.c index 6db9670..350e465 100644 --- a/ext/openssl/ossl_bn.c +++ b/ext/openssl/ossl_bn.c @@ -380,7 +380,7 @@ ossl_bn_div(VALUE self, VALUE other) } WrapBN(CLASS_OF(self), obj1, r1); WrapBN(CLASS_OF(self), obj2, r2); - + return rb_ary_new3(2, obj1, obj2); } @@ -591,7 +591,7 @@ ossl_bn_s_generate_prime(int argc, VALUE *argv, VALUE klass) ossl_raise(eBNError, NULL); } WrapBN(klass, obj, result); - + return obj; } @@ -615,14 +615,14 @@ static VALUE ossl_bn_copy(VALUE self, VALUE other) { BIGNUM *bn1, *bn2; - + rb_check_frozen(self); - + if (self == other) return self; - + GetBN(self, bn1); bn2 = GetBNPtr(other); - + if (!BN_copy(bn1, bn2)) { ossl_raise(eBNError, NULL); } @@ -793,7 +793,7 @@ Init_ossl_bn() * value_one - DON'T IMPL. * set_word * get_word */ - + rb_define_singleton_method(cBN, "rand", ossl_bn_s_rand, -1); rb_define_singleton_method(cBN, "pseudo_rand", ossl_bn_s_pseudo_rand, -1); rb_define_singleton_method(cBN, "rand_range", ossl_bn_s_rand_range, 1); diff --git a/ext/openssl/ossl_cipher.c b/ext/openssl/ossl_cipher.c index df7856b..73f2c58 100644 --- a/ext/openssl/ossl_cipher.c +++ b/ext/openssl/ossl_cipher.c @@ -287,7 +287,7 @@ ossl_cipher_pkcs5_keyivgen(int argc, VALUE *argv, VALUE self) digest = NIL_P(vdigest) ? EVP_md5() : GetDigestPtr(vdigest); GetCipher(self, ctx); EVP_BytesToKey(EVP_CIPHER_CTX_cipher(ctx), digest, salt, - (unsigned char *)RSTRING_PTR(vpass), RSTRING_LEN(vpass), iter, key, iv); + (unsigned char *)RSTRING_PTR(vpass), RSTRING_LEN(vpass), iter, key, iv); if (EVP_CipherInit_ex(ctx, NULL, NULL, key, iv, -1) != 1) ossl_raise(eCipherError, NULL); OPENSSL_cleanse(key, sizeof key); @@ -305,7 +305,7 @@ ossl_cipher_pkcs5_keyivgen(int argc, VALUE *argv, VALUE self) * +data+ is a nonempty string. * +buffer+ is an optional string to store the result. */ -static VALUE +static VALUE ossl_cipher_update(int argc, VALUE *argv, VALUE self) { EVP_CIPHER_CTX *ctx; @@ -345,7 +345,7 @@ ossl_cipher_update(int argc, VALUE *argv, VALUE self) * * See EVP_CipherFinal_ex for further information. */ -static VALUE +static VALUE ossl_cipher_final(VALUE self) { EVP_CIPHER_CTX *ctx; @@ -445,7 +445,7 @@ ossl_cipher_set_key_length(VALUE self, VALUE key_length) { int len = NUM2INT(key_length); EVP_CIPHER_CTX *ctx; - + GetCipher(self, ctx); if (EVP_CIPHER_CTX_set_key_length(ctx, len) != 1) ossl_raise(eCipherError, NULL); @@ -515,7 +515,7 @@ static VALUE ossl_cipher_block_size() { } /* * INIT */ -void +void Init_ossl_cipher(void) { #if 0 /* let rdoc know about mOSSL */ diff --git a/ext/openssl/ossl_config.c b/ext/openssl/ossl_config.c index aac51f9..c7a2bf4 100644 --- a/ext/openssl/ossl_config.c +++ b/ext/openssl/ossl_config.c @@ -33,8 +33,8 @@ VALUE cConfig; VALUE eConfigError; -/* - * Public +/* + * Public */ static CONF *parse_config(VALUE, CONF*); @@ -154,7 +154,7 @@ ossl_config_initialize(int argc, VALUE *argv, VALUE self) _CONF_new_data(conf); } #endif - + return self; } @@ -187,7 +187,7 @@ ossl_config_add_value(VALUE self, VALUE section, VALUE name, VALUE value) OPENSSL_free(cv); ossl_raise(eConfigError, "_CONF_add_string failure"); } - + return value; #endif } @@ -233,7 +233,7 @@ static VALUE ossl_config_get_value_old(int argc, VALUE *argv, VALUE self) { VALUE section, name; - + rb_scan_args(argc, argv, "11", §ion, &name); /* support conf.value(nil, "HOME") -> conf.get_value("", "HOME") */ diff --git a/ext/openssl/ossl_digest.c b/ext/openssl/ossl_digest.c index 9b8ced5..506d480 100644 --- a/ext/openssl/ossl_digest.c +++ b/ext/openssl/ossl_digest.c @@ -56,14 +56,14 @@ GetDigestPtr(VALUE obj) VALUE ossl_digest_new(const EVP_MD *md) -{ +{ VALUE ret; EVP_MD_CTX *ctx; ret = ossl_digest_alloc(cDigest); GetDigest(ret, ctx); EVP_DigestInit_ex(ctx, md, NULL); - + return ret; } @@ -104,7 +104,7 @@ ossl_digest_initialize(int argc, VALUE *argv, VALUE self) GetDigest(self, ctx); EVP_DigestInit_ex(ctx, md, NULL); - + if (!NIL_P(data)) return ossl_digest_update(self, data); return self; } @@ -113,7 +113,7 @@ static VALUE ossl_digest_copy(VALUE self, VALUE other) { EVP_MD_CTX *ctx1, *ctx2; - + rb_check_frozen(self); if (self == other) return self; diff --git a/ext/openssl/ossl_engine.c b/ext/openssl/ossl_engine.c index ec6f7fd..57e7971 100644 --- a/ext/openssl/ossl_engine.c +++ b/ext/openssl/ossl_engine.c @@ -29,7 +29,7 @@ GetPKCS7(obj, engine); \ } while (0) -/* +/* * Classes */ VALUE cEngine; @@ -327,7 +327,7 @@ ossl_engine_inspect(VALUE self) { VALUE str; const char *cname = rb_class2name(rb_obj_class(self)); - + str = rb_str_new2("#<"); rb_str_cat2(str, cname); rb_str_cat2(str, " id=\""); diff --git a/ext/openssl/ossl_hmac.c b/ext/openssl/ossl_hmac.c index aa7644a..f26a6f5 100644 --- a/ext/openssl/ossl_hmac.c +++ b/ext/openssl/ossl_hmac.c @@ -80,7 +80,7 @@ static VALUE ossl_hmac_copy(VALUE self, VALUE other) { HMAC_CTX *ctx1, *ctx2; - + rb_check_frozen(self); if (self == other) return self; @@ -139,7 +139,7 @@ ossl_hmac_digest(VALUE self) GetHMAC(self, ctx); hmac_final(ctx, &buf, &buf_len); digest = ossl_buf2str((char *)buf, buf_len); - + return digest; } @@ -247,7 +247,7 @@ Init_ossl_hmac() rb_define_alloc_func(cHMAC, ossl_hmac_alloc); rb_define_singleton_method(cHMAC, "digest", ossl_hmac_s_digest, 3); rb_define_singleton_method(cHMAC, "hexdigest", ossl_hmac_s_hexdigest, 3); - + rb_define_method(cHMAC, "initialize", ossl_hmac_initialize, 2); rb_define_copy_func(cHMAC, ossl_hmac_copy); diff --git a/ext/openssl/ossl_ns_spki.c b/ext/openssl/ossl_ns_spki.c index 5ff58c3..2ebad18 100644 --- a/ext/openssl/ossl_ns_spki.c +++ b/ext/openssl/ossl_ns_spki.c @@ -91,7 +91,7 @@ ossl_spki_to_der(VALUE self) if (i2d_NETSCAPE_SPKI(spki, &p) <= 0) ossl_raise(eX509CertError, NULL); ossl_str_adjust(str, p); - + return str; } @@ -187,7 +187,7 @@ ossl_spki_set_challenge(VALUE self, VALUE str) RSTRING_LEN(str))) { ossl_raise(eSPKIError, NULL); } - + return str; } diff --git a/ext/openssl/ossl_ocsp.c b/ext/openssl/ossl_ocsp.c index 898b2ad..1c53147 100644 --- a/ext/openssl/ossl_ocsp.c +++ b/ext/openssl/ossl_ocsp.c @@ -558,7 +558,7 @@ ossl_ocspbres_get_status(VALUE self) } return ret; -} +} static VALUE ossl_ocspbres_sign(int argc, VALUE *argv, VALUE self) diff --git a/ext/openssl/ossl_pkcs12.c b/ext/openssl/ossl_pkcs12.c index a58d5e0..85e092b 100644 --- a/ext/openssl/ossl_pkcs12.c +++ b/ext/openssl/ossl_pkcs12.c @@ -81,7 +81,7 @@ ossl_pkcs12_s_create(int argc, VALUE *argv, VALUE self) STACK_OF(X509) *x509s; int nkey = 0, ncert = 0, kiter = 0, miter = 0, ktype = 0; PKCS12 *p12; - + rb_scan_args(argc, argv, "46", &pass, &name, &pkey, &cert, &ca, &key_nid, &cert_nid, &key_iter, &mac_iter, &keytype); passphrase = NIL_P(pass) ? NULL : StringValuePtr(pass); friendlyname = NIL_P(name) ? NULL : StringValuePtr(name); diff --git a/ext/openssl/ossl_pkcs7.c b/ext/openssl/ossl_pkcs7.c index b0cc656..e61c022 100644 --- a/ext/openssl/ossl_pkcs7.c +++ b/ext/openssl/ossl_pkcs7.c @@ -68,7 +68,7 @@ #define ossl_pkcs7_set_err_string(o,v) rb_iv_set((o), "@error_string", (v)) #define ossl_pkcs7_get_err_string(o) rb_iv_get((o), "@error_string") -/* +/* * Classes */ VALUE cPKCS7; @@ -295,7 +295,7 @@ ossl_pkcs7_alloc(VALUE klass) ossl_raise(ePKCS7Error, NULL); } WrapPKCS7(klass, obj, pkcs7); - + return obj; } @@ -495,7 +495,7 @@ ossl_pkcs7_get_signer(VALUE self) PKCS7_SIGNER_INFO *si; int num, i; VALUE ary; - + GetPKCS7(self, pkcs7); if (!(sk = PKCS7_get_signer_info(pkcs7))) { OSSL_Debug("OpenSSL::PKCS7#get_signer_info == NULL!"); @@ -537,7 +537,7 @@ ossl_pkcs7_get_recipient(VALUE self) PKCS7_RECIP_INFO *si; int num, i; VALUE ary; - + GetPKCS7(self, pkcs7); if (PKCS7_type_is_enveloped(pkcs7)) sk = pkcs7->d.enveloped->recipientinfo; @@ -777,7 +777,7 @@ ossl_pkcs7_add_data(VALUE self, VALUE data) } if(!PKCS7_dataFinal(pkcs7, out)) goto err; ossl_pkcs7_set_data(self, Qnil); - + err: BIO_free(out); BIO_free(in); @@ -1021,10 +1021,10 @@ Init_ossl_pkcs7() cPKCS7Recipient = rb_define_class_under(cPKCS7,"RecipientInfo",rb_cObject); rb_define_alloc_func(cPKCS7Recipient, ossl_pkcs7ri_alloc); - rb_define_method(cPKCS7Recipient, "initialize", ossl_pkcs7ri_initialize,1); + rb_define_method(cPKCS7Recipient, "initialize", ossl_pkcs7ri_initialize,1); rb_define_method(cPKCS7Recipient, "issuer", ossl_pkcs7ri_get_issuer,0); rb_define_method(cPKCS7Recipient, "serial", ossl_pkcs7ri_get_serial,0); - rb_define_method(cPKCS7Recipient, "enc_key", ossl_pkcs7ri_get_enc_key,0); + rb_define_method(cPKCS7Recipient, "enc_key", ossl_pkcs7ri_get_enc_key,0); #define DefPKCS7Const(x) rb_define_const(cPKCS7, #x, INT2NUM(PKCS7_##x)) diff --git a/ext/openssl/ossl_pkey.c b/ext/openssl/ossl_pkey.c index 903a3bb..37a9f8c 100644 --- a/ext/openssl/ossl_pkey.c +++ b/ext/openssl/ossl_pkey.c @@ -214,7 +214,7 @@ Init_ossl_pkey() #if 0 /* let rdoc know about mOSSL */ mOSSL = rb_define_module("OpenSSL"); #endif - + mPKey = rb_define_module_under(mOSSL, "PKey"); ePKeyError = rb_define_class_under(mPKey, "PKeyError", eOSSLError); diff --git a/ext/openssl/ossl_pkey_dh.c b/ext/openssl/ossl_pkey_dh.c index 768cda8..4ce8264 100644 --- a/ext/openssl/ossl_pkey_dh.c +++ b/ext/openssl/ossl_pkey_dh.c @@ -85,7 +85,7 @@ static DH * dh_generate(int size, int gen) { DH *dh; - + dh = DH_generate_parameters(size, gen, rb_block_given_p() ? ossl_generate_cb : NULL, NULL); @@ -244,7 +244,7 @@ ossl_dh_export(VALUE self) */ static VALUE ossl_dh_to_der(VALUE self) -{ +{ EVP_PKEY *pkey; unsigned char *p; long len; @@ -284,7 +284,7 @@ ossl_dh_get_params(VALUE self) rb_hash_aset(hash, rb_str_new2("g"), ossl_bn_new(pkey->pkey.dh->g)); rb_hash_aset(hash, rb_str_new2("pub_key"), ossl_bn_new(pkey->pkey.dh->pub_key)); rb_hash_aset(hash, rb_str_new2("priv_key"), ossl_bn_new(pkey->pkey.dh->priv_key)); - + return hash; } @@ -351,7 +351,7 @@ ossl_dh_check_params(VALUE self) DH *dh; EVP_PKEY *pkey; int codes; - + GetPKeyDH(self, pkey); dh = pkey->pkey.dh; @@ -436,10 +436,10 @@ static unsigned char DEFAULT_DH_512_PRIM[] = { 0x08, 0x04, 0x8c, 0x52, 0x8f, 0xe3, 0x4a, 0x31, 0x44, 0x47, 0x19, 0xa1, 0x4a, 0xc8, 0x8b, 0xcb, }; -static unsigned char DEFAULT_DH_512_GEN[] = { 0x02 }; +static unsigned char DEFAULT_DH_512_GEN[] = { 0x02 }; DH *OSSL_DEFAULT_DH_512 = NULL; - -/* + +/* * -----BEGIN DH PARAMETERS----- * MIGHAoGBAJ0lOVy0VIr/JebWn0zDwY2h+rqITFOpdNr6ugsgvkDXuucdcChhYExJ * AV/ZD2AWPbrTqV76mGRgJg4EddgT1zG0jq3rnFdMj2XzkBYx3BVvfR0Arnby0RHR diff --git a/ext/openssl/ossl_pkey_dsa.c b/ext/openssl/ossl_pkey_dsa.c index d39933b..7b2db70 100644 --- a/ext/openssl/ossl_pkey_dsa.c +++ b/ext/openssl/ossl_pkey_dsa.c @@ -320,7 +320,7 @@ ossl_dsa_get_params(VALUE self) rb_hash_aset(hash, rb_str_new2("g"), ossl_bn_new(pkey->pkey.dsa->g)); rb_hash_aset(hash, rb_str_new2("pub_key"), ossl_bn_new(pkey->pkey.dsa->pub_key)); rb_hash_aset(hash, rb_str_new2("priv_key"), ossl_bn_new(pkey->pkey.dsa->priv_key)); - + return hash; } diff --git a/ext/openssl/ossl_pkey_ec.c b/ext/openssl/ossl_pkey_ec.c index edb5695..a7907cd 100644 --- a/ext/openssl/ossl_pkey_ec.c +++ b/ext/openssl/ossl_pkey_ec.c @@ -274,7 +274,7 @@ static VALUE ossl_ec_key_get_group(VALUE self) * the group. * * Setting the group will immediately destroy any previously assigned group object. - * The group is internally copied by OpenSSL. Modifying the original group after + * The group is internally copied by OpenSSL. Modifying the original group after * assignment will not effect the internal key structure. * (your changes may be lost). BE CAREFUL. * @@ -1023,7 +1023,7 @@ static VALUE ossl_ec_group_set_asn1_flag(VALUE self, VALUE flag_v) } /* call-seq: - * group.point_conversion_form => :uncompressed | :compressed | :hybrid + * group.point_conversion_form => :uncompressed | :compressed | :hybrid * * See the OpenSSL documentation for EC_GROUP_get_point_conversion_form() */ @@ -1043,7 +1043,7 @@ static VALUE ossl_ec_group_get_point_conversion_form(VALUE self) case POINT_CONVERSION_HYBRID: ret = ID_hybrid; break; default: rb_raise(eEC_GROUP, "unsupported point conversion form: %d, this module should be updated", form); } - + return ID2SYM(ret); } @@ -1270,7 +1270,7 @@ static VALUE ossl_ec_point_initialize(int argc, VALUE *argv, VALUE self) rb_raise(rb_eArgError, "1st argument must be OpenSSL::PKey::EC::Group"); group_v = arg1; SafeRequire_EC_GROUP(group_v, group); - + if (rb_obj_is_kind_of(arg2, cBN)) { const BIGNUM *bn = GetBNPtr(arg2); diff --git a/ext/openssl/ossl_pkey_rsa.c b/ext/openssl/ossl_pkey_rsa.c index 80665cd..0421ec5 100644 --- a/ext/openssl/ossl_pkey_rsa.c +++ b/ext/openssl/ossl_pkey_rsa.c @@ -124,7 +124,7 @@ ossl_rsa_s_generate(int argc, VALUE *argv, VALUE klass) * * +pass+ is an optional string with the password to decrypt the encoded key. * * === Examples - * * RSA.new(2048) -> rsa + * * RSA.new(2048) -> rsa * * RSA.new(File.read("rsa.pem")) -> rsa * * RSA.new(File.read("rsa.pem"), "mypassword") -> rsa */ @@ -211,7 +211,7 @@ ossl_rsa_is_private(VALUE self) EVP_PKEY *pkey; GetPKeyRSA(self, pkey); - + return (RSA_PRIVATE(self, pkey->pkey.rsa)) ? Qtrue : Qfalse; } @@ -262,7 +262,7 @@ ossl_rsa_export(int argc, VALUE *argv, VALUE self) } } str = ossl_membio2str(out); - + return str; } @@ -346,7 +346,7 @@ ossl_rsa_public_decrypt(int argc, VALUE *argv, VALUE self) pad); if (buf_len < 0) ossl_raise(eRSAError, NULL); rb_str_set_len(str, buf_len); - + return str; } @@ -375,7 +375,7 @@ ossl_rsa_private_encrypt(int argc, VALUE *argv, VALUE self) pad); if (buf_len < 0) ossl_raise(eRSAError, NULL); rb_str_set_len(str, buf_len); - + return str; } @@ -435,7 +435,7 @@ ossl_rsa_get_params(VALUE self) rb_hash_aset(hash, rb_str_new2("dmp1"), ossl_bn_new(pkey->pkey.rsa->dmp1)); rb_hash_aset(hash, rb_str_new2("dmq1"), ossl_bn_new(pkey->pkey.rsa->dmq1)); rb_hash_aset(hash, rb_str_new2("iqmp"), ossl_bn_new(pkey->pkey.rsa->iqmp)); - + return hash; } @@ -479,7 +479,7 @@ ossl_rsa_to_public_key(VALUE self) EVP_PKEY *pkey; RSA *rsa; VALUE obj; - + GetPKeyRSA(self, pkey); /* err check performed by rsa_instance */ rsa = RSAPublicKey_dup(pkey->pkey.rsa); @@ -498,7 +498,7 @@ static VALUE ossl_rsa_blinding_on(VALUE self) { EVP_PKEY *pkey; - + GetPKeyRSA(self, pkey); if (RSA_blinding_on(pkey->pkey.rsa, ossl_bn_ctx) != 1) { @@ -511,7 +511,7 @@ static VALUE ossl_rsa_blinding_off(VALUE self) { EVP_PKEY *pkey; - + GetPKeyRSA(self, pkey); RSA_blinding_off(pkey->pkey.rsa); diff --git a/ext/openssl/ossl_ssl.c b/ext/openssl/ossl_ssl.c index e70a868..c17d0ab 100644 --- a/ext/openssl/ossl_ssl.c +++ b/ext/openssl/ossl_ssl.c @@ -91,7 +91,7 @@ static const char *ossl_ssl_attrs[] = { #ifdef HAVE_SSL_SET_TLSEXT_HOST_NAME "hostname", #endif - "sync_close", + "sync_close", }; ID ID_callback_state; @@ -304,7 +304,7 @@ static VALUE ossl_call_session_get_cb(VALUE ary) { VALUE ssl_obj, sslctx_obj, cb; - + Check_Type(ary, T_ARRAY); ssl_obj = rb_ary_entry(ary, 0); @@ -351,7 +351,7 @@ static VALUE ossl_call_session_new_cb(VALUE ary) { VALUE ssl_obj, sslctx_obj, cb; - + Check_Type(ary, T_ARRAY); ssl_obj = rb_ary_entry(ary, 0); @@ -398,7 +398,7 @@ static VALUE ossl_call_session_remove_cb(VALUE ary) { VALUE sslctx_obj, cb; - + Check_Type(ary, T_ARRAY); sslctx_obj = rb_ary_entry(ary, 0); @@ -1585,7 +1585,7 @@ Init_ossl_ssl() rb_define_method(cSSLContext, "setup", ossl_sslctx_setup, 0); - + rb_define_const(cSSLContext, "SESSION_CACHE_OFF", LONG2FIX(SSL_SESS_CACHE_OFF)); rb_define_const(cSSLContext, "SESSION_CACHE_CLIENT", LONG2FIX(SSL_SESS_CACHE_CLIENT)); /* doesn't actually do anything in 0.9.8e */ rb_define_const(cSSLContext, "SESSION_CACHE_SERVER", LONG2FIX(SSL_SESS_CACHE_SERVER)); diff --git a/ext/openssl/ossl_ssl.h b/ext/openssl/ossl_ssl.h index 487f412..92df5f5 100644 --- a/ext/openssl/ossl_ssl.h +++ b/ext/openssl/ossl_ssl.h @@ -22,7 +22,7 @@ OSSL_Check_Kind(obj, cSSLSession); \ GetSSLSession(obj, sess); \ } while (0) - + extern VALUE mSSL; extern VALUE eSSLError; extern VALUE cSSLSocket; diff --git a/ext/openssl/ossl_ssl_session.c b/ext/openssl/ossl_ssl_session.c index d5fdba6..21aafed 100644 --- a/ext/openssl/ossl_ssl_session.c +++ b/ext/openssl/ossl_ssl_session.c @@ -15,7 +15,7 @@ OSSL_Check_Kind(obj, cSSLSession); \ GetSSLSession(obj, sess); \ } while (0) - + VALUE cSSLSession; static VALUE eSSLSession; @@ -214,7 +214,7 @@ static VALUE ossl_ssl_session_to_pem(VALUE self) BUF_MEM *buf; VALUE str; int i; - + GetSSLSession(self, ctx); if (!(out = BIO_new(BIO_s_mem()))) { @@ -246,7 +246,7 @@ static VALUE ossl_ssl_session_to_text(VALUE self) BIO *out; BUF_MEM *buf; VALUE str; - + GetSSLSession(self, ctx); if (!(out = BIO_new(BIO_s_mem()))) { @@ -264,7 +264,7 @@ static VALUE ossl_ssl_session_to_text(VALUE self) return str; } - + void Init_ossl_ssl_session(void) { diff --git a/ext/openssl/ossl_x509attr.c b/ext/openssl/ossl_x509attr.c index 2a4c481..1ab1369 100644 --- a/ext/openssl/ossl_x509attr.c +++ b/ext/openssl/ossl_x509attr.c @@ -41,7 +41,7 @@ ossl_x509attr_new(X509_ATTRIBUTE *attr) { X509_ATTRIBUTE *new; VALUE obj; - + if (!attr) { new = X509_ATTRIBUTE_new(); } else { @@ -77,7 +77,7 @@ ossl_x509attr_alloc(VALUE klass) X509_ATTRIBUTE *attr; VALUE obj; - if (!(attr = X509_ATTRIBUTE_new())) + if (!(attr = X509_ATTRIBUTE_new())) ossl_raise(eX509AttrError, NULL); WrapX509Attr(klass, obj, attr); @@ -123,14 +123,14 @@ ossl_x509attr_set_oid(VALUE self, VALUE oid) X509_ATTRIBUTE *attr; ASN1_OBJECT *obj; char *s; - + s = StringValuePtr(oid); obj = OBJ_txt2obj(s, 0); if(!obj) obj = OBJ_txt2obj(s, 1); if(!obj) ossl_raise(eX509AttrError, NULL); GetX509Attr(self, attr); X509_ATTRIBUTE_set1_object(attr, obj); - + return oid; } @@ -157,7 +157,7 @@ ossl_x509attr_get_oid(VALUE self) i2a_ASN1_OBJECT(out, oid); ret = ossl_membio2str(out); } - + return ret; } @@ -251,7 +251,7 @@ ossl_x509attr_to_der(VALUE self) p = (unsigned char *)RSTRING_PTR(str); if(i2d_X509_ATTRIBUTE(attr, &p) <= 0) ossl_raise(eX509AttrError, NULL); - rb_str_set_len(str, p - (unsigned char*)RSTRING_PTR(str)); + rb_str_set_len(str, p - (unsigned char*)RSTRING_PTR(str)); return str; } diff --git a/ext/openssl/ossl_x509cert.c b/ext/openssl/ossl_x509cert.c index fec2d8b..09f4d6b 100644 --- a/ext/openssl/ossl_x509cert.c +++ b/ext/openssl/ossl_x509cert.c @@ -55,7 +55,7 @@ ossl_x509_new(X509 *x509) return obj; } -VALUE +VALUE ossl_x509_new_from_file(VALUE filename) { X509 *x509; @@ -111,7 +111,7 @@ DupX509CertPtr(VALUE obj) /* * Private */ -static VALUE +static VALUE ossl_x509_alloc(VALUE klass) { X509 *x509; @@ -130,7 +130,7 @@ ossl_x509_alloc(VALUE klass) * Certificate.new => cert * Certificate.new(string) => cert */ -static VALUE +static VALUE ossl_x509_initialize(int argc, VALUE *argv, VALUE self) { BIO *in; @@ -152,7 +152,7 @@ ossl_x509_initialize(int argc, VALUE *argv, VALUE self) } BIO_free(in); if (!x509) ossl_raise(eX509CertError, NULL); - + return self; } @@ -169,7 +169,7 @@ ossl_x509_copy(VALUE self, VALUE other) x509 = X509_dup(b); if (!x509) ossl_raise(eX509CertError, NULL); - + DATA_PTR(self) = x509; X509_free(a); @@ -180,7 +180,7 @@ ossl_x509_copy(VALUE self, VALUE other) * call-seq: * cert.to_der => string */ -static VALUE +static VALUE ossl_x509_to_der(VALUE self) { X509 *x509; @@ -196,7 +196,7 @@ ossl_x509_to_der(VALUE self) if (i2d_X509(x509, &p) <= 0) ossl_raise(eX509CertError, NULL); ossl_str_adjust(str, p); - + return str; } @@ -204,7 +204,7 @@ ossl_x509_to_der(VALUE self) * call-seq: * cert.to_pem => string */ -static VALUE +static VALUE ossl_x509_to_pem(VALUE self) { X509 *x509; @@ -253,7 +253,7 @@ ossl_x509_to_text(VALUE self) /* * Makes from X509 X509_REQuest */ -static VALUE +static VALUE ossl_x509_to_req(VALUE self) { X509 *x509; @@ -275,7 +275,7 @@ ossl_x509_to_req(VALUE self) * call-seq: * cert.version => integer */ -static VALUE +static VALUE ossl_x509_get_version(VALUE self) { X509 *x509; @@ -289,7 +289,7 @@ ossl_x509_get_version(VALUE self) * call-seq: * cert.version = integer => integer */ -static VALUE +static VALUE ossl_x509_set_version(VALUE self, VALUE version) { X509 *x509; @@ -310,7 +310,7 @@ ossl_x509_set_version(VALUE self, VALUE version) * call-seq: * cert.serial => integer */ -static VALUE +static VALUE ossl_x509_get_serial(VALUE self) { X509 *x509; @@ -324,7 +324,7 @@ ossl_x509_get_serial(VALUE self) * call-seq: * cert.serial = integer => integer */ -static VALUE +static VALUE ossl_x509_set_serial(VALUE self, VALUE num) { X509 *x509; @@ -341,7 +341,7 @@ ossl_x509_set_serial(VALUE self, VALUE num) * call-seq: * cert.signature_algorithm => string */ -static VALUE +static VALUE ossl_x509_get_signature_algorithm(VALUE self) { X509 *x509; @@ -365,7 +365,7 @@ ossl_x509_get_signature_algorithm(VALUE self) * call-seq: * cert.subject => name */ -static VALUE +static VALUE ossl_x509_get_subject(VALUE self) { X509 *x509; @@ -383,7 +383,7 @@ ossl_x509_get_subject(VALUE self) * call-seq: * cert.subject = name => name */ -static VALUE +static VALUE ossl_x509_set_subject(VALUE self, VALUE subject) { X509 *x509; @@ -400,7 +400,7 @@ ossl_x509_set_subject(VALUE self, VALUE subject) * call-seq: * cert.issuer => name */ -static VALUE +static VALUE ossl_x509_get_issuer(VALUE self) { X509 *x509; @@ -418,7 +418,7 @@ ossl_x509_get_issuer(VALUE self) * call-seq: * cert.issuer = name => name */ -static VALUE +static VALUE ossl_x509_set_issuer(VALUE self, VALUE issuer) { X509 *x509; @@ -435,7 +435,7 @@ ossl_x509_set_issuer(VALUE self, VALUE issuer) * call-seq: * cert.not_before => time */ -static VALUE +static VALUE ossl_x509_get_not_before(VALUE self) { X509 *x509; @@ -453,7 +453,7 @@ ossl_x509_get_not_before(VALUE self) * call-seq: * cert.not_before = time => time */ -static VALUE +static VALUE ossl_x509_set_not_before(VALUE self, VALUE time) { X509 *x509; @@ -472,7 +472,7 @@ ossl_x509_set_not_before(VALUE self, VALUE time) * call-seq: * cert.not_after => time */ -static VALUE +static VALUE ossl_x509_get_not_after(VALUE self) { X509 *x509; @@ -490,7 +490,7 @@ ossl_x509_get_not_after(VALUE self) * call-seq: * cert.not_before = time => time */ -static VALUE +static VALUE ossl_x509_set_not_after(VALUE self, VALUE time) { X509 *x509; @@ -509,7 +509,7 @@ ossl_x509_set_not_after(VALUE self, VALUE time) * call-seq: * cert.public_key => key */ -static VALUE +static VALUE ossl_x509_get_public_key(VALUE self) { X509 *x509; @@ -527,7 +527,7 @@ ossl_x509_get_public_key(VALUE self) * call-seq: * cert.public_key = key => key */ -static VALUE +static VALUE ossl_x509_set_public_key(VALUE self, VALUE key) { X509 *x509; @@ -544,7 +544,7 @@ ossl_x509_set_public_key(VALUE self, VALUE key) * call-seq: * cert.sign(key, digest) => self */ -static VALUE +static VALUE ossl_x509_sign(VALUE self, VALUE key, VALUE digest) { X509 *x509; @@ -567,7 +567,7 @@ ossl_x509_sign(VALUE self, VALUE key, VALUE digest) * * Checks that cert signature is made with PRIVversion of this PUBLIC 'key' */ -static VALUE +static VALUE ossl_x509_verify(VALUE self, VALUE key) { X509 *x509; @@ -578,7 +578,7 @@ ossl_x509_verify(VALUE self, VALUE key) GetX509(self, x509); if ((i = X509_verify(x509, pkey)) < 0) { ossl_raise(eX509CertError, NULL); - } + } if (i > 0) { return Qtrue; } @@ -592,7 +592,7 @@ ossl_x509_verify(VALUE self, VALUE key) * * Checks if 'key' is PRIV key for this cert */ -static VALUE +static VALUE ossl_x509_check_private_key(VALUE self, VALUE key) { X509 *x509; @@ -613,7 +613,7 @@ ossl_x509_check_private_key(VALUE self, VALUE key) * call-seq: * cert.extensions => [extension...] */ -static VALUE +static VALUE ossl_x509_get_extensions(VALUE self) { X509 *x509; @@ -639,7 +639,7 @@ ossl_x509_get_extensions(VALUE self) * call-seq: * cert.extensions = [ext...] => [ext...] */ -static VALUE +static VALUE ossl_x509_set_extensions(VALUE self, VALUE ary) { X509 *x509; @@ -671,7 +671,7 @@ ossl_x509_set_extensions(VALUE self, VALUE ary) * call-seq: * cert.add_extension(extension) => extension */ -static VALUE +static VALUE ossl_x509_add_extension(VALUE self, VALUE extension) { X509 *x509; @@ -725,7 +725,7 @@ ossl_x509_inspect(VALUE self) /* * INIT */ -void +void Init_ossl_x509cert() { eX509CertError = rb_define_class_under(mX509, "CertificateError", eOSSLError); @@ -735,7 +735,7 @@ Init_ossl_x509cert() 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); - + rb_define_method(cX509Cert, "to_der", ossl_x509_to_der, 0); rb_define_method(cX509Cert, "to_pem", ossl_x509_to_pem, 0); rb_define_alias(cX509Cert, "to_s", "to_pem"); diff --git a/ext/openssl/ossl_x509crl.c b/ext/openssl/ossl_x509crl.c index 818fdba..ef03fe1 100644 --- a/ext/openssl/ossl_x509crl.c +++ b/ext/openssl/ossl_x509crl.c @@ -66,14 +66,14 @@ ossl_x509crl_new(X509_CRL *crl) tmp = crl ? X509_CRL_dup(crl) : X509_CRL_new(); if(!tmp) ossl_raise(eX509CRLError, NULL); WrapX509CRL(cX509CRL, obj, tmp); - + return obj; } /* * PRIVATE */ -static VALUE +static VALUE ossl_x509crl_alloc(VALUE klass) { X509_CRL *crl; @@ -87,7 +87,7 @@ ossl_x509crl_alloc(VALUE klass) return obj; } -static VALUE +static VALUE ossl_x509crl_initialize(int argc, VALUE *argv, VALUE self) { BIO *in; @@ -130,7 +130,7 @@ ossl_x509crl_copy(VALUE self, VALUE other) return self; } -static VALUE +static VALUE ossl_x509crl_get_version(VALUE self) { X509_CRL *crl; @@ -142,7 +142,7 @@ ossl_x509crl_get_version(VALUE self) return LONG2NUM(ver); } -static VALUE +static VALUE ossl_x509crl_set_version(VALUE self, VALUE version) { X509_CRL *crl; @@ -159,7 +159,7 @@ ossl_x509crl_set_version(VALUE self, VALUE version) return version; } -static VALUE +static VALUE ossl_x509crl_get_signature_algorithm(VALUE self) { X509_CRL *crl; @@ -181,7 +181,7 @@ ossl_x509crl_get_signature_algorithm(VALUE self) return str; } -static VALUE +static VALUE ossl_x509crl_get_issuer(VALUE self) { X509_CRL *crl; @@ -191,7 +191,7 @@ ossl_x509crl_get_issuer(VALUE self) return ossl_x509name_new(X509_CRL_get_issuer(crl)); /* NO DUP - don't free */ } -static VALUE +static VALUE ossl_x509crl_set_issuer(VALUE self, VALUE issuer) { X509_CRL *crl; @@ -204,7 +204,7 @@ ossl_x509crl_set_issuer(VALUE self, VALUE issuer) return issuer; } -static VALUE +static VALUE ossl_x509crl_get_last_update(VALUE self) { X509_CRL *crl; @@ -214,7 +214,7 @@ ossl_x509crl_get_last_update(VALUE self) return asn1time_to_time(X509_CRL_get_lastUpdate(crl)); } -static VALUE +static VALUE ossl_x509crl_set_last_update(VALUE self, VALUE time) { X509_CRL *crl; @@ -229,7 +229,7 @@ ossl_x509crl_set_last_update(VALUE self, VALUE time) return time; } -static VALUE +static VALUE ossl_x509crl_get_next_update(VALUE self) { X509_CRL *crl; @@ -239,7 +239,7 @@ ossl_x509crl_get_next_update(VALUE self) return asn1time_to_time(X509_CRL_get_nextUpdate(crl)); } -static VALUE +static VALUE ossl_x509crl_set_next_update(VALUE self, VALUE time) { X509_CRL *crl; @@ -280,7 +280,7 @@ ossl_x509crl_get_revoked(VALUE self) return ary; } -static VALUE +static VALUE ossl_x509crl_set_revoked(VALUE self, VALUE ary) { X509_CRL *crl; @@ -306,7 +306,7 @@ ossl_x509crl_set_revoked(VALUE self, VALUE ary) return ary; } -static VALUE +static VALUE ossl_x509crl_add_revoked(VALUE self, VALUE revoked) { X509_CRL *crl; @@ -322,7 +322,7 @@ ossl_x509crl_add_revoked(VALUE self, VALUE revoked) return revoked; } -static VALUE +static VALUE ossl_x509crl_sign(VALUE self, VALUE key, VALUE digest) { X509_CRL *crl; @@ -339,7 +339,7 @@ ossl_x509crl_sign(VALUE self, VALUE key, VALUE digest) return self; } -static VALUE +static VALUE ossl_x509crl_verify(VALUE self, VALUE key) { X509_CRL *crl; @@ -356,7 +356,7 @@ ossl_x509crl_verify(VALUE self, VALUE key) return Qfalse; } -static VALUE +static VALUE ossl_x509crl_to_der(VALUE self) { X509_CRL *crl; @@ -379,7 +379,7 @@ ossl_x509crl_to_der(VALUE self) return str; } -static VALUE +static VALUE ossl_x509crl_to_pem(VALUE self) { X509_CRL *crl; @@ -402,7 +402,7 @@ ossl_x509crl_to_pem(VALUE self) return str; } -static VALUE +static VALUE ossl_x509crl_to_text(VALUE self) { X509_CRL *crl; @@ -428,7 +428,7 @@ ossl_x509crl_to_text(VALUE self) /* * Gets X509v3 extensions as array of X509Ext objects */ -static VALUE +static VALUE ossl_x509crl_get_extensions(VALUE self) { X509_CRL *crl; @@ -454,7 +454,7 @@ ossl_x509crl_get_extensions(VALUE self) /* * Sets X509_EXTENSIONs */ -static VALUE +static VALUE ossl_x509crl_set_extensions(VALUE self, VALUE ary) { X509_CRL *crl; @@ -481,7 +481,7 @@ ossl_x509crl_set_extensions(VALUE self, VALUE ary) return ary; } -static VALUE +static VALUE ossl_x509crl_add_extension(VALUE self, VALUE extension) { X509_CRL *crl; @@ -501,7 +501,7 @@ ossl_x509crl_add_extension(VALUE self, VALUE extension) /* * INIT */ -void +void Init_ossl_x509crl() { eX509CRLError = rb_define_class_under(mX509, "CRLError", eOSSLError); @@ -511,7 +511,7 @@ Init_ossl_x509crl() 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); - + rb_define_method(cX509CRL, "version", ossl_x509crl_get_version, 0); rb_define_method(cX509CRL, "version=", ossl_x509crl_set_version, 1); rb_define_method(cX509CRL, "signature_algorithm", ossl_x509crl_get_signature_algorithm, 0); diff --git a/ext/openssl/ossl_x509ext.c b/ext/openssl/ossl_x509ext.c index d796154..d703edc 100644 --- a/ext/openssl/ossl_x509ext.c +++ b/ext/openssl/ossl_x509ext.c @@ -49,7 +49,7 @@ VALUE eX509ExtError; /* * Public */ -VALUE +VALUE ossl_x509ext_new(X509_EXTENSION *ext) { X509_EXTENSION *new; @@ -103,7 +103,7 @@ ossl_x509extfactory_free(X509V3_CTX *ctx) OPENSSL_free(ctx); } -static VALUE +static VALUE ossl_x509extfactory_alloc(VALUE klass) { X509V3_CTX *ctx; @@ -115,7 +115,7 @@ ossl_x509extfactory_alloc(VALUE klass) return obj; } -static VALUE +static VALUE ossl_x509extfactory_set_issuer_cert(VALUE self, VALUE cert) { X509V3_CTX *ctx; @@ -127,7 +127,7 @@ ossl_x509extfactory_set_issuer_cert(VALUE self, VALUE cert) return cert; } -static VALUE +static VALUE ossl_x509extfactory_set_subject_cert(VALUE self, VALUE cert) { X509V3_CTX *ctx; @@ -139,7 +139,7 @@ ossl_x509extfactory_set_subject_cert(VALUE self, VALUE cert) return cert; } -static VALUE +static VALUE ossl_x509extfactory_set_subject_req(VALUE self, VALUE req) { X509V3_CTX *ctx; @@ -151,7 +151,7 @@ ossl_x509extfactory_set_subject_req(VALUE self, VALUE req) return req; } -static VALUE +static VALUE ossl_x509extfactory_set_crl(VALUE self, VALUE crl) { X509V3_CTX *ctx; @@ -181,7 +181,7 @@ ossl_x509extfactory_set_config(VALUE self, VALUE config) #define rb_f_fork rb_f_notimplement #endif -static VALUE +static VALUE ossl_x509extfactory_initialize(int argc, VALUE *argv, VALUE self) { /*X509V3_CTX *ctx;*/ @@ -211,7 +211,7 @@ ossl_x509extfactory_initialize(int argc, VALUE *argv, VALUE self) * ["ln", "critical,value"] or the same for sn * ["ln", "value"] => not critical */ -static VALUE +static VALUE ossl_x509extfactory_create_ext(int argc, VALUE *argv, VALUE self) { X509V3_CTX *ctx; @@ -351,7 +351,7 @@ ossl_x509ext_set_critical(VALUE self, VALUE flag) return flag; } -static VALUE +static VALUE ossl_x509ext_get_oid(VALUE obj) { X509_EXTENSION *ext; @@ -427,7 +427,7 @@ void 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); diff --git a/ext/openssl/ossl_x509name.c b/ext/openssl/ossl_x509name.c index fd8e329..12e8022 100644 --- a/ext/openssl/ossl_x509name.c +++ b/ext/openssl/ossl_x509name.c @@ -41,7 +41,7 @@ VALUE eX509NameError; /* * Public */ -VALUE +VALUE ossl_x509name_new(X509_NAME *name) { X509_NAME *new; @@ -56,7 +56,7 @@ ossl_x509name_new(X509_NAME *name) ossl_raise(eX509NameError, NULL); } WrapX509Name(cX509Name, obj, new); - + return obj; } @@ -222,7 +222,7 @@ ossl_x509name_to_s(int argc, VALUE *argv, VALUE self) * call-seq: * name.to_a => [[name, data, type], ...] */ -static VALUE +static VALUE ossl_x509name_to_a(VALUE self) { X509_NAME *name; @@ -333,7 +333,7 @@ ossl_x509name_to_der(VALUE self) /* * INIT */ -void +void Init_ossl_x509name() { VALUE utf8str, ptrstr, ia5str, hash; diff --git a/ext/openssl/ossl_x509req.c b/ext/openssl/ossl_x509req.c index 7c1b610..1821a43 100644 --- a/ext/openssl/ossl_x509req.c +++ b/ext/openssl/ossl_x509req.c @@ -81,7 +81,7 @@ DupX509ReqPtr(VALUE obj) /* * Private functions */ -static VALUE +static VALUE ossl_x509req_alloc(VALUE klass) { X509_REQ *req; @@ -95,7 +95,7 @@ ossl_x509req_alloc(VALUE klass) return obj; } -static VALUE +static VALUE ossl_x509req_initialize(int argc, VALUE *argv, VALUE self) { BIO *in; @@ -138,7 +138,7 @@ ossl_x509req_copy(VALUE self, VALUE other) return self; } -static VALUE +static VALUE ossl_x509req_to_pem(VALUE self) { X509_REQ *req; @@ -181,7 +181,7 @@ ossl_x509req_to_der(VALUE self) return str; } -static VALUE +static VALUE ossl_x509req_to_text(VALUE self) { X509_REQ *req; @@ -208,7 +208,7 @@ ossl_x509req_to_text(VALUE self) /* * Makes X509 from X509_REQuest */ -static VALUE +static VALUE ossl_x509req_to_x509(VALUE self, VALUE days, VALUE key) { X509_REQ *req; @@ -224,7 +224,7 @@ ossl_x509req_to_x509(VALUE self, VALUE days, VALUE key) } #endif -static VALUE +static VALUE ossl_x509req_get_version(VALUE self) { X509_REQ *req; @@ -236,7 +236,7 @@ ossl_x509req_get_version(VALUE self) return LONG2FIX(version); } -static VALUE +static VALUE ossl_x509req_set_version(VALUE self, VALUE version) { X509_REQ *req; @@ -253,7 +253,7 @@ ossl_x509req_set_version(VALUE self, VALUE version) return version; } -static VALUE +static VALUE ossl_x509req_get_subject(VALUE self) { X509_REQ *req; @@ -267,7 +267,7 @@ ossl_x509req_get_subject(VALUE self) return ossl_x509name_new(name); } -static VALUE +static VALUE ossl_x509req_set_subject(VALUE self, VALUE subject) { X509_REQ *req; @@ -281,7 +281,7 @@ ossl_x509req_set_subject(VALUE self, VALUE subject) return subject; } -static VALUE +static VALUE ossl_x509req_get_signature_algorithm(VALUE self) { X509_REQ *req; @@ -304,7 +304,7 @@ ossl_x509req_get_signature_algorithm(VALUE self) return str; } -static VALUE +static VALUE ossl_x509req_get_public_key(VALUE self) { X509_REQ *req; @@ -318,7 +318,7 @@ ossl_x509req_get_public_key(VALUE self) return ossl_pkey_new(pkey); /* NO DUP - OK */ } -static VALUE +static VALUE ossl_x509req_set_public_key(VALUE self, VALUE key) { X509_REQ *req; @@ -333,7 +333,7 @@ ossl_x509req_set_public_key(VALUE self, VALUE key) return key; } -static VALUE +static VALUE ossl_x509req_sign(VALUE self, VALUE key, VALUE digest) { X509_REQ *req; @@ -353,7 +353,7 @@ ossl_x509req_sign(VALUE self, VALUE key, VALUE digest) /* * Checks that cert signature is made with PRIVversion of this PUBLIC 'key' */ -static VALUE +static VALUE ossl_x509req_verify(VALUE self, VALUE key) { X509_REQ *req; @@ -372,7 +372,7 @@ ossl_x509req_verify(VALUE self, VALUE key) return Qfalse; } -static VALUE +static VALUE ossl_x509req_get_attributes(VALUE self) { X509_REQ *req; @@ -396,7 +396,7 @@ ossl_x509req_get_attributes(VALUE self) return ary; } -static VALUE +static VALUE ossl_x509req_set_attributes(VALUE self, VALUE ary) { X509_REQ *req; @@ -421,7 +421,7 @@ ossl_x509req_set_attributes(VALUE self, VALUE ary) return ary; } -static VALUE +static VALUE ossl_x509req_add_attribute(VALUE self, VALUE attr) { X509_REQ *req; @@ -437,7 +437,7 @@ ossl_x509req_add_attribute(VALUE self, VALUE attr) /* * X509_REQUEST init */ -void +void Init_ossl_x509req() { eX509ReqError = rb_define_class_under(mX509, "RequestError", eOSSLError); diff --git a/ext/openssl/ossl_x509revoked.c b/ext/openssl/ossl_x509revoked.c index d0f816b..1654cc6 100644 --- a/ext/openssl/ossl_x509revoked.c +++ b/ext/openssl/ossl_x509revoked.c @@ -36,7 +36,7 @@ VALUE eX509RevError; /* * PUBLIC */ -VALUE +VALUE ossl_x509revoked_new(X509_REVOKED *rev) { X509_REVOKED *new; @@ -71,7 +71,7 @@ DupX509RevokedPtr(VALUE obj) /* * PRIVATE */ -static VALUE +static VALUE ossl_x509revoked_alloc(VALUE klass) { X509_REVOKED *rev; @@ -85,14 +85,14 @@ ossl_x509revoked_alloc(VALUE klass) return obj; } -static VALUE +static VALUE ossl_x509revoked_initialize(int argc, VALUE *argv, VALUE self) { /* EMPTY */ return self; } -static VALUE +static VALUE ossl_x509revoked_get_serial(VALUE self) { X509_REVOKED *rev; @@ -102,7 +102,7 @@ ossl_x509revoked_get_serial(VALUE self) return asn1integer_to_num(rev->serialNumber); } -static VALUE +static VALUE ossl_x509revoked_set_serial(VALUE self, VALUE num) { X509_REVOKED *rev; @@ -113,7 +113,7 @@ ossl_x509revoked_set_serial(VALUE self, VALUE num) return num; } -static VALUE +static VALUE ossl_x509revoked_get_time(VALUE self) { X509_REVOKED *rev; @@ -123,7 +123,7 @@ ossl_x509revoked_get_time(VALUE self) return asn1time_to_time(rev->revocationDate); } -static VALUE +static VALUE ossl_x509revoked_set_time(VALUE self, VALUE time) { X509_REVOKED *rev; @@ -140,7 +140,7 @@ ossl_x509revoked_set_time(VALUE self, VALUE time) /* * Gets X509v3 extensions as array of X509Ext objects */ -static VALUE +static VALUE ossl_x509revoked_get_extensions(VALUE self) { X509_REVOKED *rev; @@ -166,7 +166,7 @@ ossl_x509revoked_get_extensions(VALUE self) /* * Sets X509_EXTENSIONs */ -static VALUE +static VALUE ossl_x509revoked_set_extensions(VALUE self, VALUE ary) { X509_REVOKED *rev; @@ -196,7 +196,7 @@ static VALUE ossl_x509revoked_add_extension(VALUE self, VALUE ext) { X509_REVOKED *rev; - + GetX509Rev(self, rev); if(!X509_REVOKED_add_ext(rev, DupX509ExtPtr(ext), -1)) { ossl_raise(eX509RevError, NULL); diff --git a/ext/openssl/ossl_x509store.c b/ext/openssl/ossl_x509store.c index e9923c0..7b4a005 100644 --- a/ext/openssl/ossl_x509store.c +++ b/ext/openssl/ossl_x509store.c @@ -54,7 +54,7 @@ VALUE eX509StoreError; /* * Public functions */ -VALUE +VALUE ossl_x509store_new(X509_STORE *store) { VALUE obj; @@ -76,19 +76,19 @@ GetX509StorePtr(VALUE obj) X509_STORE * DupX509StorePtr(VALUE obj) -{ +{ X509_STORE *store; SafeGetX509Store(obj, store); CRYPTO_add(&store->references, 1, CRYPTO_LOCK_X509_STORE); - + return store; } /* * Private functions */ -static VALUE +static VALUE ossl_x509store_alloc(VALUE klass) { X509_STORE *store; @@ -171,7 +171,7 @@ ossl_x509store_set_purpose(VALUE self, VALUE purpose) #if (OPENSSL_VERSION_NUMBER >= 0x00907000L) X509_STORE *store; long p = NUM2LONG(purpose); - + GetX509Store(self, store); X509_STORE_set_purpose(store, p); #else @@ -197,14 +197,14 @@ ossl_x509store_set_trust(VALUE self, VALUE trust) return trust; } -static VALUE +static VALUE ossl_x509store_set_time(VALUE self, VALUE time) { rb_iv_set(self, "@time", time); return time; } -static VALUE +static VALUE ossl_x509store_add_file(VALUE self, VALUE file) { X509_STORE *store; @@ -225,7 +225,7 @@ ossl_x509store_add_file(VALUE self, VALUE file) return self; } -static VALUE +static VALUE ossl_x509store_add_path(VALUE self, VALUE dir) { X509_STORE *store; @@ -293,7 +293,7 @@ static VALUE ossl_x509stctx_get_err(VALUE); static VALUE ossl_x509stctx_get_err_string(VALUE); static VALUE ossl_x509stctx_get_chain(VALUE); -static VALUE +static VALUE ossl_x509store_verify(int argc, VALUE *argv, VALUE self) { VALUE cert, chain; @@ -350,7 +350,7 @@ ossl_x509stctx_free(X509_STORE_CTX *ctx) X509_STORE_CTX_free(ctx); } -static VALUE +static VALUE ossl_x509stctx_alloc(VALUE klass) { X509_STORE_CTX *ctx; @@ -442,7 +442,7 @@ ossl_x509stctx_get_chain(VALUE self) return ary; } -static VALUE +static VALUE ossl_x509stctx_get_err(VALUE self) { X509_STORE_CTX *ctx; @@ -463,7 +463,7 @@ ossl_x509stctx_set_error(VALUE self, VALUE err) return err; } -static VALUE +static VALUE ossl_x509stctx_get_err_string(VALUE self) { X509_STORE_CTX *ctx; @@ -475,7 +475,7 @@ ossl_x509stctx_get_err_string(VALUE self) return rb_str_new2(X509_verify_cert_error_string(err)); } -static VALUE +static VALUE ossl_x509stctx_get_err_depth(VALUE self) { X509_STORE_CTX *ctx; @@ -485,7 +485,7 @@ ossl_x509stctx_get_err_depth(VALUE self) return INT2FIX(X509_STORE_CTX_get_error_depth(ctx)); } -static VALUE +static VALUE ossl_x509stctx_get_curr_cert(VALUE self) { X509_STORE_CTX *ctx; @@ -577,7 +577,7 @@ ossl_x509stctx_set_time(VALUE self, VALUE time) /* * INIT */ -void +void Init_ossl_x509store() { VALUE x509stctx; |