On Thu, May 27, 2004 at 09:36:18PM -0500, Michael Griego wrote:
> Try the attached patch to the sha1.c file and see if that takes care of
> the problem.

I've been working and coding on this all night, and I might have an answer.
Seems that endianess isn't an issue - more probably the SHA1 code and macros,
which confuse gcc (3.3, 2.95, etc.) on Alpha architecture. I'll give some
arguments:

I've tried adding SHA-1 NIST values into original sha1.c and testing if they're
calculated properly - and they are *not*. Test values from Alpha-server (first
is calculated row, then correct raw from documented test values):

testgate:~/work/radius-patched-debug/src/lib# ./a.out
 8aabe313 9782e9b6 6a63ed9e b080d335 a6bed204
 A9993E36 4706816A BA3E2571 7850C26C 9CD0D89D <= correct
 4493b602 0d8a65f9 0b8a9b27 5c4eebbb e735319c
 84983E44 1C3BD26E BAAE4AA1 F95129E5 E54670F1 <= correct
 ba0bb08d 919b3366 a1298140 268c5761 2ca67f3a
 34AA973C D4C4DAA4 F61EEB2B DBAD2731 6534016F <= correct

Test values from PC-based server (exact same code):

esa1:/tmp/lib [6]$ ./a.out                                              % 11:56
 a9993e36 4706816a ba3e2571 7850c26c 9cd0d89d
 A9993E36 4706816A BA3E2571 7850C26C 9CD0D89D <= correct
 84983e44 1c3bd26e baae4aa1 f95129e5 e54670f1
 84983E44 1C3BD26E BAAE4AA1 F95129E5 E54670F1 <= correct
 34aa973c d4c4daa4 f61eeb2b dbad2731 6534016f
 34AA973C D4C4DAA4 F61EEB2B DBAD2731 6534016F <= correct

However, there is an interesting thing - this implementation also fails
(http://www.di-mgt.com.au/src/sha1.c.txt), and this one
(http://www.deadhat.com/wlancrypto/sha1.c) passes first test, but fails
miserably on second:

wrong-> 48 66 d3 18 39 bd 08 ab 17 d8 d3 61 d3 c0 76 20 07 32 65 20
correct-> 84 98 3e 44 1c 3b d2 6e ba ae 4a a1 f9 51 29 e5 e5 46 70 f1

However, *this* one (http://www.cr0.net:8040/code/crypto/sha1/sha1.c) works
like a charm (again, I've added some trivial debug output):

 1 a9993e364706816aba3e25717850c26c9cd0d89d -> correct
 2 84983e441c3bd26ebaae4aa1f95129e5e54670f1 -> correct
 3 34aa973cd4c4daa4f61eeb2bdbad27316534016f -> correct

I'll try rewriting original SHA1 FreeRADIUS code to see if it helps.

-- 
|  |--.----.-----. Dinko 'kreator' Korunic       #include <stddisclaimer.h>
|    <|   _|  -__| http://www.srce.hr/~kreator/ | http://kre.deviantart.com
|__|__|__| |_____| PGP:0xEA160D0B | IRC:kre | ICQ:16965294 | AIM:kreatorMoo

- 
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html

Reply via email to