better function names and parameter order

This commit is contained in:
Nikos Mavrogiannopoulos
2013-07-05 12:01:35 +02:00
parent a9952f3f50
commit 718ccd79c1
5 changed files with 9 additions and 9 deletions

View File

@@ -79,8 +79,8 @@ cleanup:
return ret;
}
int encrypt_cookie(main_server_st * s, uint8_t* cookie, unsigned cookie_size,
const struct stored_cookie_st* sc)
int encrypt_cookie(main_server_st * s, const struct stored_cookie_st* sc,
uint8_t* cookie, unsigned cookie_size)
{
uint8_t _iv[COOKIE_IV_SIZE];
gnutls_cipher_hd_t h;

View File

@@ -15,8 +15,8 @@ struct __attribute__ ((__packed__)) stored_cookie_st {
#define COOKIE_MAC_SIZE 12 /* 96-bits of AES-GCM */
#define COOKIE_SIZE (COOKIE_IV_SIZE + sizeof(struct stored_cookie_st) + COOKIE_MAC_SIZE)
int encrypt_cookie(struct main_server_st * s, uint8_t* cookie, unsigned cookie_size,
const struct stored_cookie_st* sc);
int encrypt_cookie(struct main_server_st * s, const struct stored_cookie_st* sc,
uint8_t* cookie, unsigned cookie_size);
int decrypt_cookie(struct main_server_st * s, const uint8_t* cookie, unsigned cookie_size,
struct stored_cookie_st* sc);

View File

@@ -190,7 +190,7 @@ time_t now = time(0);
return 0;
}
int generate_and_store_vals(main_server_st *s, struct proc_st* proc)
int generate_cookie(main_server_st *s, struct proc_st* proc)
{
int ret;
struct stored_cookie_st sc;
@@ -208,7 +208,7 @@ struct stored_cookie_st sc;
sc.expiration = time(0) + s->config->cookie_validity;
ret = encrypt_cookie(s, proc->cookie, sizeof(proc->cookie), &sc);
ret = encrypt_cookie(s, &sc, proc->cookie, sizeof(proc->cookie));
if (ret < 0)
return -1;

View File

@@ -173,8 +173,8 @@ const char* group;
group = proc->groupname;
if (cmd == AUTH_REQ || cmd == AUTH_INIT) {
/* generate and store cookie */
ret = generate_and_store_vals(s, proc);
/* generate cookie */
ret = generate_cookie(s, proc);
if (ret < 0) {
return ERR_BAD_COMMAND;
}

View File

@@ -158,7 +158,7 @@ int send_auth_reply(main_server_st* s, struct proc_st* proc,
cmd_auth_reply_t r);
int handle_auth_cookie_req(main_server_st* s, struct proc_st* proc,
const struct cmd_auth_cookie_req_st * req);
int generate_and_store_vals(main_server_st *s, struct proc_st* proc);
int generate_cookie(main_server_st *s, struct proc_st* proc);
int handle_auth_init(main_server_st *s, struct proc_st* proc,
const struct cmd_auth_init_st * req);
int handle_auth_req(main_server_st *s, struct proc_st* proc,