aboutsummaryrefslogtreecommitdiffstats
path: root/ext/digest/md5
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-02-11 02:09:55 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-02-11 02:09:55 +0000
commitb97ceb66e97f2a36e5602f74a593c61292cbd33b (patch)
treebd3085b343ba5abd5b40338007e880c5fde64176 /ext/digest/md5
parent935275bb5952b59b65c6a038a4b825aea95562ae (diff)
downloadruby-b97ceb66e97f2a36e5602f74a593c61292cbd33b.tar.gz
digest: CommonDigest
* ext/digest/digest_conf.rb (digest_conf): check for CommonDigest. * ext/digest/*/*cc.h: for Apple CommonCrypto/CommonDigest.h. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49565 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/digest/md5')
-rw-r--r--ext/digest/md5/md5cc.h12
-rw-r--r--ext/digest/md5/md5init.c2
2 files changed, 14 insertions, 0 deletions
diff --git a/ext/digest/md5/md5cc.h b/ext/digest/md5/md5cc.h
new file mode 100644
index 0000000000..63a7ae9d67
--- /dev/null
+++ b/ext/digest/md5/md5cc.h
@@ -0,0 +1,12 @@
+#define COMMON_DIGEST_FOR_OPENSSL 1
+#include <CommonCrypto/CommonDigest.h>
+
+#define MD5_BLOCK_LENGTH CC_MD5_BLOCK_BYTES
+
+static DEFINE_UPDATE_FUNC_FOR_UINT(MD5);
+static DEFINE_FINISH_FUNC_FROM_FINAL(MD5);
+
+#undef MD5_Update
+#undef MD5_Finish
+#define MD5_Update rb_digest_MD5_update
+#define MD5_Finish rb_digest_MD5_finish
diff --git a/ext/digest/md5/md5init.c b/ext/digest/md5/md5init.c
index 93d01a2f41..db9298cbfc 100644
--- a/ext/digest/md5/md5init.c
+++ b/ext/digest/md5/md5init.c
@@ -4,6 +4,8 @@
#include "digest.h"
#if defined(MD5_USE__OPENSSL)
#include "md5ossl.h"
+#elif defined(MD5_USE_COMMONDIGEST)
+#include "md5cc.h"
#else
#include "md5.h"
#endif