1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* ext/openssl: suppress warnings.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18168 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2008-07-22 15:34:23 +00:00
parent d56885b43d
commit 6c0f540298
31 changed files with 190 additions and 195 deletions

View file

@ -103,13 +103,13 @@ ossl_hmac_update(VALUE self, VALUE data)
StringValue(data);
GetHMAC(self, ctx);
HMAC_Update(ctx, RSTRING_PTR(data), RSTRING_LEN(data));
HMAC_Update(ctx, (unsigned char *)RSTRING_PTR(data), RSTRING_LEN(data));
return self;
}
static void
hmac_final(HMAC_CTX *ctx, char **buf, int *buf_len)
hmac_final(HMAC_CTX *ctx, unsigned char **buf, unsigned int *buf_len)
{
HMAC_CTX final;
@ -132,13 +132,13 @@ static VALUE
ossl_hmac_digest(VALUE self)
{
HMAC_CTX *ctx;
char *buf;
int buf_len;
unsigned char *buf;
unsigned int buf_len;
VALUE digest;
GetHMAC(self, ctx);
hmac_final(ctx, &buf, &buf_len);
digest = ossl_buf2str(buf, buf_len);
digest = ossl_buf2str((char *)buf, buf_len);
return digest;
}
@ -152,8 +152,9 @@ static VALUE
ossl_hmac_hexdigest(VALUE self)
{
HMAC_CTX *ctx;
char *buf, *hexbuf;
int buf_len;
unsigned char *buf;
char *hexbuf;
unsigned int buf_len;
VALUE hexdigest;
GetHMAC(self, ctx);
@ -192,15 +193,15 @@ ossl_hmac_reset(VALUE self)
static VALUE
ossl_hmac_s_digest(VALUE klass, VALUE digest, VALUE key, VALUE data)
{
char *buf;
int buf_len;
unsigned char *buf;
unsigned int buf_len;
StringValue(key);
StringValue(data);
buf = HMAC(GetDigestPtr(digest), RSTRING_PTR(key), RSTRING_LEN(key),
RSTRING_PTR(data), RSTRING_LEN(data), NULL, &buf_len);
(unsigned char *)RSTRING_PTR(data), RSTRING_LEN(data), NULL, &buf_len);
return rb_str_new(buf, buf_len);
return rb_str_new((const char *)buf, buf_len);
}
/*
@ -211,15 +212,16 @@ ossl_hmac_s_digest(VALUE klass, VALUE digest, VALUE key, VALUE data)
static VALUE
ossl_hmac_s_hexdigest(VALUE klass, VALUE digest, VALUE key, VALUE data)
{
char *buf, *hexbuf;
int buf_len;
unsigned char *buf;
char *hexbuf;
unsigned int buf_len;
VALUE hexdigest;
StringValue(key);
StringValue(data);
buf = HMAC(GetDigestPtr(digest), RSTRING_PTR(key), RSTRING_LEN(key),
RSTRING_PTR(data), RSTRING_LEN(data), NULL, &buf_len);
(unsigned char *)RSTRING_PTR(data), RSTRING_LEN(data), NULL, &buf_len);
if (string2hex(buf, buf_len, &hexbuf, NULL) != 2 * buf_len) {
ossl_raise(eHMACError, "Cannot convert buf to hexbuf");
}