summaryrefslogtreecommitdiffstats
path: root/ext/digest/md5
diff options
context:
space:
mode:
authorknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-10-11 12:43:58 +0000
committerknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-10-11 12:43:58 +0000
commit84133e4b0d8eafc0b7905bdb44827413b10820fc (patch)
tree081ca1d78f2303a682f338b2605a2da30d19b96f /ext/digest/md5
parent1940e29c7c8f7897f1c07459cbaae8d1523fbfba (diff)
downloadruby-84133e4b0d8eafc0b7905bdb44827413b10820fc.tar.gz
ruby-84133e4b0d8eafc0b7905bdb44827413b10820fc.tar.xz
ruby-84133e4b0d8eafc0b7905bdb44827413b10820fc.zip
* ext/digest/digest.c (rb_digest_base_alloc,
rb_digest_base_equal): Simplify the equality check and just compare resulted digests since state-level equality should not be significant. * ext/digest/digest.h: Ditto. * ext/digest/*/*.[ch]: Ditto. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@11131 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/digest/md5')
-rw-r--r--ext/digest/md5/md5.c6
-rw-r--r--ext/digest/md5/md5.h2
-rw-r--r--ext/digest/md5/md5init.c1
-rw-r--r--ext/digest/md5/md5ossl.c15
-rw-r--r--ext/digest/md5/md5ossl.h1
5 files changed, 0 insertions, 25 deletions
diff --git a/ext/digest/md5/md5.c b/ext/digest/md5/md5.c
index 8f49476a1..993bc47a0 100644
--- a/ext/digest/md5/md5.c
+++ b/ext/digest/md5/md5.c
@@ -418,9 +418,3 @@ MD5_Finish(MD5_CTX *pms, uint8_t *digest)
for (i = 0; i < 16; ++i)
digest[i] = (uint8_t)(pms->state[i >> 2] >> ((i & 3) << 3));
}
-
-int MD5_Equal(MD5_CTX* pctx1, MD5_CTX* pctx2) {
- return memcmp(pctx1->count, pctx2->count, sizeof(pctx1->count)) == 0
- && memcmp(pctx1->state, pctx2->state, sizeof(pctx1->state)) == 0
- && memcmp(pctx1->buffer, pctx2->buffer, sizeof(pctx1->buffer)) == 0;
-}
diff --git a/ext/digest/md5/md5.h b/ext/digest/md5/md5.h
index a5de6fd97..f4580ef5e 100644
--- a/ext/digest/md5/md5.h
+++ b/ext/digest/md5/md5.h
@@ -67,13 +67,11 @@ typedef struct md5_state_s {
#define MD5_Init rb_Digest_MD5_Init
#define MD5_Update rb_Digest_MD5_Update
#define MD5_Finish rb_Digest_MD5_Finish
-#define MD5_Equal rb_Digest_MD5_Equal
#endif
void MD5_Init _((MD5_CTX *pms));
void MD5_Update _((MD5_CTX *pms, const uint8_t *data, size_t nbytes));
void MD5_Finish _((MD5_CTX *pms, uint8_t *digest));
-int MD5_Equal _((MD5_CTX *pctx1, MD5_CTX *pctx2));
#define MD5_BLOCK_LENGTH 64
#define MD5_DIGEST_LENGTH 16
diff --git a/ext/digest/md5/md5init.c b/ext/digest/md5/md5init.c
index 4dc0c3bff..781e8ea4c 100644
--- a/ext/digest/md5/md5init.c
+++ b/ext/digest/md5/md5init.c
@@ -14,7 +14,6 @@ static algo_t md5 = {
(hash_init_func_t)MD5_Init,
(hash_update_func_t)MD5_Update,
(hash_finish_func_t)MD5_Finish,
- (hash_equal_func_t)MD5_Equal,
};
void
diff --git a/ext/digest/md5/md5ossl.c b/ext/digest/md5/md5ossl.c
index 963243c7c..d94ae2cd2 100644
--- a/ext/digest/md5/md5ossl.c
+++ b/ext/digest/md5/md5ossl.c
@@ -1,24 +1,9 @@
/* $Id$ */
#include "md5ossl.h"
-#include <sys/types.h>
-#include <stdio.h>
-#include <string.h>
void
MD5_Finish(MD5_CTX *pctx, unsigned char *digest)
{
MD5_Final(digest, pctx);
}
-
-int
-MD5_Equal(MD5_CTX* pctx1, MD5_CTX* pctx2) {
- return pctx1->num == pctx2->num
- && pctx1->A == pctx2->A
- && pctx1->B == pctx2->B
- && pctx1->C == pctx2->C
- && pctx1->D == pctx2->D
- && pctx1->Nl == pctx2->Nl
- && pctx1->Nh == pctx2->Nh
- && memcmp(pctx1->data, pctx2->data, sizeof(pctx1->data)) == 0;
-}
diff --git a/ext/digest/md5/md5ossl.h b/ext/digest/md5/md5ossl.h
index ec629c55d..1680c4f5c 100644
--- a/ext/digest/md5/md5ossl.h
+++ b/ext/digest/md5/md5ossl.h
@@ -9,6 +9,5 @@
#define MD5_BLOCK_LENGTH MD5_CBLOCK
void MD5_Finish(MD5_CTX *pctx, unsigned char *digest);
-int MD5_Equal(MD5_CTX *pctx1, MD5_CTX *pctx2);
#endif