From 05a278b4cdc8456580e51055ccb89fe4d1cd46ed Mon Sep 17 00:00:00 2001 From: akr Date: Sat, 18 Apr 2009 14:10:06 +0000 Subject: * ext/readline/readline.c: use rb_f_notimplement for methods not implemented. * ext/openssl/ossl_engine.c: ditto. * ext/openssl/ossl_config.c: ditto. * ext/openssl/ossl_cipher.c: ditto. * ext/openssl/ossl_pkcs5.c: ditto. * ext/openssl/ossl_x509ext.c: ditto. * ext/socket/socket.c: ditto. * ext/socket/basicsocket.c: ditto. * ext/socket/ancdata.c: ditto. * ext/socket/unixsocket.c: ditto. * ext/iconv/iconv.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23204 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/openssl/ossl_cipher.c | 14 +++++++------- ext/openssl/ossl_config.c | 12 +++++++++++- ext/openssl/ossl_engine.c | 12 ++++++------ ext/openssl/ossl_pkcs5.c | 12 ++++++------ ext/openssl/ossl_x509ext.c | 6 +++--- 5 files changed, 33 insertions(+), 23 deletions(-) (limited to 'ext/openssl') diff --git a/ext/openssl/ossl_cipher.c b/ext/openssl/ossl_cipher.c index 27d152a61a..df7856b6f0 100644 --- a/ext/openssl/ossl_cipher.c +++ b/ext/openssl/ossl_cipher.c @@ -133,6 +133,7 @@ add_cipher_name_to_ary(const OBJ_NAME *name, VALUE ary) } #endif +#ifdef HAVE_OBJ_NAME_DO_ALL_SORTED /* * call-seq: * Cipher.ciphers -> array[string...] @@ -142,7 +143,6 @@ add_cipher_name_to_ary(const OBJ_NAME *name, VALUE ary) static VALUE ossl_s_ciphers(VALUE self) { -#ifdef HAVE_OBJ_NAME_DO_ALL_SORTED VALUE ary; ary = rb_ary_new(); @@ -151,10 +151,10 @@ ossl_s_ciphers(VALUE self) (void*)ary); return ary; +} #else - rb_notimplement(); +#define ossl_s_ciphers rb_f_notimplement #endif -} /* * call-seq: @@ -453,6 +453,7 @@ ossl_cipher_set_key_length(VALUE self, VALUE key_length) return key_length; } +#if defined(HAVE_EVP_CIPHER_CTX_SET_PADDING) /* * call-seq: * cipher.padding = integer -> integer @@ -466,18 +467,17 @@ ossl_cipher_set_key_length(VALUE self, VALUE key_length) static VALUE ossl_cipher_set_padding(VALUE self, VALUE padding) { -#if defined(HAVE_EVP_CIPHER_CTX_SET_PADDING) EVP_CIPHER_CTX *ctx; int pad = NUM2INT(padding); GetCipher(self, ctx); if (EVP_CIPHER_CTX_set_padding(ctx, pad) != 1) ossl_raise(eCipherError, NULL); -#else - rb_notimplement(); -#endif return padding; } +#else +#define ossl_cipher_set_padding rb_f_notimplement +#endif #define CIPHER_0ARG_INT(func) \ static VALUE \ diff --git a/ext/openssl/ossl_config.c b/ext/openssl/ossl_config.c index e0c714977d..bbd4975031 100644 --- a/ext/openssl/ossl_config.c +++ b/ext/openssl/ossl_config.c @@ -192,6 +192,16 @@ ossl_config_add_value(VALUE self, VALUE section, VALUE name, VALUE value) #endif } +#if !defined(OSSL_NO_CONF_API) +static VALUE +ossl_config_add_value_m(VALUE self, VALUE section, VALUE name, VALUE value) +{ + return ossl_config_add_value(self, section, name, value); +} +#else +#define ossl_config_add_value_m rb_f_notimplement +#endif + static VALUE ossl_config_get_value(VALUE self, VALUE section, VALUE name) { @@ -456,7 +466,7 @@ Init_ossl_config() rb_define_method(cConfig, "initialize", ossl_config_initialize, -1); rb_define_method(cConfig, "get_value", ossl_config_get_value, 2); rb_define_method(cConfig, "value", ossl_config_get_value_old, -1); - rb_define_method(cConfig, "add_value", ossl_config_add_value, 3); + rb_define_method(cConfig, "add_value", ossl_config_add_value_m, 3); rb_define_method(cConfig, "[]", ossl_config_get_section, 1); rb_define_method(cConfig, "section", ossl_config_get_section_old, 1); rb_define_method(cConfig, "[]=", ossl_config_set_section, 2); diff --git a/ext/openssl/ossl_engine.c b/ext/openssl/ossl_engine.c index 2dfed654f4..ec6f7fdf96 100644 --- a/ext/openssl/ossl_engine.c +++ b/ext/openssl/ossl_engine.c @@ -166,10 +166,10 @@ ossl_engine_finish(VALUE self) return Qnil; } +#if defined(HAVE_ENGINE_GET_CIPHER) static VALUE ossl_engine_get_cipher(VALUE self, VALUE name) { -#if defined(HAVE_ENGINE_GET_CIPHER) ENGINE *e; const EVP_CIPHER *ciph, *tmp; char *s; @@ -184,15 +184,15 @@ ossl_engine_get_cipher(VALUE self, VALUE name) if(!ciph) ossl_raise(eEngineError, NULL); return ossl_cipher_new(ciph); +} #else - rb_notimplement(); +#define ossl_engine_get_cipher rb_f_notimplement #endif -} +#if defined(HAVE_ENGINE_GET_DIGEST) static VALUE ossl_engine_get_digest(VALUE self, VALUE name) { -#if defined(HAVE_ENGINE_GET_DIGEST) ENGINE *e; const EVP_MD *md, *tmp; char *s; @@ -207,10 +207,10 @@ ossl_engine_get_digest(VALUE self, VALUE name) if(!md) ossl_raise(eEngineError, NULL); return ossl_digest_new(md); +} #else - rb_notimplement(); +#define ossl_engine_get_digest rb_f_notimplement #endif -} static VALUE ossl_engine_load_privkey(int argc, VALUE *argv, VALUE self) diff --git a/ext/openssl/ossl_pkcs5.c b/ext/openssl/ossl_pkcs5.c index c4476dae38..18d166d1ca 100644 --- a/ext/openssl/ossl_pkcs5.c +++ b/ext/openssl/ossl_pkcs5.c @@ -7,6 +7,7 @@ VALUE mPKCS5; VALUE ePKCS5; +#ifdef HAVE_PKCS5_PBKDF2_HMAC /* * call-seq: * PKCS5.pbkdf2_hmac(pass, salt, iter, keylen, digest) => string @@ -25,7 +26,6 @@ VALUE ePKCS5; static VALUE ossl_pkcs5_pbkdf2_hmac(VALUE self, VALUE pass, VALUE salt, VALUE iter, VALUE keylen, VALUE digest) { -#ifdef HAVE_PKCS5_PBKDF2_HMAC VALUE str; const EVP_MD *md; int len = NUM2INT(keylen); @@ -40,12 +40,13 @@ ossl_pkcs5_pbkdf2_hmac(VALUE self, VALUE pass, VALUE salt, VALUE iter, VALUE key ossl_raise(ePKCS5, "PKCS5_PBKDF2_HMAC"); return str; +} #else - rb_notimplement(); +#define ossl_pkcs5_pbkdf2_hmac rb_f_notimplement #endif -} +#ifdef HAVE_PKCS5_PBKDF2_HMAC_SHA1 /* * call-seq: * PKCS5.pbkdf2_hmac_sha1(pass, salt, iter, keylen) => string @@ -63,7 +64,6 @@ ossl_pkcs5_pbkdf2_hmac(VALUE self, VALUE pass, VALUE salt, VALUE iter, VALUE key static VALUE ossl_pkcs5_pbkdf2_hmac_sha1(VALUE self, VALUE pass, VALUE salt, VALUE iter, VALUE keylen) { -#ifdef HAVE_PKCS5_PBKDF2_HMAC_SHA1 VALUE str; int len = NUM2INT(keylen); @@ -78,10 +78,10 @@ ossl_pkcs5_pbkdf2_hmac_sha1(VALUE self, VALUE pass, VALUE salt, VALUE iter, VALU ossl_raise(ePKCS5, "PKCS5_PBKDF2_HMAC_SHA1"); return str; +} #else - rb_notimplement(); +#define ossl_pkcs5_pbkdf2_hmac_sha1 rb_f_notimplement #endif -} void Init_ossl_pkcs5() diff --git a/ext/openssl/ossl_x509ext.c b/ext/openssl/ossl_x509ext.c index 87210700ae..d79615499b 100644 --- a/ext/openssl/ossl_x509ext.c +++ b/ext/openssl/ossl_x509ext.c @@ -163,10 +163,10 @@ ossl_x509extfactory_set_crl(VALUE self, VALUE crl) return crl; } +#ifdef HAVE_X509V3_SET_NCONF static VALUE ossl_x509extfactory_set_config(VALUE self, VALUE config) { -#ifdef HAVE_X509V3_SET_NCONF X509V3_CTX *ctx; CONF *conf; @@ -176,10 +176,10 @@ ossl_x509extfactory_set_config(VALUE self, VALUE config) X509V3_set_nconf(ctx, conf); return config; +} #else - rb_notimplement(); +#define rb_f_fork rb_f_notimplement #endif -} static VALUE ossl_x509extfactory_initialize(int argc, VALUE *argv, VALUE self) -- cgit v1.2.3