aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ecryptfs/keystore.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/ecryptfs/keystore.c')
-rw-r--r--fs/ecryptfs/keystore.c32
1 files changed, 15 insertions, 17 deletions
diff --git a/fs/ecryptfs/keystore.c b/fs/ecryptfs/keystore.c
index f5b76a331b9c..e22bc3961345 100644
--- a/fs/ecryptfs/keystore.c
+++ b/fs/ecryptfs/keystore.c
@@ -234,8 +234,8 @@ parse_tag_65_packet(struct ecryptfs_session_key *session_key, u8 *cipher_code,
234 } 234 }
235 i += data_len; 235 i += data_len;
236 if (message_len < (i + m_size)) { 236 if (message_len < (i + m_size)) {
237 ecryptfs_printk(KERN_ERR, "The received netlink message is " 237 ecryptfs_printk(KERN_ERR, "The message received from ecryptfsd "
238 "shorter than expected\n"); 238 "is shorter than expected\n");
239 rc = -EIO; 239 rc = -EIO;
240 goto out; 240 goto out;
241 } 241 }
@@ -438,8 +438,8 @@ decrypt_pki_encrypted_session_key(struct ecryptfs_auth_tok *auth_tok,
438 struct ecryptfs_msg_ctx *msg_ctx; 438 struct ecryptfs_msg_ctx *msg_ctx;
439 struct ecryptfs_message *msg = NULL; 439 struct ecryptfs_message *msg = NULL;
440 char *auth_tok_sig; 440 char *auth_tok_sig;
441 char *netlink_message; 441 char *payload;
442 size_t netlink_message_length; 442 size_t payload_len;
443 int rc; 443 int rc;
444 444
445 rc = ecryptfs_get_auth_tok_sig(&auth_tok_sig, auth_tok); 445 rc = ecryptfs_get_auth_tok_sig(&auth_tok_sig, auth_tok);
@@ -449,15 +449,15 @@ decrypt_pki_encrypted_session_key(struct ecryptfs_auth_tok *auth_tok,
449 goto out; 449 goto out;
450 } 450 }
451 rc = write_tag_64_packet(auth_tok_sig, &(auth_tok->session_key), 451 rc = write_tag_64_packet(auth_tok_sig, &(auth_tok->session_key),
452 &netlink_message, &netlink_message_length); 452 &payload, &payload_len);
453 if (rc) { 453 if (rc) {
454 ecryptfs_printk(KERN_ERR, "Failed to write tag 64 packet\n"); 454 ecryptfs_printk(KERN_ERR, "Failed to write tag 64 packet\n");
455 goto out; 455 goto out;
456 } 456 }
457 rc = ecryptfs_send_message(ecryptfs_transport, netlink_message, 457 rc = ecryptfs_send_message(payload, payload_len, &msg_ctx);
458 netlink_message_length, &msg_ctx);
459 if (rc) { 458 if (rc) {
460 ecryptfs_printk(KERN_ERR, "Error sending netlink message\n"); 459 ecryptfs_printk(KERN_ERR, "Error sending message to "
460 "ecryptfsd\n");
461 goto out; 461 goto out;
462 } 462 }
463 rc = ecryptfs_wait_for_response(msg_ctx, &msg); 463 rc = ecryptfs_wait_for_response(msg_ctx, &msg);
@@ -1333,23 +1333,22 @@ pki_encrypt_session_key(struct ecryptfs_auth_tok *auth_tok,
1333 struct ecryptfs_key_record *key_rec) 1333 struct ecryptfs_key_record *key_rec)
1334{ 1334{
1335 struct ecryptfs_msg_ctx *msg_ctx = NULL; 1335 struct ecryptfs_msg_ctx *msg_ctx = NULL;
1336 char *netlink_payload; 1336 char *payload = NULL;
1337 size_t netlink_payload_length; 1337 size_t payload_len;
1338 struct ecryptfs_message *msg; 1338 struct ecryptfs_message *msg;
1339 int rc; 1339 int rc;
1340 1340
1341 rc = write_tag_66_packet(auth_tok->token.private_key.signature, 1341 rc = write_tag_66_packet(auth_tok->token.private_key.signature,
1342 ecryptfs_code_for_cipher_string(crypt_stat), 1342 ecryptfs_code_for_cipher_string(crypt_stat),
1343 crypt_stat, &netlink_payload, 1343 crypt_stat, &payload, &payload_len);
1344 &netlink_payload_length);
1345 if (rc) { 1344 if (rc) {
1346 ecryptfs_printk(KERN_ERR, "Error generating tag 66 packet\n"); 1345 ecryptfs_printk(KERN_ERR, "Error generating tag 66 packet\n");
1347 goto out; 1346 goto out;
1348 } 1347 }
1349 rc = ecryptfs_send_message(ecryptfs_transport, netlink_payload, 1348 rc = ecryptfs_send_message(payload, payload_len, &msg_ctx);
1350 netlink_payload_length, &msg_ctx);
1351 if (rc) { 1349 if (rc) {
1352 ecryptfs_printk(KERN_ERR, "Error sending netlink message\n"); 1350 ecryptfs_printk(KERN_ERR, "Error sending message to "
1351 "ecryptfsd\n");
1353 goto out; 1352 goto out;
1354 } 1353 }
1355 rc = ecryptfs_wait_for_response(msg_ctx, &msg); 1354 rc = ecryptfs_wait_for_response(msg_ctx, &msg);
@@ -1364,8 +1363,7 @@ pki_encrypt_session_key(struct ecryptfs_auth_tok *auth_tok,
1364 ecryptfs_printk(KERN_ERR, "Error parsing tag 67 packet\n"); 1363 ecryptfs_printk(KERN_ERR, "Error parsing tag 67 packet\n");
1365 kfree(msg); 1364 kfree(msg);
1366out: 1365out:
1367 if (netlink_payload) 1366 kfree(payload);
1368 kfree(netlink_payload);
1369 return rc; 1367 return rc;
1370} 1368}
1371/** 1369/**