lkml.org 
[lkml]   [2004]   [Feb]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subjectcryptoapi OMAC (was: cryptoapi highmem bug)
On Wed, Feb 25, 2004 at 11:09:35AM -0500, Jean-Luc Cooke wrote:

> http://jlcooke.ca/lkml/crypto_24feb2004.patch will work.

It didn't compile. I fixed some compile problems so that it works.
I have disabled CRYPTO_OMAC though. And it goes boom when calling
hmac_init (or something like that), the machine halts without Oops.

I've seen the cit_omac is kmalloc'ed. Hmm. Didn't we want to try
to avoid that? Well. Perhaps it should be allocated when the
omac_init is called and freed after omac_final.

Or what about this:
If the user wants OMAC he calls omac_init and passes a pointer to
a buffer where the omac will be computed. omac_init then sets
the omac_update function so that xxx_process will call it. After
the encryption is finished the user calls omac_final and finds
the omac in his buffer.

And shouldn't the omac functions be put into a separate omac.c?

Moving the scatterwalk functions seems like a good idea to me.

Well, here are the compile fixes:

diff -Nur linux.orig/crypto/cipher.c linux/crypto/cipher.c
--- linux.orig/crypto/cipher.c 2004-02-25 18:58:22.955601768 +0100
+++ linux/crypto/cipher.c 2004-02-25 18:59:30.970261968 +0100
@@ -280,7 +280,7 @@
/* mac = Zeros */
memset((u8*)tfm->crt_u.cipher.cit_omac, 0, crypto_tfm_alg_blocksize(tfm));
}
-#endif
+#endif /* CONFIG_CRYPTO_OMAC */

return ret;
}
@@ -475,9 +475,12 @@
ops->cit_iv = kmalloc(ops->cit_ivsize, GFP_KERNEL);
if (ops->cit_iv == NULL)
ret = -ENOMEM;
+
+#ifdef CONFIG_CRYPTO_OMAC
ops->cit_omac = kmalloc(ops->cit_ivsize, GFP_KERNEL);
if (ops->cit_omac == NULL)
ret = -ENOMEM;
+#endif /* CONFIG_CRYPTO_OMAC */
}

#ifdef CONFIG_CRYPTO_OMAC
@@ -499,5 +502,5 @@
#ifdef CONFIG_CRYPTO_OMAC
if (tfm->crt_cipher.cit_omac)
kfree(tfm->crt_cipher.cit_omac);
-#endif
+#endif /* CONFIG_CRYPTO_OMAC */
}
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2005-03-22 14:01    [from the cache]
©2003-2011 Jasper Spaans