Re: [PATCH 12/12: eCryptfs] Crypto functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 2 Nov 2005, Phillip Hellewell wrote:

> +	crypto_cipher_setkey(crypt_stats->tfm, crypt_stats->key,
> +			     crypt_stats->key_size_bits / 8);

Check return value.

> +static void generate_random_key(unsigned char *key, int num_bytes)
> +{
> +	get_random_bytes(key, num_bytes);
> +}

Call get_random_bytes() directly.

> +	if (likely(1 == crypt_stats->encrypted)) {
> +		if (!crypt_stats->key_valid) {
> +			ecryptfs_printk(1, KERN_NOTICE, "Key is "
> +					"invalid; bailing out\n");
> +			rc = -EINVAL;
> +			goto out;
> +		}
> +	} else {
> +		rc = -EINVAL;
> +		ecryptfs_printk(0, KERN_WARNING,
> +				"Called with crypt_stats->encrypted == 0\n");
> +		goto out;
> +	}

What's going on here?  Is (crypt_stats->encrypted != 1) a kernel bug?


- James
-- 
James Morris
<[email protected]>
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux