@@ -87,8 +87,13 @@
/*
* The algorithm may allocate memory during request processing, i.e. during
- * encryption, decryption, or hashing. Users can request an algorithm with this
- * flag unset if they can't handle memory allocation failures.
+ * encryption, decryption, or hashing. Algorithms that do not set this flag will
+ * guarantee that memory is not allocated during request processing, except in
+ * the avoidable exception cases described below.
+ *
+ * Users can request an algorithm with this flag unset if they can't handle
+ * memory allocation failures or sleeping during request processing. They should
+ * also follow the constraints below.
*
* This flag is currently only implemented for algorithms of type "skcipher",
* "aead", "ahash", "shash", and "cipher". Algorithms of other types might not
@@ -102,6 +107,9 @@
* - If the data were to be divided into chunks of size
* crypto_skcipher_walksize() (with any remainder going at the end), no
* chunk can cross a page boundary or a scatterlist element boundary.
+ * - The input and output scatterlists must have no more than 4 entries.
+ * If the scatterlists contain more than 4 entries, the algorithm may
+ * allocate memory.
* aead:
* - The IV buffer and all scatterlist elements must be aligned to the
* algorithm's alignmask.
@@ -110,10 +118,16 @@
* - If the plaintext/ciphertext were to be divided into chunks of size
* crypto_aead_walksize() (with the remainder going at the end), no chunk
* can cross a page boundary or a scatterlist element boundary.
+ * - The input and output scatterlists must have no more than 4 entries.
+ * If the scatterlists contain more than 4 entries, the algorithm may
+ * allocate memory.
* ahash:
* - The result buffer must be aligned to the algorithm's alignmask.
* - crypto_ahash_finup() must not be used unless the algorithm implements
* ->finup() natively.
+ * - The input and output scatterlists must have no more than 4 entries.
+ * If the scatterlists contain more than 4 entries, the algorithm may
+ * allocate memory.
*/
#define CRYPTO_ALG_ALLOCATES_MEMORY 0x00010000