Skip to content
This repository has been archived by the owner on Jun 19, 2024. It is now read-only.

Commit

Permalink
Merge pull request #43 from Zondax/fixture_err_return
Browse files Browse the repository at this point in the history
Fixture err return
  • Loading branch information
chcmedeiros committed Nov 3, 2022
2 parents 2c1f43a + 9d841c6 commit 265dc33
Show file tree
Hide file tree
Showing 45 changed files with 115 additions and 119 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ jobs:
run: |
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 10
make deps
brew install conan
conan config install https://github.com/conan-io/conanclientcert.git
- run: cmake -DCMAKE_BUILD_TYPE=Debug . && make
- run: GTEST_COLOR=1 ASAN_OPTIONS=detect_leaks=0 ctest -VV

Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@

-------------------

![zondax](docs/zondax.jpg)
![zondax_light](docs/zondax_light.png#gh-light-mode-only)
![zondax_dark](docs/zondax_dark.png#gh-dark-mode-only)

_Please visit our website at [zondax.ch](zondax.ch)_

Expand Down
2 changes: 1 addition & 1 deletion app/Makefile.version
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ APPVERSION_M=1
# This is the `spec_version` field of `Runtime`
APPVERSION_N=46
# This is the patch version of this release
APPVERSION_P=7
APPVERSION_P=8
31 changes: 12 additions & 19 deletions app/src/crypto.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ zxerr_t crypto_extractPublicKey(key_kind_e addressKind, const uint32_t path[HDPA
if (pubKeyLen < PK_LEN_25519) {
return zxerr_invalid_crypto_settings;
}
zxerr_t err = zxerr_ok;

BEGIN_TRY
{
Expand Down Expand Up @@ -72,16 +73,12 @@ zxerr_t crypto_extractPublicKey(key_kind_e addressKind, const uint32_t path[HDPA
break;
#endif
default:
CLOSE_TRY;
return zxerr_invalid_crypto_settings;
err = zxerr_invalid_crypto_settings;
}
}
CATCH_ALL
{
MEMZERO(&cx_privateKey, sizeof(cx_privateKey));
MEMZERO(privateKeyData, SK_LEN_25519);
CLOSE_TRY;
return zxerr_unknown;
err = zxerr_unknown;
}
FINALLY
{
Expand All @@ -91,7 +88,7 @@ zxerr_t crypto_extractPublicKey(key_kind_e addressKind, const uint32_t path[HDPA
}
END_TRY;

return zxerr_ok;
return err;
}

zxerr_t crypto_sign_ed25519(uint8_t *signature, uint16_t signatureMaxlen,
Expand All @@ -114,6 +111,8 @@ zxerr_t crypto_sign_ed25519(uint8_t *signature, uint16_t signatureMaxlen,
int signatureLength = 0;
unsigned int info = 0;

zxerr_t err = zxerr_ok;

BEGIN_TRY
{
TRY
Expand Down Expand Up @@ -147,11 +146,8 @@ zxerr_t crypto_sign_ed25519(uint8_t *signature, uint16_t signatureMaxlen,
}
CATCH_ALL
{
MEMZERO(&cx_privateKey, sizeof(cx_privateKey));
MEMZERO(privateKeyData, SK_LEN_25519);
*signatureLen = 0;
CLOSE_TRY;
return zxerr_unknown;
err = zxerr_unknown;
}
FINALLY
{
Expand All @@ -161,7 +157,7 @@ zxerr_t crypto_sign_ed25519(uint8_t *signature, uint16_t signatureMaxlen,
}
}
END_TRY;
return zxerr_ok;
return err;
}

#ifdef SUPPORT_SR25519
Expand Down Expand Up @@ -205,14 +201,12 @@ zxerr_t crypto_sign_sr25519_prephase(uint8_t *buffer, uint16_t bufferLen,
zxerr_t crypto_sign_sr25519(uint8_t *signature, uint16_t signatureMaxlen,
uint16_t *signatureLen) {

zxerr_t err = zxerr_ok;

BEGIN_TRY
{
TRY
{
if (signatureMaxlen < MIN_BUFFER_LENGTH) {
CLOSE_TRY;
return zxerr_invalid_crypto_settings;
}
*signature = PREFIX_SIGNATURE_TYPE_SR25519;
sign_sr25519_phase1((uint8_t *) &N_sr25519_signdata.sk, (uint8_t *) &N_sr25519_signdata.pk, NULL, 0,
(uint8_t *) &N_sr25519_signdata.signdata, sr25519_signdataLen, signature + 1);
Expand All @@ -223,16 +217,15 @@ zxerr_t crypto_sign_sr25519(uint8_t *signature, uint16_t signatureMaxlen,
}
CATCH_ALL
{
CLOSE_TRY;
return zxerr_unknown;
err = zxerr_unknown;
};
FINALLY
{
MEMZERO(signature + SIG_PLUS_TYPE_LEN, signatureMaxlen - SIG_PLUS_TYPE_LEN);
}
}
END_TRY;
return zxerr_ok;
return err;
}
#endif

Expand Down
1 change: 1 addition & 0 deletions app/src/secret.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include "tx.h"
#include "view.h"
#include "app_mode.h"
#include "zxformat.h"

void secret_accept() {
#ifdef APP_SECRET_MODE_ENABLED
Expand Down
2 changes: 1 addition & 1 deletion cmake/cmake-modules
Submodule cmake-modules updated 1 files
+31 −14 CodeCoverage.cmake
2 changes: 1 addition & 1 deletion deps/nanos-secure-sdk
2 changes: 1 addition & 1 deletion deps/nanosplus-secure-sdk
Submodule nanosplus-secure-sdk updated 75 files
+3 −0 Makefile.conf.cx
+1 −1 Makefile.rules_generic
+10 −0 README.md
+0 −338 icon.py
+42 −2 include/bagl.h
+1 −1 include/bolos_version.h
+2 −3 include/cx_errors.h
+103 −98 include/cx_stubs.h
+19 −0 include/decorators.h
+4 −1 include/errors.h
+2 −1 include/exceptions.h
+8 −4 include/os_id.h
+0 −5 include/os_nvm.h
+12 −4 include/os_seed.h
+4 −9 include/os_ux.h
+5 −7 include/ox_aes.h
+85 −66 include/ox_bn.h
+1 −1 include/ox_crc.h
+6 −7 include/ox_des.h
+67 −61 include/ox_ec.h
+1 −1 include/ox_rng.h
+6 −1 include/syscalls.h
+245 −176 lib_bagl/src/bagl.c
+379 −667 lib_bagl/src/bagl_font_open_sans_extrabold_11px.inc
+118 −0 lib_bagl/src/bagl_font_open_sans_extrabold_11px_unicode.inc
+478 −766 lib_bagl/src/bagl_font_open_sans_light_16px.inc
+137 −0 lib_bagl/src/bagl_font_open_sans_light_16px_unicode.inc
+372 −660 lib_bagl/src/bagl_font_open_sans_regular_11px.inc
+114 −0 lib_bagl/src/bagl_font_open_sans_regular_11px_unicode.inc
+6 −0 lib_bagl/src/bagl_font_rom.inc
+32 −0 lib_bagl/src/bagl_font_unicode_rom_struct.inc
+11 −1 lib_bagl/src/bagl_fonts.c
+5 −0 lib_cxng/cx.export
+69 −27 lib_cxng/include/lcx_aead.h
+20 −11 lib_cxng/include/lcx_aes.h
+10 −4 lib_cxng/include/lcx_blake2.h
+4 −4 lib_cxng/include/lcx_blake3.h
+157 −0 lib_cxng/include/lcx_chacha.h
+51 −0 lib_cxng/include/lcx_chacha_poly.h
+2 −2 lib_cxng/include/lcx_common.h
+2 −2 lib_cxng/include/lcx_crc.h
+25 −13 lib_cxng/include/lcx_des.h
+8 −4 lib_cxng/include/lcx_ecdh.h
+14 −9 lib_cxng/include/lcx_ecdsa.h
+65 −34 lib_cxng/include/lcx_ecfp.h
+10 −5 lib_cxng/include/lcx_ecschnorr.h
+19 −16 lib_cxng/include/lcx_eddsa.h
+8 −8 lib_cxng/include/lcx_groestl.h
+16 −13 lib_cxng/include/lcx_hash.h
+38 −25 lib_cxng/include/lcx_hmac.h
+94 −47 lib_cxng/include/lcx_math.h
+9 −6 lib_cxng/include/lcx_pbkdf2.h
+54 −0 lib_cxng/include/lcx_poly1305.h
+3 −3 lib_cxng/include/lcx_ripemd160.h
+9 −7 lib_cxng/include/lcx_rng.h
+44 −24 lib_cxng/include/lcx_rsa.h
+12 −4 lib_cxng/include/lcx_sha256.h
+27 −12 lib_cxng/include/lcx_sha3.h
+5 −5 lib_cxng/include/lcx_sha512.h
+4 −0 lib_cxng/include/libcxng.h
+5 −5 lib_cxng/src/cx_aes_gcm.h
+77 −0 lib_cxng/src/cx_chacha_poly.h
+5 −0 lib_cxng/src/cx_exported_functions.c
+116 −0 lib_cxng/src/cx_poly1305.h
+3 −6 lib_cxng/src/cx_ram.c
+10 −0 lib_cxng/src/cx_ram.h
+11 −0 lib_cxng/src/cx_utils.c
+5 −0 lib_cxng/src/cx_utils.h
+5 −0 lib_stusb/usbd_conf.h
+1 −1 lib_ux/src/ux_layout_paging_compute.c
+5 −0 src/cx_stubs.S
+31 −8 src/os_io_seproxyhal.c
+3 −2 src/os_printf.c
+1 −1 src/pic.c
+22 −7 src/syscalls.c
2 changes: 1 addition & 1 deletion deps/nanox-secure-sdk
Binary file removed docs/zondax.jpg
Binary file not shown.
Binary file added docs/zondax_dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/zondax_light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 265dc33

Please sign in to comment.