Move sha1.[ch] to crypt.[ch] and make crypto API independent of sha1.
[paraslash.git] / client_common.c
index b5d34ed..c7ea3b4 100644 (file)
@@ -21,7 +21,6 @@
 #include "string.h"
 #include "client.cmdline.h"
 #include "client.h"
 #include "string.h"
 #include "client.cmdline.h"
 #include "client.h"
-#include "hash.h"
 #include "buffer_tree.h"
 
 /** The size of the receiving buffer. */
 #include "buffer_tree.h"
 
 /** The size of the receiving buffer. */
@@ -182,7 +181,7 @@ static void client_post_select(struct sched *s, struct task *t)
                /* decrypted challenge/session key buffer */
                unsigned char crypt_buf[1024];
                /* the SHA1 of the decrypted challenge */
                /* decrypted challenge/session key buffer */
                unsigned char crypt_buf[1024];
                /* the SHA1 of the decrypted challenge */
-               unsigned char challenge_sha1[HASH_SIZE];
+               unsigned char challenge_hash[HASH_SIZE];
 
                ret = client_recv_buffer(ct, &s->rfds, buf, sizeof(buf), &n);
                if (ret < 0 || n == 0)
 
                ret = client_recv_buffer(ct, &s->rfds, buf, sizeof(buf), &n);
                if (ret < 0 || n == 0)
@@ -192,13 +191,13 @@ static void client_post_select(struct sched *s, struct task *t)
                        (unsigned char *)buf, n);
                if (ret < 0)
                        goto out;
                        (unsigned char *)buf, n);
                if (ret < 0)
                        goto out;
-               sha1_hash((char *)crypt_buf, CHALLENGE_SIZE, challenge_sha1);
+               hash_function((char *)crypt_buf, CHALLENGE_SIZE, challenge_hash);
                ct->scc.send = sc_new(crypt_buf + CHALLENGE_SIZE, SESSION_KEY_LEN);
                ct->scc.recv = sc_new(crypt_buf + CHALLENGE_SIZE + SESSION_KEY_LEN,
                        SESSION_KEY_LEN);
                ct->scc.send = sc_new(crypt_buf + CHALLENGE_SIZE, SESSION_KEY_LEN);
                ct->scc.recv = sc_new(crypt_buf + CHALLENGE_SIZE + SESSION_KEY_LEN,
                        SESSION_KEY_LEN);
-               hash_to_asc(challenge_sha1, buf);
+               hash_to_asc(challenge_hash, buf);
                PARA_INFO_LOG("--> %s\n", buf);
                PARA_INFO_LOG("--> %s\n", buf);
-               ret = send_bin_buffer(ct->scc.fd, (char *)challenge_sha1,
+               ret = send_bin_buffer(ct->scc.fd, (char *)challenge_hash,
                        HASH_SIZE);
                if (ret < 0)
                        goto out;
                        HASH_SIZE);
                if (ret < 0)
                        goto out;