• Home
  • Raw
  • Download

Lines Matching refs:s

629 	struct ecryptfs_write_tag_70_packet_silly_stack *s;  in ecryptfs_write_tag_70_packet()  local
633 s = kmalloc(sizeof(*s), GFP_KERNEL); in ecryptfs_write_tag_70_packet()
634 if (!s) { in ecryptfs_write_tag_70_packet()
636 "[%zd] bytes of kernel memory\n", __func__, sizeof(*s)); in ecryptfs_write_tag_70_packet()
640 s->desc.flags = CRYPTO_TFM_REQ_MAY_SLEEP; in ecryptfs_write_tag_70_packet()
644 &s->auth_tok, mount_crypt_stat, in ecryptfs_write_tag_70_packet()
653 &s->desc.tfm, in ecryptfs_write_tag_70_packet()
654 &s->tfm_mutex, mount_crypt_stat->global_default_fn_cipher_name); in ecryptfs_write_tag_70_packet()
661 mutex_lock(s->tfm_mutex); in ecryptfs_write_tag_70_packet()
662 s->block_size = crypto_blkcipher_blocksize(s->desc.tfm); in ecryptfs_write_tag_70_packet()
665 s->num_rand_bytes = (ECRYPTFS_FILENAME_MIN_RANDOM_PREPEND_BYTES + 1); in ecryptfs_write_tag_70_packet()
666 s->block_aligned_filename_size = (s->num_rand_bytes + filename_size); in ecryptfs_write_tag_70_packet()
667 if ((s->block_aligned_filename_size % s->block_size) != 0) { in ecryptfs_write_tag_70_packet()
668 s->num_rand_bytes += (s->block_size in ecryptfs_write_tag_70_packet()
669 - (s->block_aligned_filename_size in ecryptfs_write_tag_70_packet()
670 % s->block_size)); in ecryptfs_write_tag_70_packet()
671 s->block_aligned_filename_size = (s->num_rand_bytes in ecryptfs_write_tag_70_packet()
682 s->max_packet_size = (ECRYPTFS_TAG_70_MAX_METADATA_SIZE in ecryptfs_write_tag_70_packet()
683 + s->block_aligned_filename_size); in ecryptfs_write_tag_70_packet()
685 (*packet_size) = s->max_packet_size; in ecryptfs_write_tag_70_packet()
688 if (s->max_packet_size > (*remaining_bytes)) { in ecryptfs_write_tag_70_packet()
690 "[%zd] available\n", __func__, s->max_packet_size, in ecryptfs_write_tag_70_packet()
695 s->block_aligned_filename = kzalloc(s->block_aligned_filename_size, in ecryptfs_write_tag_70_packet()
697 if (!s->block_aligned_filename) { in ecryptfs_write_tag_70_packet()
700 s->block_aligned_filename_size); in ecryptfs_write_tag_70_packet()
704 s->i = 0; in ecryptfs_write_tag_70_packet()
705 dest[s->i++] = ECRYPTFS_TAG_70_PACKET_TYPE; in ecryptfs_write_tag_70_packet()
706 rc = ecryptfs_write_packet_length(&dest[s->i], in ecryptfs_write_tag_70_packet()
709 + s->block_aligned_filename_size), in ecryptfs_write_tag_70_packet()
710 &s->packet_size_len); in ecryptfs_write_tag_70_packet()
717 s->i += s->packet_size_len; in ecryptfs_write_tag_70_packet()
718 ecryptfs_from_hex(&dest[s->i], in ecryptfs_write_tag_70_packet()
721 s->i += ECRYPTFS_SIG_SIZE; in ecryptfs_write_tag_70_packet()
722 s->cipher_code = ecryptfs_code_for_cipher_string( in ecryptfs_write_tag_70_packet()
725 if (s->cipher_code == 0) { in ecryptfs_write_tag_70_packet()
733 dest[s->i++] = s->cipher_code; in ecryptfs_write_tag_70_packet()
736 if (s->auth_tok->token_type != ECRYPTFS_PASSWORD) { in ecryptfs_write_tag_70_packet()
743 &s->hash_sg, in ecryptfs_write_tag_70_packet()
744 (u8 *)s->auth_tok->token.password.session_key_encryption_key, in ecryptfs_write_tag_70_packet()
745 s->auth_tok->token.password.session_key_encryption_key_bytes); in ecryptfs_write_tag_70_packet()
746 s->hash_desc.flags = CRYPTO_TFM_REQ_MAY_SLEEP; in ecryptfs_write_tag_70_packet()
747 s->hash_desc.tfm = crypto_alloc_hash(ECRYPTFS_TAG_70_DIGEST, 0, in ecryptfs_write_tag_70_packet()
749 if (IS_ERR(s->hash_desc.tfm)) { in ecryptfs_write_tag_70_packet()
750 rc = PTR_ERR(s->hash_desc.tfm); in ecryptfs_write_tag_70_packet()
756 rc = crypto_hash_init(&s->hash_desc); in ecryptfs_write_tag_70_packet()
764 &s->hash_desc, &s->hash_sg, in ecryptfs_write_tag_70_packet()
765 s->auth_tok->token.password.session_key_encryption_key_bytes); in ecryptfs_write_tag_70_packet()
772 rc = crypto_hash_final(&s->hash_desc, s->hash); in ecryptfs_write_tag_70_packet()
779 for (s->j = 0; s->j < (s->num_rand_bytes - 1); s->j++) { in ecryptfs_write_tag_70_packet()
780 s->block_aligned_filename[s->j] = in ecryptfs_write_tag_70_packet()
781 s->hash[(s->j % ECRYPTFS_TAG_70_DIGEST_SIZE)]; in ecryptfs_write_tag_70_packet()
782 if ((s->j % ECRYPTFS_TAG_70_DIGEST_SIZE) in ecryptfs_write_tag_70_packet()
784 sg_init_one(&s->hash_sg, (u8 *)s->hash, in ecryptfs_write_tag_70_packet()
786 rc = crypto_hash_init(&s->hash_desc); in ecryptfs_write_tag_70_packet()
793 rc = crypto_hash_update(&s->hash_desc, &s->hash_sg, in ecryptfs_write_tag_70_packet()
801 rc = crypto_hash_final(&s->hash_desc, s->tmp_hash); in ecryptfs_write_tag_70_packet()
808 memcpy(s->hash, s->tmp_hash, in ecryptfs_write_tag_70_packet()
811 if (s->block_aligned_filename[s->j] == '\0') in ecryptfs_write_tag_70_packet()
812 s->block_aligned_filename[s->j] = ECRYPTFS_NON_NULL; in ecryptfs_write_tag_70_packet()
814 memcpy(&s->block_aligned_filename[s->num_rand_bytes], filename, in ecryptfs_write_tag_70_packet()
816 rc = virt_to_scatterlist(s->block_aligned_filename, in ecryptfs_write_tag_70_packet()
817 s->block_aligned_filename_size, s->src_sg, 2); in ecryptfs_write_tag_70_packet()
822 s->block_aligned_filename_size); in ecryptfs_write_tag_70_packet()
825 rc = virt_to_scatterlist(&dest[s->i], s->block_aligned_filename_size, in ecryptfs_write_tag_70_packet()
826 s->dst_sg, 2); in ecryptfs_write_tag_70_packet()
831 __func__, rc, s->block_aligned_filename_size); in ecryptfs_write_tag_70_packet()
838 memset(s->iv, 0, ECRYPTFS_MAX_IV_BYTES); in ecryptfs_write_tag_70_packet()
839 s->desc.info = s->iv; in ecryptfs_write_tag_70_packet()
841 s->desc.tfm, in ecryptfs_write_tag_70_packet()
842 s->auth_tok->token.password.session_key_encryption_key, in ecryptfs_write_tag_70_packet()
850 s->auth_tok->token.password.session_key_encryption_key, in ecryptfs_write_tag_70_packet()
854 rc = crypto_blkcipher_encrypt_iv(&s->desc, s->dst_sg, s->src_sg, in ecryptfs_write_tag_70_packet()
855 s->block_aligned_filename_size); in ecryptfs_write_tag_70_packet()
861 s->i += s->block_aligned_filename_size; in ecryptfs_write_tag_70_packet()
862 (*packet_size) = s->i; in ecryptfs_write_tag_70_packet()
865 crypto_free_hash(s->hash_desc.tfm); in ecryptfs_write_tag_70_packet()
867 kzfree(s->block_aligned_filename); in ecryptfs_write_tag_70_packet()
869 mutex_unlock(s->tfm_mutex); in ecryptfs_write_tag_70_packet()
875 kfree(s); in ecryptfs_write_tag_70_packet()
919 struct ecryptfs_parse_tag_70_packet_silly_stack *s; in ecryptfs_parse_tag_70_packet() local
926 s = kmalloc(sizeof(*s), GFP_KERNEL); in ecryptfs_parse_tag_70_packet()
927 if (!s) { in ecryptfs_parse_tag_70_packet()
929 "[%zd] bytes of kernel memory\n", __func__, sizeof(*s)); in ecryptfs_parse_tag_70_packet()
933 s->desc.flags = CRYPTO_TFM_REQ_MAY_SLEEP; in ecryptfs_parse_tag_70_packet()
957 &s->parsed_tag_70_packet_size, in ecryptfs_parse_tag_70_packet()
958 &s->packet_size_len); in ecryptfs_parse_tag_70_packet()
964 s->block_aligned_filename_size = (s->parsed_tag_70_packet_size in ecryptfs_parse_tag_70_packet()
966 if ((1 + s->packet_size_len + s->parsed_tag_70_packet_size) in ecryptfs_parse_tag_70_packet()
970 (1 + s->packet_size_len + 1 in ecryptfs_parse_tag_70_packet()
971 + s->block_aligned_filename_size)); in ecryptfs_parse_tag_70_packet()
975 (*packet_size) += s->packet_size_len; in ecryptfs_parse_tag_70_packet()
976 ecryptfs_to_hex(s->fnek_sig_hex, &data[(*packet_size)], in ecryptfs_parse_tag_70_packet()
978 s->fnek_sig_hex[ECRYPTFS_SIG_SIZE_HEX] = '\0'; in ecryptfs_parse_tag_70_packet()
980 s->cipher_code = data[(*packet_size)++]; in ecryptfs_parse_tag_70_packet()
981 rc = ecryptfs_cipher_code_to_string(s->cipher_string, s->cipher_code); in ecryptfs_parse_tag_70_packet()
984 __func__, s->cipher_code); in ecryptfs_parse_tag_70_packet()
988 &s->auth_tok, mount_crypt_stat, in ecryptfs_parse_tag_70_packet()
989 s->fnek_sig_hex); in ecryptfs_parse_tag_70_packet()
992 "fnek sig [%s]; rc = [%d]\n", __func__, s->fnek_sig_hex, in ecryptfs_parse_tag_70_packet()
996 rc = ecryptfs_get_tfm_and_mutex_for_cipher_name(&s->desc.tfm, in ecryptfs_parse_tag_70_packet()
997 &s->tfm_mutex, in ecryptfs_parse_tag_70_packet()
998 s->cipher_string); in ecryptfs_parse_tag_70_packet()
1002 s->cipher_string, rc); in ecryptfs_parse_tag_70_packet()
1005 mutex_lock(s->tfm_mutex); in ecryptfs_parse_tag_70_packet()
1007 s->block_aligned_filename_size, s->src_sg, 2); in ecryptfs_parse_tag_70_packet()
1012 __func__, rc, s->block_aligned_filename_size); in ecryptfs_parse_tag_70_packet()
1015 (*packet_size) += s->block_aligned_filename_size; in ecryptfs_parse_tag_70_packet()
1016 s->decrypted_filename = kmalloc(s->block_aligned_filename_size, in ecryptfs_parse_tag_70_packet()
1018 if (!s->decrypted_filename) { in ecryptfs_parse_tag_70_packet()
1021 s->block_aligned_filename_size); in ecryptfs_parse_tag_70_packet()
1025 rc = virt_to_scatterlist(s->decrypted_filename, in ecryptfs_parse_tag_70_packet()
1026 s->block_aligned_filename_size, s->dst_sg, 2); in ecryptfs_parse_tag_70_packet()
1031 __func__, rc, s->block_aligned_filename_size); in ecryptfs_parse_tag_70_packet()
1038 memset(s->iv, 0, ECRYPTFS_MAX_IV_BYTES); in ecryptfs_parse_tag_70_packet()
1039 s->desc.info = s->iv; in ecryptfs_parse_tag_70_packet()
1042 if (s->auth_tok->token_type != ECRYPTFS_PASSWORD) { in ecryptfs_parse_tag_70_packet()
1049 s->desc.tfm, in ecryptfs_parse_tag_70_packet()
1050 s->auth_tok->token.password.session_key_encryption_key, in ecryptfs_parse_tag_70_packet()
1058 s->auth_tok->token.password.session_key_encryption_key, in ecryptfs_parse_tag_70_packet()
1062 rc = crypto_blkcipher_decrypt_iv(&s->desc, s->dst_sg, s->src_sg, in ecryptfs_parse_tag_70_packet()
1063 s->block_aligned_filename_size); in ecryptfs_parse_tag_70_packet()
1069 s->i = 0; in ecryptfs_parse_tag_70_packet()
1070 while (s->decrypted_filename[s->i] != '\0' in ecryptfs_parse_tag_70_packet()
1071 && s->i < s->block_aligned_filename_size) in ecryptfs_parse_tag_70_packet()
1072 s->i++; in ecryptfs_parse_tag_70_packet()
1073 if (s->i == s->block_aligned_filename_size) { in ecryptfs_parse_tag_70_packet()
1080 s->i++; in ecryptfs_parse_tag_70_packet()
1081 (*filename_size) = (s->block_aligned_filename_size - s->i); in ecryptfs_parse_tag_70_packet()
1096 memcpy((*filename), &s->decrypted_filename[s->i], (*filename_size)); in ecryptfs_parse_tag_70_packet()
1099 kfree(s->decrypted_filename); in ecryptfs_parse_tag_70_packet()
1101 mutex_unlock(s->tfm_mutex); in ecryptfs_parse_tag_70_packet()
1112 kfree(s); in ecryptfs_parse_tag_70_packet()