summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGOTOU Yuuzou <gotoyuzo@notwork.org>2003-06-29 03:51:14 +0000
committerGOTOU Yuuzou <gotoyuzo@notwork.org>2003-06-29 03:51:14 +0000
commitf803e789baebf15eac0bccafb0798e4e25f59101 (patch)
treefeda736990151cb3101c1f0d05f75a3ea169385a
parentd80a610d79d00f170ba71bb49a7bec7abe10f4b7 (diff)
downloadruby-openssl-history-f803e789baebf15eac0bccafb0798e4e25f59101.tar.gz
*** empty log message ***
-rw-r--r--ChangeLog1
-rw-r--r--examples/ossl_pkcs7.rb11
-rw-r--r--ossl.c5
-rw-r--r--ossl_pkcs7.c16
4 files changed, 18 insertions, 15 deletions
diff --git a/ChangeLog b/ChangeLog
index 595f7fc..24d97dd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,6 @@
Sun, 29 Jun 2003 04:02:01 +0900 -- GOTOU Yuuzou <gotoyuzo@notwork.org>
* ossl_pkcs7.c: SMIME_read_PKCS7 returns content only if the envelope is detached.
+ * ossl_pkcs7.c: the 3rd argument of rb_protect should be cleared.
Sun, 29 Jun 2003 03:24:13 +0900 -- GOTOU Yuuzou <gotoyuzo@notwork.org>
* examples/ossl_pkcs7.rb: new sample
diff --git a/examples/ossl_pkcs7.rb b/examples/ossl_pkcs7.rb
index a0fed05..5473e86 100644
--- a/examples/ossl_pkcs7.rb
+++ b/examples/ossl_pkcs7.rb
@@ -20,7 +20,7 @@ key = key3
# flags
flags = 0
-flags |= PKCS7::DETACHED
+#flags |= PKCS7::DETACHED
# cerate PKCS#7 signed message
pkcs7 = PKCS7::sign(cert, key, data, [cacert], flags)
@@ -29,9 +29,9 @@ smime = PKCS7::write_smime(pkcs7, data, flags)
print smime
# load S/MIME message
+p 1
pkcs7 = PKCS7::read_smime(smime)
p [ pkcs7.type, pkcs7.detached? ]
-p pkcs7.data
# create certificate store and verify
store = X509::Store.new
@@ -43,6 +43,7 @@ store.verify_callback = lambda{|ok, ctx|
ok
}
p pkcs7.verify([cert], store, data, flags)
+p pkcs7.data
# create PKCS#7 encrypted message
flags = 0
@@ -53,6 +54,6 @@ p [ pkcs7.type ]
puts PKCS7::write_smime(pkcs7, data, flags)
# decrypt
-p pkcs7.decrypt(key1, cert1, flags)
-p pkcs7.decrypt(key2, cert2, flags)
-p pkcs7.decrypt(key3, cert3, flags)
+p pkcs7.decrypt(key1, cert1, flags).size
+p pkcs7.decrypt(key2, cert2, flags).size
+p pkcs7.decrypt(key3, cert3, flags).size
diff --git a/ossl.c b/ossl.c
index 16998b4..fd39b1f 100644
--- a/ossl.c
+++ b/ossl.c
@@ -280,7 +280,7 @@ ossl_pem_passwd_cb0(VALUE flag)
int
ossl_pem_passwd_cb(char *buf, int max_len, int flag, void *pwd)
{
- int len, status;
+ int len, status = 0;
VALUE rflag, pass;
if (pwd || !rb_block_given_p())
@@ -327,7 +327,7 @@ ossl_verify_cb(int ok, X509_STORE_CTX *ctx)
{
VALUE proc, rctx, ret;
struct ossl_verify_cb_args args;
- int state;
+ int state = 0;
proc = (VALUE)X509_STORE_CTX_get_ex_data(ctx, ossl_verify_cb_idx);
if ((void*)proc == 0)
@@ -524,6 +524,7 @@ Init_openssl()
Init_ossl_rand();
Init_ossl_ssl();
Init_ossl_x509();
+ Init_ossl_ocsp();
}
#if defined(OSSL_DEBUG)
diff --git a/ossl_pkcs7.c b/ossl_pkcs7.c
index 3293f3a..fd2c1ce 100644
--- a/ossl_pkcs7.c
+++ b/ossl_pkcs7.c
@@ -98,7 +98,7 @@ ossl_pkcs7_s_read_smime(VALUE klass, VALUE arg)
BIO *in, *out;
PKCS7 *pkcs7;
VALUE ret, data;
- int status;
+ int status = 0;
in = ossl_obj2bio(arg);
out = NULL;
@@ -127,7 +127,7 @@ ossl_pkcs7_s_write_smime(int argc, VALUE *argv, VALUE klass)
BIO *in;
PKCS7 *p7;
VALUE str;
- int flg, status;
+ int flg, status = 0;
rb_scan_args(argc, argv, "12", &pkcs7, &data, &flags);
SafeGetPKCS7(pkcs7, p7);
@@ -159,7 +159,7 @@ ossl_pkcs7_s_sign(int argc, VALUE *argv, VALUE klass)
EVP_PKEY *pkey;
BIO *in;
STACK_OF(X509) *x509s;
- int flg, status;
+ int flg, status = 0;
PKCS7 *pkcs7;
VALUE ret;
@@ -197,7 +197,7 @@ ossl_pkcs7_s_encrypt(int argc, VALUE *argv, VALUE klass)
STACK_OF(X509) *x509s;
BIO *in;
const EVP_CIPHER *ciph;
- int flg, status;
+ int flg, status = 0;
VALUE ret;
PKCS7 *p7;
@@ -494,7 +494,7 @@ ossl_pkcs7_verify(int argc, VALUE *argv, VALUE self)
VALUE certs, store, indata, flags;
STACK_OF(X509) *x509s;
X509_STORE *x509st;
- int flg, ok, status;
+ int flg, ok, status = 0;
BIO *in, *out;
PKCS7 *p7;
VALUE ret, data;
@@ -542,7 +542,7 @@ ossl_pkcs7_decrypt(int argc, VALUE *argv, VALUE self)
PKCS7 *p7;
BIO *out;
VALUE str;
- int status;
+ int status = 0;
rb_scan_args(argc, argv, "21", &pkey, &cert, &flags);
GetPKCS7(self, p7);
@@ -674,7 +674,7 @@ ossl_pkcs7_data_decode(VALUE self, VALUE key, VALUE cert)
X509 *x509;
BIO *bio;
VALUE str;
- int status;
+ int status = 0;
GetPKCS7(self, pkcs7);
pkey = GetPrivPKeyPtr(key); /* NO NEED TO DUP */
@@ -698,7 +698,7 @@ ossl_pkcs7_to_pem(VALUE self)
PKCS7 *pkcs7;
BIO *out;
VALUE str;
- int status;
+ int status = 0;
GetPKCS7(self, pkcs7);
if (!(out = BIO_new(BIO_s_mem()))) {