BLAKE2 / libb2

C library providing BLAKE2b, BLAKE2s, BLAKE2bp, BLAKE2sp
Creative Commons Zero v1.0 Universal
132 stars 47 forks source link

Build/Test failures on mips/s390x #9

Closed LocutusOfBorg closed 6 years ago

LocutusOfBorg commented 6 years ago

this is on mips

make[3]: Leaving directory '/<<PKGBUILDDIR>>/src'
make  check-TESTS
make[3]: Entering directory '/<<PKGBUILDDIR>>/src'
make[4]: Entering directory '/<<PKGBUILDDIR>>/src'
PASS: blake2s-test
PASS: blake2b-test
PASS: blake2sp-test
FAIL: blake2bp-test
====================================
   libb2 0.97: src/test-suite.log
====================================

# TOTAL: 4
# PASS:  3
# SKIP:  0
# XFAIL: 0
# FAIL:  1
# XPASS: 0
# ERROR: 0

.. contents:: :depth: 2

FAIL: blake2bp-test
===================

and s390x

make  check-TESTS
make[3]: Entering directory '/<<PKGBUILDDIR>>/src'
make[4]: Entering directory '/<<PKGBUILDDIR>>/src'
PASS: blake2s-test
PASS: blake2b-test
FAIL: blake2bp-test
PASS: blake2sp-test
====================================
   libb2 0.97: src/test-suite.log
====================================

# TOTAL: 4
# PASS:  3
# SKIP:  0
# XFAIL: 0
# FAIL:  1
# XPASS: 0
# ERROR: 0

.. contents:: :depth: 2

FAIL: blake2bp-test
===================

error
FAIL blake2bp-test (exit status: 255)

============================================================================
Testsuite summary for libb2 0.97
============================================================================
# TOTAL: 4
# PASS:  3
# SKIP:  0
# XFAIL: 0
# FAIL:  1
# XPASS: 0
# ERROR: 0
============================================================================
See src/test-suite.log
Please report to contact@blake2.net

can you please help? seems some endianess issue

sneves commented 6 years ago

This does absolutely look like an endianess failure, though it's hard to track where it happens. Investigating..

sneves commented 6 years ago

OK, tracked down the issue. This had already been fixed in the reference code, but somehow remained here:

diff --git a/src/blake2bp.c b/src/blake2bp.c
index a861c6d..414f46e 100644
--- a/src/blake2bp.c
+++ b/src/blake2bp.c
@@ -33,7 +33,7 @@ static int blake2bp_init_leaf( blake2b_state *S, uint8_t outlen, uint8_t keylen,
   P->fanout = PARALLELISM_DEGREE;
   P->depth = 2;
   P->leaf_length = 0;
-  P->node_offset = offset;
+  store64(&P->node_offset, offset);
   P->node_depth = 0;
   P->inner_length = BLAKE2B_OUTBYTES;
   memset( P->reserved, 0, sizeof( P->reserved ) );
LocutusOfBorg commented 6 years ago

thanks!