Commit e44a1b44c3a9794236fe038b89a0fbef5adcd523
Committed by
Herbert Xu
1 parent
2f8174187f
Exists in
master
and in
4 other branches
crypto: testmgr - Handle AEAD test vectors expected to fail verification
Add infrastructure to tcrypt/testmgr to support handling ccm decryption test vectors that are expected to fail verification. Signed-off-by: Jarod Wilson <jarod@redhat.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Showing 2 changed files with 29 additions and 0 deletions Side-by-side Diff
crypto/testmgr.c
... | ... | @@ -363,6 +363,16 @@ |
363 | 363 | |
364 | 364 | switch (ret) { |
365 | 365 | case 0: |
366 | + if (template[i].novrfy) { | |
367 | + /* verification was supposed to fail */ | |
368 | + printk(KERN_ERR "alg: aead: %s failed " | |
369 | + "on test %d for %s: ret was 0, " | |
370 | + "expected -EBADMSG\n", | |
371 | + e, j, algo); | |
372 | + /* so really, we got a bad message */ | |
373 | + ret = -EBADMSG; | |
374 | + goto out; | |
375 | + } | |
366 | 376 | break; |
367 | 377 | case -EINPROGRESS: |
368 | 378 | case -EBUSY: |
... | ... | @@ -372,6 +382,10 @@ |
372 | 382 | INIT_COMPLETION(result.completion); |
373 | 383 | break; |
374 | 384 | } |
385 | + case -EBADMSG: | |
386 | + if (template[i].novrfy) | |
387 | + /* verification failure was expected */ | |
388 | + continue; | |
375 | 389 | /* fall through */ |
376 | 390 | default: |
377 | 391 | printk(KERN_ERR "alg: aead: %s failed on test " |
... | ... | @@ -481,6 +495,16 @@ |
481 | 495 | |
482 | 496 | switch (ret) { |
483 | 497 | case 0: |
498 | + if (template[i].novrfy) { | |
499 | + /* verification was supposed to fail */ | |
500 | + printk(KERN_ERR "alg: aead: %s failed " | |
501 | + "on chunk test %d for %s: ret " | |
502 | + "was 0, expected -EBADMSG\n", | |
503 | + e, j, algo); | |
504 | + /* so really, we got a bad message */ | |
505 | + ret = -EBADMSG; | |
506 | + goto out; | |
507 | + } | |
484 | 508 | break; |
485 | 509 | case -EINPROGRESS: |
486 | 510 | case -EBUSY: |
... | ... | @@ -490,6 +514,10 @@ |
490 | 514 | INIT_COMPLETION(result.completion); |
491 | 515 | break; |
492 | 516 | } |
517 | + case -EBADMSG: | |
518 | + if (template[i].novrfy) | |
519 | + /* verification failure was expected */ | |
520 | + continue; | |
493 | 521 | /* fall through */ |
494 | 522 | default: |
495 | 523 | printk(KERN_ERR "alg: aead: %s failed on " |