Skip to content

Commit

Permalink
Quick-fixes 1.
Browse files Browse the repository at this point in the history
Signed-off-by: Achim Kraus <[email protected]>
  • Loading branch information
boaks committed Feb 26, 2024
1 parent 3dc62b1 commit 160a6d9
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ jobs:
CC: ["gcc", "clang" ]
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: setup
run: |
sudo apt-get update && sudo apt-get install -y libcunit1-dev libtool libtool-bin exuberant-ctags valgrind
Expand All @@ -48,6 +50,8 @@ jobs:

steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Build tinydtls
run: |
cmake -E make_directory build_test
Expand All @@ -60,6 +64,8 @@ jobs:

steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Build tinydtls
run: |
cmake -E make_directory build_test
Expand All @@ -73,6 +79,8 @@ jobs:

steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Build tinydtls
run: |
cmake -E make_directory build_test
Expand Down
6 changes: 4 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,13 @@ target_sources(tinydtls PRIVATE
aes/rijndael.c
aes/rijndael_wrap.c
sha2/sha2.c
ecc/ecc.c)
ext/micro-ecc/uECC.c)

target_include_directories(tinydtls PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR})
target_include_directories(tinydtls PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/ext/micro-ecc )
target_compile_definitions(tinydtls PUBLIC DTLSv12 WITH_SHA256 SHA2_USE_INTTYPES_H DTLS_CHECK_CONTENTTYPE)

set_source_files_properties(ext/micro-ecc/uECC.c PROPERTIES COMPILE_OPTIONS "-Wno-pedantic;-Wno-unused-parameter;-Wno-missing-prototypes;-Wno-missing-declarations;-Wno-unknown-pragmas")

if(CMAKE_GENERATOR MATCHES "Visual Studio")
option(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS "Export all symbols when compiling to a .dll" ON)
target_compile_options(tinydtls PRIVATE -Wall)
Expand Down
4 changes: 2 additions & 2 deletions crypto.c
Original file line number Diff line number Diff line change
Expand Up @@ -610,9 +610,10 @@ dtls_ecdsa_verify_sig_hash(const unsigned char *pub_key_x,
unsigned char *result_r, unsigned char *result_s) {
const dtls_ecdh_curve curve = default_curve;
uint8_t pub_key[2 * DTLS_EC_KEY_SIZE];
assert(sizeof(pub_key) >= (key_size * 2));
memcpy(pub_key, pub_key_x, key_size);
memcpy(pub_key + key_size, pub_key_y, key_size);
return dtls_ecdsa_verify_sig_hash2(pub_key, key_size,
return dtls_ecdsa_verify_sig_hash2(pub_key, sizeof(pub_key),
sign_hash, sign_hash_size,
curve,
result_r, result_s);
Expand All @@ -634,7 +635,6 @@ dtls_ecdsa_verify_sig_hash2(const unsigned char *pub_key, size_t key_size,
(void)result_s;

curve_size = uECC_curve_public_key_size(uecc_curve);

assert(key_size == (unsigned int)curve_size);
assert(sizeof(sign) >= (unsigned int)curve_size);

Expand Down

0 comments on commit 160a6d9

Please sign in to comment.