diff options
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); |