diff options
author | markm <markm@FreeBSD.org> | 2001-07-14 08:30:54 +0000 |
---|---|---|
committer | markm <markm@FreeBSD.org> | 2001-07-14 08:30:54 +0000 |
commit | 6cdc15e4a8e4d08d42218c0b7c6fa90f2ec93bf2 (patch) | |
tree | bf4e1fd6118e3e24500bd424d2280caf9894b776 /contrib | |
parent | df9e832a1a6fe8cb17051a5fc2fb6c51622fc9f0 (diff) | |
download | FreeBSD-src-6cdc15e4a8e4d08d42218c0b7c6fa90f2ec93bf2.zip FreeBSD-src-6cdc15e4a8e4d08d42218c0b7c6fa90f2ec93bf2.tar.gz |
Fix SHA1 hashing.
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/opie/libopie/hash.c | 17 | ||||
-rw-r--r-- | contrib/opie/libopie/hashlen.c | 21 |
2 files changed, 17 insertions, 21 deletions
diff --git a/contrib/opie/libopie/hash.c b/contrib/opie/libopie/hash.c index eab1706..0edbdd1 100644 --- a/contrib/opie/libopie/hash.c +++ b/contrib/opie/libopie/hash.c @@ -17,11 +17,9 @@ $FreeBSD$ */ #include "opie_cfg.h" -#if 0 -#include "sha.h" -#endif /* 0 */ #include "opie.h" +#include <sha.h> #include <md4.h> #include <md5.h> @@ -30,18 +28,17 @@ VOIDRET opiehash FUNCTION((x, algorithm), VOIDPTR x AND unsigned algorithm) UINT4 *results = (UINT4 *)x; switch(algorithm) { -#if 0 case 3: { SHA_CTX sha; - SHAInit(&sha); - SHAUpdate(&sha, (unsigned char *)x, 8); - SHAFinal(&sha); - results[0] = sha.buffer[0] ^ sha.buffer[2] ^ sha.buffer[4]; - results[1] = sha.buffer[1] ^ sha.buffer[3]; + UINT4 digest[5]; + SHA1_Init(&sha); + SHA1_Update(&sha, (unsigned char *)x, 8); + SHA1_Final((unsigned char *)digest, &sha); + results[0] = digest[0] ^ digest[2] ^ digest[4]; + results[1] = digest[1] ^ digest[3]; }; break; -#endif /* 0 */ case 4: { MD4_CTX mdx; diff --git a/contrib/opie/libopie/hashlen.c b/contrib/opie/libopie/hashlen.c index 74f1fc6..66f7d2c 100644 --- a/contrib/opie/libopie/hashlen.c +++ b/contrib/opie/libopie/hashlen.c @@ -16,6 +16,7 @@ $FreeBSD$ #include "opie_cfg.h" #include "opie.h" +#include <sha.h> #include <md4.h> #include <md5.h> @@ -23,20 +24,18 @@ VOIDRET opiehashlen FUNCTION((algorithm, in, out, n), int algorithm AND VOIDPTR { UINT4 *results = (UINT4 *)out; UINT4 mdx_tmp[4]; -#if 0 - SHA_INFO sha; -#endif /* 0 */ switch(algorithm) { -#if 0 - case 3: - sha_init(&sha); - sha_update(&sha, (BYTE *)in, n); - sha_final(&sha); - results[0] = sha.digest[0] ^ sha.digest[2] ^ sha.digest[4]; - results[1] = sha.digest[1] ^ sha.digest[3] ^ sha.digest[5]; + case 3: { + SHA_CTX sha; + UINT4 digest[5]; + SHA1_Init(&sha); + SHA1_Update(&sha, (unsigned char *)in, n); + SHA1_Final((unsigned char *)digest, &sha); + results[0] = digest[0] ^ digest[2] ^ digest[4]; + results[1] = digest[1] ^ digest[3]; break; -#endif /* 0 */ + } case 4: { MD4_CTX mdx; MD4Init(&mdx); |