Skip to content

sha2/sha2.c: fix build on big endian#37

Merged
obgm merged 1 commit into
eclipse-tinydtls:developfrom
ffontaine:develop
Jun 22, 2020
Merged

sha2/sha2.c: fix build on big endian#37
obgm merged 1 commit into
eclipse-tinydtls:developfrom
ffontaine:develop

Conversation

@ffontaine
Copy link
Copy Markdown
Contributor

@ffontaine ffontaine commented Jun 20, 2020

Build is broken since 865ec9b because tmp is undefined in put32be and put64be:

/home/buildroot/autobuild/instance-1/output-1/host/bin/m68k-linux-gcc -DSHA2_USE_INTTYPES_H -Wall -std=c99 -pedantic -fPIC -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -DDTLSv12 -DWITH_SHA256 -I..  -c -o sha2.o sha2.c
sha2.c: In function 'get32be':
sha2.c:164:2: warning: implicit declaration of function 'MEMCPY_BCOPY' [-Wimplicit-function-declaration]
  MEMCPY_BCOPY(&tmp, data, sizeof(tmp));
  ^~~~~~~~~~~~
sha2.c: In function 'put32be':
sha2.c:177:34: error: 'tmp' undeclared (first use in this function)
  MEMCPY_BCOPY(data, &val, sizeof(tmp));
                                  ^~~

Fix this error by replacing tmp by val

Moreover, move MEMCPY_BCOPY before its usage or linking step will fail

Fixes:

Signed-off-by: Fabrice Fontaine fontaine.fabrice@gmail.com

Build is broken since 865ec9b because
tmp is undefined in put32be and put64be:

/home/buildroot/autobuild/instance-1/output-1/host/bin/m68k-linux-gcc -DSHA2_USE_INTTYPES_H -Wall -std=c99 -pedantic -fPIC -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -DDTLSv12 -DWITH_SHA256 -I..  -c -o sha2.o sha2.c
sha2.c: In function 'get32be':
sha2.c:164:2: warning: implicit declaration of function 'MEMCPY_BCOPY' [-Wimplicit-function-declaration]
  MEMCPY_BCOPY(&tmp, data, sizeof(tmp));
  ^~~~~~~~~~~~
sha2.c: In function 'put32be':
sha2.c:177:34: error: 'tmp' undeclared (first use in this function)
  MEMCPY_BCOPY(data, &val, sizeof(tmp));
                                  ^~~

Fix this error by replacing tmp by val

Moreover, move MEMCPY_BCOPY before its usage or linking step will fail

Fixes:
 - http://autobuild.buildroot.org/results/e8704e02fdede7b63e22da552292977b23380b32

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
@obgm obgm merged commit b91cce5 into eclipse-tinydtls:develop Jun 22, 2020
@ffontaine ffontaine deleted the develop branch June 22, 2020 08:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants