diff options
| -rw-r--r-- | crypto/testmgr.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/crypto/testmgr.c b/crypto/testmgr.c index 0b01c3d062e2..62dffa0028ac 100644 --- a/crypto/testmgr.c +++ b/crypto/testmgr.c | |||
| @@ -209,16 +209,19 @@ static int ahash_partial_update(struct ahash_request **preq, | |||
| 209 | char *state; | 209 | char *state; |
| 210 | struct ahash_request *req; | 210 | struct ahash_request *req; |
| 211 | int statesize, ret = -EINVAL; | 211 | int statesize, ret = -EINVAL; |
| 212 | const char guard[] = { 0x00, 0xba, 0xad, 0x00 }; | ||
| 212 | 213 | ||
| 213 | req = *preq; | 214 | req = *preq; |
| 214 | statesize = crypto_ahash_statesize( | 215 | statesize = crypto_ahash_statesize( |
| 215 | crypto_ahash_reqtfm(req)); | 216 | crypto_ahash_reqtfm(req)); |
| 216 | state = kmalloc(statesize, GFP_KERNEL); | 217 | state = kmalloc(statesize + sizeof(guard), GFP_KERNEL); |
| 217 | if (!state) { | 218 | if (!state) { |
| 218 | pr_err("alt: hash: Failed to alloc state for %s\n", algo); | 219 | pr_err("alt: hash: Failed to alloc state for %s\n", algo); |
| 219 | goto out_nostate; | 220 | goto out_nostate; |
| 220 | } | 221 | } |
| 222 | memcpy(state + statesize, guard, sizeof(guard)); | ||
| 221 | ret = crypto_ahash_export(req, state); | 223 | ret = crypto_ahash_export(req, state); |
| 224 | WARN_ON(memcmp(state + statesize, guard, sizeof(guard))); | ||
| 222 | if (ret) { | 225 | if (ret) { |
| 223 | pr_err("alt: hash: Failed to export() for %s\n", algo); | 226 | pr_err("alt: hash: Failed to export() for %s\n", algo); |
| 224 | goto out; | 227 | goto out; |
