From: Andre Noll Date: Mon, 28 Feb 2011 22:49:06 +0000 (+0100) Subject: rename RC4_KEY_LEN to SESSION_KEY_LEN. X-Git-Tag: v0.4.7~14^2~6 X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=commitdiff_plain;h=15714678f57f0e8931a70d64dca43c31e693bb61 rename RC4_KEY_LEN to SESSION_KEY_LEN. 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. --- diff --git a/aft.c b/aft.c index 6aace3ae..9911b7fb 100644 --- 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. diff --git a/client_common.c b/client_common.c index ba419786..8e1ca284 100644 --- a/client_common.c +++ b/client_common.c @@ -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, diff --git a/command.c b/command.c index 34e6494f..6bb8cbed 100644 --- 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 1815e3b8..d2c6de79 100644 --- 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 diff --git a/user_list.c b/user_list.c index 9cde1f62..f835c110 100644 --- a/user_list.c +++ b/user_list.c @@ -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);