Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: enable integer overflow checks for release builds #70

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
cargo-features = ["per-package-target"]

[workspace]
resolver = "2"

members = [
"apdu",
Expand Down
2 changes: 0 additions & 2 deletions fw/.cargo/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,9 @@ runner = "speculos.py --model nanox --display qt -a 5 --apdu-port 1237 --zoom 2"
target = "nanosplus"
rustflags = [
"-Z", "emit-stack-sizes",
"-C", "link-args=-Map=/tmp/ledger-mob.map",
'--cfg=curve25519_dalek_bits="32"'
]


[unstable]
build-std = [ "core", "compiler_builtins", "alloc" ]

Expand Down
22 changes: 15 additions & 7 deletions fw/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@

cargo-features = ["per-package-target"]
cargo-features = ["per-package-target", "profile-rustflags"]

[unstable]
profile-rustflags = true

[package]
name = "ledger-mob-fw"
Expand Down Expand Up @@ -83,10 +86,12 @@ required-features = [ "applet" ]
[profile.dev]
#codegen-units = 1
panic = "abort"
debug = true
debug = 2
strip = "none"
split-debuginfo = "off"
opt-level = 'z'
lto = 'fat'
overflow-checks = true

[profile.release]
codegen-units = 1
Expand All @@ -96,15 +101,18 @@ strip = "none"
split-debuginfo = "off"
opt-level = 'z'
lto = 'fat'
overflow-checks = true

# Rust/cargo bug precludes integer overflow checks
# when using LTO, see:
# https://github.com/rust-lang/rust/issues/108853
#overflow-checks = true
# Disable overflow checks for compiler_builtins
# See:
# - https://github.com/rust-lang/cargo/issues/10118
# - https://github.com/rust-lang/rust/issues/108853
[profile.release.package.compiler_builtins]
debug-assertions = false
overflow-checks = false

[patch.crates-io]


curve25519-dalek = { git = "https://github.com/dalek-cryptography/curve25519-dalek", rev = "99c0520aa79401b69fb51d38172cd58c6a256cfb" }
ed25519-dalek = { git = "https://github.com/dalek-cryptography/ed25519-dalek.git", rev = "2931c688eb11341a1145e257bc41d8ecbe36277c" }
x25519-dalek = { git = "https://github.com/mobilecoinfoundation/x25519-dalek.git", rev = "4fbaa3343301c62cfdbc3023c9f485257e6b718a" }
Expand Down
1 change: 0 additions & 1 deletion fw/rust-toolchain

This file was deleted.

3 changes: 3 additions & 0 deletions fw/rust-toolchain
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[toolchain]
channel = "nightly-2023-01-04"
components = [ "rustfmt", "clippy", "rust-src" ]