• Eric Biggers's avatar
    crypto: testmgr - test the shash API · d8ea98aa
    Eric Biggers authored
    For hash algorithms implemented using the "shash" algorithm type, test
    both the ahash and shash APIs, not just the ahash API.
    
    Testing the ahash API already tests the shash API indirectly, which is
    normally good enough.  However, there have been corner cases where there
    have been shash bugs that don't get exposed through the ahash API.  So,
    update testmgr to test the shash API too.
    
    This would have detected the arm64 SHA-1 and SHA-2 bugs for which fixes
    were just sent out (https://patchwork.kernel.org/patch/10964843/ and
    https://patchwork.kernel.org/patch/10965089/):
    
        alg: shash: sha1-ce test failed (wrong result) on test vector 0, cfg="init+finup aligned buffer"
        alg: shash: sha224-ce test failed (wrong result) on test vector 0, cfg="init+finup aligned buffer"
        alg: shash: sha256-ce test failed (wrong result) on test vector 0, cfg="init+finup aligned buffer"
    
    This also would have detected the bugs fixed by commit 307508d1
    ("crypto: crct10dif-generic - fix use via crypto_shash_digest()") and
    commit dec3d0b1
    ("crypto: x86/crct10dif-pcl - fix use via crypto_shash_digest()").
    Signed-off-by: default avatarEric Biggers <ebiggers@google.com>
    Acked-by: default avatarArd Biesheuvel <ard.biesheuvel@linaro.org>
    Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
    d8ea98aa
testmgr.c 133 KB