diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-02-11 02:09:55 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-02-11 02:09:55 +0000 |
commit | b97ceb66e97f2a36e5602f74a593c61292cbd33b (patch) | |
tree | bd3085b343ba5abd5b40338007e880c5fde64176 /ext/digest/sha1 | |
parent | 935275bb5952b59b65c6a038a4b825aea95562ae (diff) | |
download | ruby-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/sha1')
-rw-r--r-- | ext/digest/sha1/sha1cc.h | 14 | ||||
-rw-r--r-- | ext/digest/sha1/sha1init.c | 2 |
2 files changed, 16 insertions, 0 deletions
diff --git a/ext/digest/sha1/sha1cc.h b/ext/digest/sha1/sha1cc.h new file mode 100644 index 0000000000..1376c49ec7 --- /dev/null +++ b/ext/digest/sha1/sha1cc.h @@ -0,0 +1,14 @@ +#define COMMON_DIGEST_FOR_OPENSSL 1 +#include <CommonCrypto/CommonDigest.h> + +#define SHA1_BLOCK_LENGTH CC_SHA1_BLOCK_BYTES +#define SHA1_DIGEST_LENGTH CC_SHA1_DIGEST_LENGTH +#define SHA1_CTX CC_SHA1_CTX + +static DEFINE_UPDATE_FUNC_FOR_UINT(SHA1); +static DEFINE_FINISH_FUNC_FROM_FINAL(SHA1); + +#undef SHA1_Update +#undef SHA1_Finish +#define SHA1_Update rb_digest_SHA1_update +#define SHA1_Finish rb_digest_SHA1_finish diff --git a/ext/digest/sha1/sha1init.c b/ext/digest/sha1/sha1init.c index 72529fe0b7..1f0580883f 100644 --- a/ext/digest/sha1/sha1init.c +++ b/ext/digest/sha1/sha1init.c @@ -4,6 +4,8 @@ #include "digest.h" #if defined(SHA1_USE_OPENSSL) #include "sha1ossl.h" +#elif defined(SHA1_USE_COMMONDIGEST) +#include "sha1cc.h" #else #include "sha1.h" #endif |