History

crypto: shash - Move null setkey check to registration time

This patch moves the run-time null setkey check to shash_prepare_alg just like we did for finup/digest.

Herbert Xu committed 17 years ago

Commit 57cfe441 parent 7d024601 file · +8 −3Browse files

Unified · Split

crypto/shash.c+8−3
@@ -22,6 +22,12 @@ · 21 unmodified lines
2222
2323 static const struct crypto_type crypto_shash_type;
2424
25+static int shash_no_setkey(struct crypto_shash *tfm, const u8 *key,
26+ unsigned int keylen)
27+{
28+ return -ENOSYS;
29+}
30+
2531 static int shash_setkey_unaligned(struct crypto_shash *tfm, const u8 *key,
2632 unsigned int keylen)
2733 {
@@ -50,9 +56,6 @@ int crypto_shash_setkey(struct crypto_shash *tfm, const u8 *key, · 22 unmodified lines
5056 struct shash_alg *shash = crypto_shash_alg(tfm);
5157 unsigned long alignmask = crypto_shash_alignmask(tfm);
5258
53− if (!shash->setkey)
54− return -ENOSYS;
55−
5659 if ((unsigned long)key & alignmask)
5760 return shash_setkey_unaligned(tfm, key, keylen);
5861
@@ -494,6 +497,8 @@ static int shash_prepare_alg(struct shash_alg *alg) · 435 unmodified lines
494497 alg->import = shash_no_import;
495498 if (!alg->export)
496499 alg->export = shash_no_export;
500+ if (!alg->setkey)
501+ alg->setkey = shash_no_setkey;
497502
498503 return 0;
499504 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t