Skip to content
This repository has been archived by the owner on May 28, 2019. It is now read-only.

extmod/modtrezorcrypto: return False or None consistently when a signature verification fails #535

Closed

Conversation

real-or-random
Copy link
Contributor

@real-or-random real-or-random commented Apr 4, 2019

So far, we either return False (or None for public recovery) or raise a
ValueError (e.g., when the length of the signature). This is
inconsistent and dangerous because the inputs to signature verification
may be attacker-provided and cannot be assumed to be well-formed.

This led to issue #422 where a firmware error is raised when an invalid
signature is is provided. This has been fixed for the ethereum app but
not for the wallet app. This commit addresses the problem at the core of
the issue, i.e., at the verification functions in extmod such that all
apps are covered.

This is a draft PR because it builds on top of #500. It should not be merged currently. But the only commit is the last one, and this is ready for review.

@real-or-random
Copy link
Contributor Author

rebased on #500

@prusnak
Copy link
Member

prusnak commented Apr 15, 2019

@real-or-random I guess this one should be switched to regular PR? (After #500 has been merged)

@real-or-random real-or-random marked this pull request as ready for review April 15, 2019 16:06
@real-or-random
Copy link
Contributor Author

real-or-random commented Apr 15, 2019

Yes, I had left this as draft because #500 is not merged yet, but this is ready for review!

edit: oh it's merged now and now Github complains that this PR needs a rebase... Weird. I'll look into tat

…ature verification fails

So far, we either return False (or None for public recovery) or raise a
ValueError (e.g., when the length of the signature). This is
inconsistent and dangerous because the inputs to signature verification
may be attacker-provided and cannot be assumed to be well-formed.

This led to issue trezor#422 where a firmware error is raised when an invalid
signature is is provided. This has been fixed for the ethereum app but
not for the wallet app. This commit addresses the problem at the core of
the issue, i.e., at the verification functions in extmod such that all
apps are covered.
@real-or-random
Copy link
Contributor Author

Okay, sure, there were changes to master of course and I was confused. It's properly rebased now.

tsusanka added a commit to trezor/trezor-firmware that referenced this pull request Apr 17, 2019
@tsusanka
Copy link
Contributor

tsusanka commented Apr 17, 2019

ACKed by @jpochyla. We're moving to monorepo: https://github.com/trezor/trezor-firmware . I've dared to merge it to master directly, so you don't have to resubmit, I hope that's alright, see trezor/trezor-firmware@5dc0a1e.

@tsusanka tsusanka closed this Apr 17, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants