aboutsummaryrefslogtreecommitdiffstats
path: root/ext/openssl/ossl_cipher.c
diff options
context:
space:
mode:
authorgotoyuzo <gotoyuzo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-09-05 09:08:40 +0000
committergotoyuzo <gotoyuzo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-09-05 09:08:40 +0000
commitd9f38cbee88fdbb06d8577496062918da39fdeab (patch)
tree32333543a60cb2accc56c0b4377114324e1166b6 /ext/openssl/ossl_cipher.c
parent8d4d2e43233afcb075b4663828568bd5a5f16712 (diff)
downloadruby-d9f38cbee88fdbb06d8577496062918da39fdeab.tar.gz
* ext/openssl/lib/openssl/x509.rb: new method X509::Name::parse.
* ext/openssl/ossl_digest.c: add ossl_digest_new(). * ext/openssl/ossl_digest.h: ditto. * ext/openssl/ossl_cipher.c: add ossl_cipher_new(). * ext/openssl/ossl_cipher.h: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4511 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/openssl/ossl_cipher.c')
-rw-r--r--ext/openssl/ossl_cipher.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/ext/openssl/ossl_cipher.c b/ext/openssl/ossl_cipher.c
index 3d63a2a038..02e3dcd488 100644
--- a/ext/openssl/ossl_cipher.c
+++ b/ext/openssl/ossl_cipher.c
@@ -30,6 +30,8 @@ VALUE mCipher;
VALUE cCipher;
VALUE eCipherError;
+static VALUE ossl_cipher_alloc(VALUE klass);
+
/*
* PUBLIC
*/
@@ -43,6 +45,21 @@ GetCipherPtr(VALUE obj)
return EVP_CIPHER_CTX_cipher(ctx);
}
+VALUE
+ossl_cipher_new(const EVP_CIPHER *cipher)
+{
+ VALUE ret;
+ EVP_CIPHER_CTX *ctx;
+
+ ret = ossl_cipher_alloc(cCipher);
+ GetCipher(ret, ctx);
+ EVP_CIPHER_CTX_init(ctx);
+ if (EVP_CipherInit(ctx, cipher, NULL, NULL, -1) != 1)
+ ossl_raise(eCipherError, NULL);
+
+ return ret;
+}
+
/*
* PRIVATE
*/