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

Michael Halcrow
2005-11-04T00:18:18Z

On Thu, Nov 03, 2005 at 07:08:46PM -0500, James Morris wrote:
> > + 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?

If ecryptfs_write_headers() is ever called on an unencrypted file,
then that is a programming error in eCryptfs. This will need to be
replaced with a BUG_ON().

Mike