crypto: atmel-aes - Use gcm helper to check authsize
authorTudor Ambarus <tudor.ambarus@microchip.com>
Thu, 5 Dec 2019 09:54:08 +0000 (09:54 +0000)
committerHerbert Xu <herbert@gondor.apana.org.au>
Wed, 11 Dec 2019 08:46:23 +0000 (16:46 +0800)
Use core helper functions.

Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/atmel-aes.c

index e1b6b82cc5b036d3844cd4134cf8d197dea804a7..173a30b7661b16721dc10f1fb05b975c787b2f85 100644 (file)
@@ -1789,21 +1789,7 @@ static int atmel_aes_gcm_setkey(struct crypto_aead *tfm, const u8 *key,
 static int atmel_aes_gcm_setauthsize(struct crypto_aead *tfm,
                                     unsigned int authsize)
 {
-       /* Same as crypto_gcm_authsize() from crypto/gcm.c */
-       switch (authsize) {
-       case 4:
-       case 8:
-       case 12:
-       case 13:
-       case 14:
-       case 15:
-       case 16:
-               break;
-       default:
-               return -EINVAL;
-       }
-
-       return 0;
+       return crypto_gcm_check_authsize(authsize);
 }
 
 static int atmel_aes_gcm_encrypt(struct aead_request *req)