]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
rename RC4_KEY_LEN to SESSION_KEY_LEN.
authorAndre Noll <maan@systemlinux.org>
Mon, 28 Feb 2011 22:49:06 +0000 (23:49 +0100)
committerAndre Noll <maan@systemlinux.org>
Sun, 27 Mar 2011 14:43:11 +0000 (16:43 +0200)
The users of the crypto API should not need to care about which stream
cipher is in use. This trivial patch only renames the name of the
constant value and updates the documentation.

aft.c
client_common.c
command.c
rc4.h
user_list.c

diff --git a/aft.c b/aft.c
index 6aace3aee6c4801f043307e10981a40e8280c192..9911b7fbadd7e3d58a25ceedd79ec0e1ce419f31 100644 (file)
--- a/aft.c
+++ b/aft.c
@@ -2473,7 +2473,7 @@ static void afs_stat_callback(int fd, const struct osl_object *query)
 }
 
 /**
- * Get the current afs status items from the afs process and send it using RC4.
+ * Get the current afs status items from the afs process and send it.
  *
  * \param scc The stream cipher context for data encryption.
  * \param parser_friendly Whether parser-friendly output format should be used.
index ba419786ee036745972825ec49629d9f1cf342ab..8e1ca2841b13267c80c9f6328ba4c436ea94701b 100644 (file)
@@ -194,9 +194,9 @@ static void client_post_select(struct sched *s, struct task *t)
                if (ret < 0)
                        goto out;
                sha1_hash((char *)crypt_buf, CHALLENGE_SIZE, challenge_sha1);
-               ct->scc.send = sc_new(crypt_buf + CHALLENGE_SIZE, RC4_KEY_LEN);
-               ct->scc.recv = sc_new(crypt_buf + CHALLENGE_SIZE + RC4_KEY_LEN,
-                       RC4_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);
                PARA_INFO_LOG("--> %s\n", buf);
                ret = send_bin_buffer(ct->scc.fd, (char *)challenge_sha1,
index 34e6494f972e4fad90ea1dbdeeb2f878e3264ced..6bb8cbed7117777fc98513a4a70b1c88e016bd28 100644 (file)
--- a/command.c
+++ b/command.c
@@ -710,7 +710,7 @@ static void reset_signals(void)
  * calls this function.
  *
  * An RSA-based challenge/response is used to authenticate
- * the peer. It that authentication succeeds, a random RC4
+ * the peer. It that authentication succeeds, a random
  * session key is generated and sent back to the peer,
  * encrypted with its RSA public key.  From this point on,
  * all transfers are crypted with this session key.
@@ -730,7 +730,7 @@ __noreturn void handle_connect(int fd, const char *peername)
 {
        int ret, argc;
        char buf[4096];
-       unsigned char rand_buf[CHALLENGE_SIZE + 2 * RC4_KEY_LEN];
+       unsigned char rand_buf[CHALLENGE_SIZE + 2 * SESSION_KEY_LEN];
        unsigned char challenge_sha1[HASH_SIZE];
        struct user *u;
        struct server_command *cmd = NULL;
@@ -809,8 +809,8 @@ __noreturn void handle_connect(int fd, const char *peername)
        alarm(0);
        PARA_INFO_LOG("good auth for %s\n", u->name);
        /* init stream cipher keys with the second part of the random buffer */
-       scc.recv = sc_new(rand_buf + CHALLENGE_SIZE, RC4_KEY_LEN);
-       scc.send = sc_new(rand_buf + CHALLENGE_SIZE + RC4_KEY_LEN, RC4_KEY_LEN);
+       scc.recv = sc_new(rand_buf + CHALLENGE_SIZE, SESSION_KEY_LEN);
+       scc.send = sc_new(rand_buf + CHALLENGE_SIZE + SESSION_KEY_LEN, SESSION_KEY_LEN);
        ret = sc_send_buffer(&scc, PROCEED_MSG);
        if (ret < 0)
                goto net_err;
diff --git a/rc4.h b/rc4.h
index 1815e3b86603e918683e5106b10270007db6a5c1..d2c6de7904a6d7fbb2814e4aee85949ffc3f5323 100644 (file)
--- a/rc4.h
+++ b/rc4.h
@@ -1,4 +1,4 @@
 /** \file rc4.h common symbols of command.c and client_common.c */
 
-/** Number of bytes of the rc4 session key. */
-#define RC4_KEY_LEN 32
+/** Number of bytes of the session key. */
+#define SESSION_KEY_LEN 32
index 9cde1f625e3d9fd8dc2c198dd9775db2a5b24879..f835c11015aaf9f866edeaead3423b40724c2b05 100644 (file)
@@ -57,12 +57,12 @@ static void populate_user_list(char *user_list_file)
                        continue;
                }
                /*
-                * In order to encrypt len := CHALLENGE_SIZE + 2 * RC4_KEY_LEN
+                * In order to encrypt len := CHALLENGE_SIZE + 2 * SESSION_KEY_LEN
                 * bytes using RSA_public_encrypt() with EME-OAEP padding mode,
                 * RSA_size(rsa) must be greater than len + 41. So ignore keys
                 * which are too short. For details see RSA_public_encrypt(3).
                 */
-               if (ret <= CHALLENGE_SIZE + 2 * RC4_KEY_LEN + 41) {
+               if (ret <= CHALLENGE_SIZE + 2 * SESSION_KEY_LEN + 41) {
                        PARA_WARNING_LOG("public key %s too short (%d)\n",
                                k, ret);
                        free_asymmetric_key(pubkey);