summaryrefslogtreecommitdiff
path: root/ext/digest/md5
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-07-15 15:43:03 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-07-15 15:43:03 +0000
commit5dbe603f09210513dca2b54370cfaecc9b7dfc2d (patch)
tree24a6148536d413890c668b7ce50e10942188711a /ext/digest/md5
parent2d33fc97a3742800e65bf647e5b66d0af58e7123 (diff)
Revert r46828
r46828 "md5ossl.c: indicate the result" caused segfaults. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46829 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/digest/md5')
-rw-r--r--ext/digest/md5/md5ossl.c13
-rw-r--r--ext/digest/md5/md5ossl.h18
2 files changed, 6 insertions, 25 deletions
diff --git a/ext/digest/md5/md5ossl.c b/ext/digest/md5/md5ossl.c
index d08d2db..d94ae2c 100644
--- a/ext/digest/md5/md5ossl.c
+++ b/ext/digest/md5/md5ossl.c
@@ -2,15 +2,8 @@
#include "md5ossl.h"
-int
-rb_digest_md5osslevp_Init(EVP_MD_CTX *pctx)
+void
+MD5_Finish(MD5_CTX *pctx, unsigned char *digest)
{
- return EVP_DigestInit_ex(pctx, EVP_md5(), NULL);
-}
-
-int
-rb_digest_md5osslevp_Finish(EVP_MD_CTX *pctx, unsigned char *digest)
-{
- /* if EVP_DigestFinal_ex fails, we ignore that */
- return EVP_DigestFinal_ex(pctx, digest, NULL);
+ MD5_Final(digest, pctx);
}
diff --git a/ext/digest/md5/md5ossl.h b/ext/digest/md5/md5ossl.h
index f102870..1680c4f 100644
--- a/ext/digest/md5/md5ossl.h
+++ b/ext/digest/md5/md5ossl.h
@@ -4,22 +4,10 @@
#define MD5OSSL_H_INCLUDED
#include <stddef.h>
-#include <openssl/evp.h>
+#include <openssl/md5.h>
-#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
+#define MD5_BLOCK_LENGTH MD5_CBLOCK
-/* 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);
+void MD5_Finish(MD5_CTX *pctx, unsigned char *digest);
#endif