Skip to content

sha256 digests do not match test vectors #4

@cyphar

Description

@cyphar

As part of debugging archiecobbs/nmtree#4, I have confirmed that the issue is that some part of the SHA256 hashing code in this library produces output that doesn't match any of the test vectors.

However, if you enable SHA2_UNROLL_TRANSFORM, the output is fixed. So there's some kind of bug in the non-unrolled transform. In archiecobbs/nmtree#4, I speculated that it was a porting bug, but there are no substantial changes from NetBSD to this port, so it seems possible this is a NetBSD bug (maybe they always use SHA2_UNROLL_TRANSFORM and thus have never hit this issue?).

I've opened #3 to add tests that check the output of the library implementations against known-good test vectors. If you run make check you'll find that all of the SHA256 test vectors fail, but if you run make CFLAGS="-DSHA2_UNROLL_TRANSFORM" check all of the tests pass.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions