crypto: ahash - remove support for nonzero alignmask
[linux-2.6-block.git] / crypto / shash.c
index 409b33f9c97cc1013a14780cec4b13cc9ab06f7a..359702c2cd02bf07455c4662ddf4ec0031dd5b49 100644 (file)
@@ -541,6 +541,10 @@ int hash_prepare_alg(struct hash_alg_common *alg)
        if (alg->digestsize > HASH_MAX_DIGESTSIZE)
                return -EINVAL;
 
+       /* alignmask is not useful for hashes, so it is not supported. */
+       if (base->cra_alignmask)
+               return -EINVAL;
+
        base->cra_flags &= ~CRYPTO_ALG_TYPE_MASK;
 
        if (IS_ENABLED(CONFIG_CRYPTO_STATS))
@@ -557,10 +561,6 @@ static int shash_prepare_alg(struct shash_alg *alg)
        if (alg->descsize > HASH_MAX_DESCSIZE)
                return -EINVAL;
 
-       /* alignmask is not useful for shash, so it is not supported. */
-       if (base->cra_alignmask)
-               return -EINVAL;
-
        if ((alg->export && !alg->import) || (alg->import && !alg->export))
                return -EINVAL;