
The SHA512 implementation shipped with usign uses a wrong hardcoded numeric constant in the final block padding code. An additional transform step must be done when there are at least SHA512_BLOCK_SIZE - 16 = 112 bytes in the state buffer, however the existing code incorrectly transformed buffer data larger than or equal to 110 bytes as well, resulting in invalid hash calculations when exactly 110 or 111 remaining bytes were left in the buffer. To reproduce the issue, sign a plaintext file with a size of exactly 128 * N + 64 + 110 or 128 * N + 64 + 111 bytes using signify-openbsd and attempt to verify the signature using usign: $ signify-openbsd -G -n -p test.pub -s test.key $ dd if=/dev/zero of=test.msg bs=1 count=$((64 + 110)) $ signify-openbsd -S -x test.sig -s test.key -m test.msg $ usign -V -p test.pub -x test.sig -m test.msg Fix this issue by replacing the bad numeric constanct with a macro expression resulting in the proper value. The fix has been verified by cross checking the intermedia hash results with results from OpenSSL's SHA512 implementation and by comparing the usign SHA512 code with the hashing code shipped with signify-openbsd. Ref: https://forum.openwrt.org/t/signature-check-failed/41945 Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Usign provides public key signatures using the ed25519 algorithm. The home page for the algorithm is http://ed25519.cr.yp.to/. It is described in the following paper: Daniel J. Bernstein, Niels Duif, Tanja Lange, Peter Schwabe, Bo-Yin Yang High-speed high-security signatures Journal of Cryptographic Engineering 2 (2012), 77-89 2011-09-26 http://ed25519.cr.yp.to/ed25519-20110926.pdf Signatures and keys are compatible to OpenBSD's signify utility: http://man.openbsd.org/OpenBSD-current/man1/signify.1 To build and install the package run mkdir build cd build cmake .. make sudo make install
Description
Languages
C
99.1%
CMake
0.9%