update to new cksum interface
authorJohn Kohl <jtkohl@mit.edu>
Wed, 9 May 1990 14:43:27 +0000 (14:43 +0000)
committerJohn Kohl <jtkohl@mit.edu>
Wed, 9 May 1990 14:43:27 +0000 (14:43 +0000)
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@800 dc483132-0cff-0310-8789-dd5450dbe970

src/lib/crypto/crc32/crc.c

index 4444b093e1f39862650a6ccb3c9c7b7a34d40044..0ce7589ba1cfa33e4951853f23ff871ab4acbbd7 100644 (file)
@@ -89,23 +89,26 @@ static u_long const crc_table[256] = {
     };
 
 static krb5_error_code
-crc32_sum_func(in, out, seed, in_length, seed_length, outcksum)
+crc32_sum_func(in, in_length, seed, seed_length, outcksum)
 krb5_pointer in;
-krb5_pointer out;
-krb5_pointer seed;
 size_t in_length;
+krb5_pointer seed;
 size_t seed_length;
 krb5_checksum *outcksum;
 {
-    register u_char *data = (u_char *)in;
+    register u_char *data;
     register u_long c = 0;
     register int idx;
     int i;
 
-    outcksum->contents = (krb5_octet *)malloc(4);
-    if (!outcksum->contents)
-       return ENOMEM;
-
+    data = (u_char *)seed;
+    for (i=0; i<seed_length;i++) {
+       idx = (data[i] ^ c);
+       idx &= 0xff;
+       c >>= 8;
+       c ^= crc_table[idx];
+    }
+    data = (u_char *)in;
     for (i=0; i<in_length;i++) {
        idx = (data[i] ^ c);
        idx &= 0xff;