Commit 19e66a67 authored by Trevor Highland's avatar Trevor Highland Committed by Linus Torvalds

eCryptfs: change the type of cipher_code from u16 to u8

Only the lower byte of cipher_code is ever used, so it makes sense
for its type to be u8.
Signed-off-by: default avatarTrevor Highland <trevor.highland@gmail.com>
Cc: Michael Halcrow <mhalcrow@us.ibm.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 25bd8174
...@@ -1128,7 +1128,7 @@ write_ecryptfs_flags(char *page_virt, struct ecryptfs_crypt_stat *crypt_stat, ...@@ -1128,7 +1128,7 @@ write_ecryptfs_flags(char *page_virt, struct ecryptfs_crypt_stat *crypt_stat,
struct ecryptfs_cipher_code_str_map_elem { struct ecryptfs_cipher_code_str_map_elem {
char cipher_str[16]; char cipher_str[16];
u16 cipher_code; u8 cipher_code;
}; };
/* Add support for additional ciphers by adding elements here. The /* Add support for additional ciphers by adding elements here. The
...@@ -1152,10 +1152,10 @@ ecryptfs_cipher_code_str_map[] = { ...@@ -1152,10 +1152,10 @@ ecryptfs_cipher_code_str_map[] = {
* *
* Returns zero on no match, or the cipher code on match * Returns zero on no match, or the cipher code on match
*/ */
u16 ecryptfs_code_for_cipher_string(struct ecryptfs_crypt_stat *crypt_stat) u8 ecryptfs_code_for_cipher_string(struct ecryptfs_crypt_stat *crypt_stat)
{ {
int i; int i;
u16 code = 0; u8 code = 0;
struct ecryptfs_cipher_code_str_map_elem *map = struct ecryptfs_cipher_code_str_map_elem *map =
ecryptfs_cipher_code_str_map; ecryptfs_cipher_code_str_map;
...@@ -1187,7 +1187,7 @@ u16 ecryptfs_code_for_cipher_string(struct ecryptfs_crypt_stat *crypt_stat) ...@@ -1187,7 +1187,7 @@ u16 ecryptfs_code_for_cipher_string(struct ecryptfs_crypt_stat *crypt_stat)
* *
* Returns zero on success * Returns zero on success
*/ */
int ecryptfs_cipher_code_to_string(char *str, u16 cipher_code) int ecryptfs_cipher_code_to_string(char *str, u8 cipher_code)
{ {
int rc = 0; int rc = 0;
int i; int i;
......
...@@ -558,8 +558,8 @@ int ecryptfs_read_and_validate_header_region(char *data, ...@@ -558,8 +558,8 @@ int ecryptfs_read_and_validate_header_region(char *data,
struct inode *ecryptfs_inode); struct inode *ecryptfs_inode);
int ecryptfs_read_and_validate_xattr_region(char *page_virt, int ecryptfs_read_and_validate_xattr_region(char *page_virt,
struct dentry *ecryptfs_dentry); struct dentry *ecryptfs_dentry);
u16 ecryptfs_code_for_cipher_string(struct ecryptfs_crypt_stat *crypt_stat); u8 ecryptfs_code_for_cipher_string(struct ecryptfs_crypt_stat *crypt_stat);
int ecryptfs_cipher_code_to_string(char *str, u16 cipher_code); int ecryptfs_cipher_code_to_string(char *str, u8 cipher_code);
void ecryptfs_set_default_sizes(struct ecryptfs_crypt_stat *crypt_stat); void ecryptfs_set_default_sizes(struct ecryptfs_crypt_stat *crypt_stat);
int ecryptfs_generate_key_packet_set(char *dest_base, int ecryptfs_generate_key_packet_set(char *dest_base,
struct ecryptfs_crypt_stat *crypt_stat, struct ecryptfs_crypt_stat *crypt_stat,
......
...@@ -189,7 +189,7 @@ write_tag_64_packet(char *signature, struct ecryptfs_session_key *session_key, ...@@ -189,7 +189,7 @@ write_tag_64_packet(char *signature, struct ecryptfs_session_key *session_key,
} }
static int static int
parse_tag_65_packet(struct ecryptfs_session_key *session_key, u16 *cipher_code, parse_tag_65_packet(struct ecryptfs_session_key *session_key, u8 *cipher_code,
struct ecryptfs_message *msg) struct ecryptfs_message *msg)
{ {
size_t i = 0; size_t i = 0;
...@@ -275,7 +275,7 @@ parse_tag_65_packet(struct ecryptfs_session_key *session_key, u16 *cipher_code, ...@@ -275,7 +275,7 @@ parse_tag_65_packet(struct ecryptfs_session_key *session_key, u16 *cipher_code,
static int static int
write_tag_66_packet(char *signature, size_t cipher_code, write_tag_66_packet(char *signature, u8 cipher_code,
struct ecryptfs_crypt_stat *crypt_stat, char **packet, struct ecryptfs_crypt_stat *crypt_stat, char **packet,
size_t *packet_len) size_t *packet_len)
{ {
...@@ -428,7 +428,7 @@ static int ...@@ -428,7 +428,7 @@ static int
decrypt_pki_encrypted_session_key(struct ecryptfs_auth_tok *auth_tok, decrypt_pki_encrypted_session_key(struct ecryptfs_auth_tok *auth_tok,
struct ecryptfs_crypt_stat *crypt_stat) struct ecryptfs_crypt_stat *crypt_stat)
{ {
u16 cipher_code = 0; u8 cipher_code = 0;
struct ecryptfs_msg_ctx *msg_ctx; struct ecryptfs_msg_ctx *msg_ctx;
struct ecryptfs_message *msg = NULL; struct ecryptfs_message *msg = NULL;
char *auth_tok_sig; char *auth_tok_sig;
...@@ -1537,7 +1537,7 @@ write_tag_3_packet(char *dest, size_t *remaining_bytes, ...@@ -1537,7 +1537,7 @@ write_tag_3_packet(char *dest, size_t *remaining_bytes,
struct scatterlist dst_sg; struct scatterlist dst_sg;
struct scatterlist src_sg; struct scatterlist src_sg;
struct mutex *tfm_mutex = NULL; struct mutex *tfm_mutex = NULL;
size_t cipher_code; u8 cipher_code;
size_t packet_size_length; size_t packet_size_length;
size_t max_packet_size; size_t max_packet_size;
struct ecryptfs_mount_crypt_stat *mount_crypt_stat = struct ecryptfs_mount_crypt_stat *mount_crypt_stat =
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment