mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* lib/ext/openssl/extconf.rb: add check for some engine functions
unavailable in OpenSSL-0.9.6. * lib/ext/openssl/ossl_engine.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4698 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
474e9004de
commit
f58812a7e2
3 changed files with 35 additions and 0 deletions
|
@ -1,3 +1,10 @@
|
||||||
|
Sun Oct 5 22:51:23 2003 GOTOU Yuuzou <gotoyuzo@notwork.org>
|
||||||
|
|
||||||
|
* lib/ext/openssl/extconf.rb: add check for some engine functions
|
||||||
|
unavailable in OpenSSL-0.9.6.
|
||||||
|
|
||||||
|
* lib/ext/openssl/ossl_engine.c: ditto.
|
||||||
|
|
||||||
Sun Oct 5 17:56:30 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Sun Oct 5 17:56:30 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* eval.c (rb_eval): fix evaluation order. [ruby-list:38431]
|
* eval.c (rb_eval): fix evaluation order. [ruby-list:38431]
|
||||||
|
|
|
@ -85,7 +85,11 @@ if try_compile("#define FOO(a, ...) foo(a, ##__VA_ARGS__)\n int x(){FOO(1);FOO(1
|
||||||
$defs.push("-DHAVE_VA_ARGS_MACRO")
|
$defs.push("-DHAVE_VA_ARGS_MACRO")
|
||||||
end
|
end
|
||||||
if have_header("openssl/engine.h")
|
if have_header("openssl/engine.h")
|
||||||
|
have_func("ENGINE_load_builtin_engines")
|
||||||
have_func("ENGINE_load_openbsd_dev_crypto")
|
have_func("ENGINE_load_openbsd_dev_crypto")
|
||||||
|
have_func("ENGINE_get_digest")
|
||||||
|
have_func("ENGINE_get_cipher")
|
||||||
|
have_func("ENGINE_cleanup")
|
||||||
end
|
end
|
||||||
have_header("openssl/ocsp.h")
|
have_header("openssl/ocsp.h")
|
||||||
have_struct_member("EVP_CIPHER_CTX", "flags", "openssl/evp.h")
|
have_struct_member("EVP_CIPHER_CTX", "flags", "openssl/evp.h")
|
||||||
|
|
|
@ -49,6 +49,9 @@ do{\
|
||||||
static VALUE
|
static VALUE
|
||||||
ossl_engine_s_load(int argc, VALUE *argv, VALUE klass)
|
ossl_engine_s_load(int argc, VALUE *argv, VALUE klass)
|
||||||
{
|
{
|
||||||
|
#if !defined(HAVE_ENGINE_LOAD_BUILTIN_ENGINES)
|
||||||
|
return Qnil;
|
||||||
|
#else
|
||||||
VALUE name;
|
VALUE name;
|
||||||
|
|
||||||
rb_scan_args(argc, argv, "01", &name);
|
rb_scan_args(argc, argv, "01", &name);
|
||||||
|
@ -68,12 +71,15 @@ ossl_engine_s_load(int argc, VALUE *argv, VALUE klass)
|
||||||
OSSL_ENGINE_LOAD_IF_MATCH(openbsd_dev_crypto);
|
OSSL_ENGINE_LOAD_IF_MATCH(openbsd_dev_crypto);
|
||||||
#endif
|
#endif
|
||||||
rb_raise(eEngineError, "no such engine `%s'", RSTRING(name)->ptr);
|
rb_raise(eEngineError, "no such engine `%s'", RSTRING(name)->ptr);
|
||||||
|
#endif /* HAVE_ENGINE_LOAD_BUILTIN_ENGINES */
|
||||||
}
|
}
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
ossl_engine_s_cleanup(VALUE self)
|
ossl_engine_s_cleanup(VALUE self)
|
||||||
{
|
{
|
||||||
|
#if defined(HAVE_ENGINE_CLEANUP)
|
||||||
ENGINE_cleanup();
|
ENGINE_cleanup();
|
||||||
|
#endif
|
||||||
return Qnil;
|
return Qnil;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -156,6 +162,7 @@ ossl_engine_finish(VALUE self)
|
||||||
static VALUE
|
static VALUE
|
||||||
ossl_engine_get_cipher(VALUE self, VALUE name)
|
ossl_engine_get_cipher(VALUE self, VALUE name)
|
||||||
{
|
{
|
||||||
|
#if defined(HAVE_ENGINE_GET_CIPHER)
|
||||||
ENGINE *e;
|
ENGINE *e;
|
||||||
const EVP_CIPHER *ciph, *tmp;
|
const EVP_CIPHER *ciph, *tmp;
|
||||||
char *s;
|
char *s;
|
||||||
|
@ -170,11 +177,15 @@ ossl_engine_get_cipher(VALUE self, VALUE name)
|
||||||
if(!ciph) ossl_raise(eEngineError, NULL);
|
if(!ciph) ossl_raise(eEngineError, NULL);
|
||||||
|
|
||||||
return ossl_cipher_new(ciph);
|
return ossl_cipher_new(ciph);
|
||||||
|
#else
|
||||||
|
rb_notimplement();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
ossl_engine_get_digest(VALUE self, VALUE name)
|
ossl_engine_get_digest(VALUE self, VALUE name)
|
||||||
{
|
{
|
||||||
|
#if defined(HAVE_ENGINE_GET_DIGEST)
|
||||||
ENGINE *e;
|
ENGINE *e;
|
||||||
const EVP_MD *md, *tmp;
|
const EVP_MD *md, *tmp;
|
||||||
char *s;
|
char *s;
|
||||||
|
@ -189,6 +200,9 @@ ossl_engine_get_digest(VALUE self, VALUE name)
|
||||||
if(!md) ossl_raise(eEngineError, NULL);
|
if(!md) ossl_raise(eEngineError, NULL);
|
||||||
|
|
||||||
return ossl_digest_new(md);
|
return ossl_digest_new(md);
|
||||||
|
#else
|
||||||
|
rb_notimplement();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
|
@ -292,8 +306,18 @@ Init_ossl_engine()
|
||||||
DefEngineConst(METHOD_DSA);
|
DefEngineConst(METHOD_DSA);
|
||||||
DefEngineConst(METHOD_DH);
|
DefEngineConst(METHOD_DH);
|
||||||
DefEngineConst(METHOD_RAND);
|
DefEngineConst(METHOD_RAND);
|
||||||
|
#ifdef ENGINE_METHOD_BN_MOD_EXP
|
||||||
|
DefEngineConst(METHOD_BN_MOD_EXP);
|
||||||
|
#endif
|
||||||
|
#ifdef ENGINE_METHOD_BN_MOD_EXP_CRT
|
||||||
|
DefEngineConst(METHOD_BN_MOD_EXP_CRT);
|
||||||
|
#endif
|
||||||
|
#ifdef ENGINE_METHOD_CIPHERS
|
||||||
DefEngineConst(METHOD_CIPHERS);
|
DefEngineConst(METHOD_CIPHERS);
|
||||||
|
#endif
|
||||||
|
#ifdef ENGINE_METHOD_DIGESTS
|
||||||
DefEngineConst(METHOD_DIGESTS);
|
DefEngineConst(METHOD_DIGESTS);
|
||||||
|
#endif
|
||||||
DefEngineConst(METHOD_ALL);
|
DefEngineConst(METHOD_ALL);
|
||||||
DefEngineConst(METHOD_NONE);
|
DefEngineConst(METHOD_NONE);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue