Merge tag 'keys-acl-20190703' of git://git.kernel.org/pub/scm/linux/kernel/git/dhowel...
[linux-2.6-microblaze.git] / security / integrity / evm / evm_crypto.c
index 304cb0b..466eebd 100644 (file)
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0-only
 /*
  * Copyright (C) 2005-2010 IBM Corporation
  *
@@ -5,10 +6,6 @@
  * Mimi Zohar <zohar@us.ibm.com>
  * Kylene Hall <kjhall@us.ibm.com>
  *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, version 2 of the License.
- *
  * File: evm_crypto.c
  *      Using root's kernel master key (kmk), calculate the HMAC
  */
@@ -89,6 +86,9 @@ static struct shash_desc *init_desc(char type, uint8_t hash_algo)
                tfm = &hmac_tfm;
                algo = evm_hmac;
        } else {
+               if (hash_algo >= HASH_ALGO__LAST)
+                       return ERR_PTR(-EINVAL);
+
                tfm = &evm_tfm[hash_algo];
                algo = hash_algo_name[hash_algo];
        }