Add new option WARNING_TO_ERROR for CMakeLists.txt and tests/CMakelist.txt
and update github workflows to use it.
Do the cmake in a sub-directory.
Fix warnings generated by mac-os build in dtls.c and sha2.c.
Signed-off-by: Jon Shallow <supjps-libcoap@jpshallow.com>
The functions dtls_sha*_final() and dtls_sha*_end() need to clean the
state buffer (context) at the end. To clean the entire buffer properly,
the pointer passed to sizeof() needs to be dereferenced.
Fix all the compile warnings generated following adding WARNING_CFLAGS
to all the Makefile.in files.
Fix tests/unit-tests/testdriver failures caused by dtls_prng() return value.
Signed-off-by: Jon Shallow <supjps-libcoap@jpshallow.com>
make uninstall deletes all files that would have been installed
by make install and removes the directories make install would
have created. Directories that are not empty after uninstalling
the files will be preserved.
Change-Id: I53587dfd765e112e99fb6ab078a33a6174828987
Build is broken since 865ec9ba1d 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>
dtls_sha256_transform() fails for esp-idf systems as the data parameter
is a uint32 and may not be aligned to a word boundary when
processing the server-hello handshake.
sha2/sha2.c:
Make the data parameter byte aligned (as does most other sha256
implementations) for function dtls_sha{256|512}_transform().
Replace REVERSE32 and REVERSE64 macros with get32be(), put32be(),
get64be() and put64be() functions which are byte aligned.
Remove some of the now unneeded "#if BYTE_ORDER == LITTLE_ENDIAN".
sha2/sha2.h:
Allow sha384 to be built (not been tested).
Signed-off-by: Jon Shallow <supjps-libcoap@jpshallow.com>
dtls.c:
Add in const for dtls_handshake_type_to_name()
dtls_debug.[ch]:
Add in const where appropriate for dsrv_log().
In addition, get dsrv_log() to check printf syntax.
sha2/sha2.c:
Re-order "const static" to "static const" and add in needed const.
Signed-off-by: Jon Shallow <supjps-libcoap@jpshallow.com>
By default the code in sha2/ uses u_intXX_t types which are not mandated
by POSIX. To make it use the uintXX_t types mandated by POSIX.1‐2008
the code needs to be compiled with `-DSHA2_USE_INTTYPES_H` which ensures
that `inittypes.h` is included (even though the correct header to
include here would be `stdint.h`).
A better solution to this would probably be adjusting the code in sha2/
in a way that ensures that uintXX_t types are always used. This approach
was taken because it was easier to implemented.
This fixes the build on musl libc based linux systems and increases the
portability of the code base.
Change-Id: I3837ad239e09cff45da199ecfee7789a889d9fc7
Signed-off-by: Sören Tempel <tempel@uni-bremen.de>
Signed-off-by: Olaf Bergmann <bergmann@tzi.org>
When configured for a different host, the variables CC, AR and
RANLIB have not been set correctly. With this fix, tinydtls can
be compiled for another platform when it is configured as a
submodule of an automake-enabled project.
For example, when the dtls branch of libcoap[1] can be cross-compiled
for the raspberry pi as follows:
./configure --with-host=arm-linux-gnueabihf --disable-shared
Note that cross-compilation does not yet work without automake as the
m4 macro AM_PROG_AR depends on automake.
[1] https://github.com/obgm/libcoap/tree/dtls
Change-Id: If23080dc7754a48434e7ac787c0bddda1dd9530b
Use pointer arithmetics instead of taking the address of a
dereferenced array value to quiet warning about type punned pointer.
Change-Id: I6c833dafbf26502c8b4d132f21a733cc4f133bdb
Fixes dtls_config.h not visible in headers
Include dtls_config.h in tinydtls.h and include tinydtls.h in all necessary
headers.
Remaining headers do not use 'ifdef', but they may require it too.
Change-Id: I39c86dffc8bbc8bd7551e74386994f92f49d00ec
Signed-off-by: Gaëtan Harter <gaetan.harter@inria.fr>
this change is for resolving |sha2| symbol-conflict in using
|tinydtls| with other crypto modules. this symbol-conflict could
occur on the |tinydtls|-deployed systems with using |OpenSSL| or
|OpenSSL|-like, which has another |SHA| symbols.
In case of |iotivity-tinydtls|, the conflict occurs between
|iotivity-tinydtls| and the deployed |crypto| library, which has
also another |SHA|.
[patch #1] initial commit
[patch #2-3] updated commit message
[patch #4] reverted renaming for internal symbols
[patch #5] updated symbols with lower-case
[patch #6] fixed typo for calling API
bugs: https://bugs.eclipse.org/bugs/show_bug.cgi?id=490467
Change-Id: I6942870c7c31544e89a20209d21730406ffb08d2
Signed-off-by: Kyungsun Cho <goodsun.cho@samsung.com>