6a15ee56b6
Since many changes from previous release, please refer http://www.ruby-lang.org/en/news/2010/08/16/ruby-1-8-7-p302-is-released/. Note: Since all security updates are already in previous package, This update dosen't include any securify fix.
102 lines
4 KiB
Text
102 lines
4 KiB
Text
$NetBSD: patch-be,v 1.4 2010/09/10 03:29:00 taca Exp $
|
|
|
|
Suppress warnings.
|
|
|
|
--- ext/openssl/ossl_cipher.c.orig 2010-05-24 23:58:49.000000000 +0000
|
|
+++ ext/openssl/ossl_cipher.c
|
|
@@ -188,7 +188,7 @@ ossl_cipher_init(int argc, VALUE *argv,
|
|
* We deprecated the arguments for this method, but we decided
|
|
* keeping this behaviour for backward compatibility.
|
|
*/
|
|
- char *cname = rb_class2name(rb_obj_class(self));
|
|
+ const char *cname = rb_class2name(rb_obj_class(self));
|
|
rb_warn("argumtents for %s#encrypt and %s#decrypt were deprecated; "
|
|
"use %s#pkcs5_keyivgen to derive key and IV",
|
|
cname, cname, cname);
|
|
@@ -204,7 +204,7 @@ ossl_cipher_init(int argc, VALUE *argv,
|
|
else memcpy(iv, RSTRING_PTR(init_v), sizeof(iv));
|
|
}
|
|
EVP_BytesToKey(EVP_CIPHER_CTX_cipher(ctx), EVP_md5(), iv,
|
|
- RSTRING_PTR(pass), RSTRING_LEN(pass), 1, key, NULL);
|
|
+ (unsigned char *)RSTRING_PTR(pass), RSTRING_LEN(pass), 1, key, NULL);
|
|
p_key = key;
|
|
p_iv = iv;
|
|
}
|
|
@@ -281,13 +281,13 @@ ossl_cipher_pkcs5_keyivgen(int argc, VAL
|
|
StringValue(vsalt);
|
|
if(RSTRING_LEN(vsalt) != PKCS5_SALT_LEN)
|
|
rb_raise(eCipherError, "salt must be an 8-octet string");
|
|
- salt = RSTRING_PTR(vsalt);
|
|
+ salt = (unsigned char *)RSTRING_PTR(vsalt);
|
|
}
|
|
iter = NIL_P(viter) ? 2048 : NUM2INT(viter);
|
|
digest = NIL_P(vdigest) ? EVP_md5() : GetDigestPtr(vdigest);
|
|
GetCipher(self, ctx);
|
|
EVP_BytesToKey(EVP_CIPHER_CTX_cipher(ctx), digest, salt,
|
|
- 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);
|
|
@@ -309,7 +309,7 @@ ossl_cipher_pkcs5_keyivgen(int argc, VAL
|
|
static VALUE
|
|
ossl_cipher_update_deprecated(VALUE self, VALUE data)
|
|
{
|
|
- char *cname;
|
|
+ const char *cname;
|
|
|
|
cname = rb_class2name(rb_obj_class(self));
|
|
rb_warning("%s#<< is deprecated; use %s#update instead", cname, cname);
|
|
@@ -329,14 +329,14 @@ static VALUE
|
|
ossl_cipher_update(int argc, VALUE *argv, VALUE self)
|
|
{
|
|
EVP_CIPHER_CTX *ctx;
|
|
- char *in;
|
|
+ unsigned char *in;
|
|
int in_len, out_len;
|
|
VALUE data, str;
|
|
|
|
rb_scan_args(argc, argv, "11", &data, &str);
|
|
|
|
StringValue(data);
|
|
- in = RSTRING_PTR(data);
|
|
+ in = (unsigned char *)RSTRING_PTR(data);
|
|
if ((in_len = RSTRING_LEN(data)) == 0)
|
|
rb_raise(rb_eArgError, "data must not be empty");
|
|
GetCipher(self, ctx);
|
|
@@ -349,7 +349,7 @@ ossl_cipher_update(int argc, VALUE *argv
|
|
rb_str_resize(str, out_len);
|
|
}
|
|
|
|
- if (!EVP_CipherUpdate(ctx, RSTRING_PTR(str), &out_len, in, in_len))
|
|
+ if (!EVP_CipherUpdate(ctx, (unsigned char *)RSTRING_PTR(str), &out_len, in, in_len))
|
|
ossl_raise(eCipherError, NULL);
|
|
assert(out_len < RSTRING_LEN(str));
|
|
rb_str_set_len(str, out_len);
|
|
@@ -374,7 +374,7 @@ ossl_cipher_final(VALUE self)
|
|
|
|
GetCipher(self, ctx);
|
|
str = rb_str_new(0, EVP_CIPHER_CTX_block_size(ctx));
|
|
- if (!EVP_CipherFinal_ex(ctx, RSTRING_PTR(str), &out_len))
|
|
+ if (!EVP_CipherFinal_ex(ctx, (unsigned char *)RSTRING_PTR(str), &out_len))
|
|
ossl_raise(eCipherError, NULL);
|
|
assert(out_len <= RSTRING_LEN(str));
|
|
rb_str_set_len(str, out_len);
|
|
@@ -417,7 +417,7 @@ ossl_cipher_set_key(VALUE self, VALUE ke
|
|
if (RSTRING_LEN(key) < EVP_CIPHER_CTX_key_length(ctx))
|
|
ossl_raise(eCipherError, "key length too short");
|
|
|
|
- if (EVP_CipherInit_ex(ctx, NULL, NULL, RSTRING_PTR(key), NULL, -1) != 1)
|
|
+ if (EVP_CipherInit_ex(ctx, NULL, NULL, (unsigned char *)RSTRING_PTR(key), NULL, -1) != 1)
|
|
ossl_raise(eCipherError, NULL);
|
|
|
|
return key;
|
|
@@ -442,7 +442,7 @@ ossl_cipher_set_iv(VALUE self, VALUE iv)
|
|
if (RSTRING_LEN(iv) < EVP_CIPHER_CTX_iv_length(ctx))
|
|
ossl_raise(eCipherError, "iv length too short");
|
|
|
|
- if (EVP_CipherInit_ex(ctx, NULL, NULL, NULL, RSTRING_PTR(iv), -1) != 1)
|
|
+ if (EVP_CipherInit_ex(ctx, NULL, NULL, NULL, (unsigned char *)RSTRING_PTR(iv), -1) != 1)
|
|
ossl_raise(eCipherError, NULL);
|
|
|
|
return iv;
|