From 2d33fc97a3742800e65bf647e5b66d0af58e7123 Mon Sep 17 00:00:00 2001 From: nobu Date: Tue, 15 Jul 2014 14:59:32 +0000 Subject: md5ossl.c: indicate the result * ext/digest/md5/md5ossl.c: use OpenSSL EVP API instead of MD5 API to perform MD5 hashes using OpenSSL in ext/digest. [ruby-core:61614] [Bug #9659] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46828 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/digest/md5/md5ossl.h | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'ext/digest/md5/md5ossl.h') diff --git a/ext/digest/md5/md5ossl.h b/ext/digest/md5/md5ossl.h index 1680c4f5c9..f1028704a0 100644 --- a/ext/digest/md5/md5ossl.h +++ b/ext/digest/md5/md5ossl.h @@ -4,10 +4,22 @@ #define MD5OSSL_H_INCLUDED #include -#include +#include -#define MD5_BLOCK_LENGTH MD5_CBLOCK +#define MD5_Init rb_digest_md5osslevp_Init +#define MD5_Update EVP_DigestUpdate +#define MD5_Finish rb_digest_md5osslevp_Finish +#define MD5_CTX EVP_MD_CTX -void MD5_Finish(MD5_CTX *pctx, unsigned char *digest); +/* We should use EVP_MD_size(3) and EVP_MD_block_size(3), but the + advantage of these is that they are flexible across digest + algorithms and we are fixing the digest algorithm here; and these + numbers must be constants because the rb_digest_metadata_t + structure is declared const. Simplest way is to write literals. */ +#define MD5_BLOCK_LENGTH 64 +#define MD5_DIGEST_LENGTH 16 + +int MD5_Init(MD5_CTX *pctx); +int MD5_Finish(MD5_CTX *pctx, unsigned char *digest); #endif -- cgit v1.2.3