X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=crypto%2Fshash.c;h=0a0a50cb694f0ebb1fa7a27cca5ec6225f86ec60;hb=refs%2Fheads%2Faccepted%2Ftizen_7.0_unified;hp=2e3433ad97629741727126988b8a91edae7c1495;hpb=0520058d0578c2924b1571c16281f873cb4a3d2b;p=platform%2Fkernel%2Flinux-rpi.git diff --git a/crypto/shash.c b/crypto/shash.c index 2e3433a..0a0a50c 100644 --- a/crypto/shash.c +++ b/crypto/shash.c @@ -20,12 +20,24 @@ static const struct crypto_type crypto_shash_type; -int shash_no_setkey(struct crypto_shash *tfm, const u8 *key, - unsigned int keylen) +static int shash_no_setkey(struct crypto_shash *tfm, const u8 *key, + unsigned int keylen) { return -ENOSYS; } -EXPORT_SYMBOL_GPL(shash_no_setkey); + +/* + * Check whether an shash algorithm has a setkey function. + * + * For CFI compatibility, this must not be an inline function. This is because + * when CFI is enabled, modules won't get the same address for shash_no_setkey + * (if it were exported, which inlining would require) as the core kernel will. + */ +bool crypto_shash_alg_has_setkey(struct shash_alg *alg) +{ + return alg->setkey != shash_no_setkey; +} +EXPORT_SYMBOL_GPL(crypto_shash_alg_has_setkey); static int shash_setkey_unaligned(struct crypto_shash *tfm, const u8 *key, unsigned int keylen)