Skip to content

Commit

Permalink
[fix-touch] stop receiving data if the stream is closed
Browse files Browse the repository at this point in the history
 + add testing signing micheline expression
  • Loading branch information
spalmer25 committed Dec 12, 2024
1 parent 4cd0f96 commit 10204ac
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/src/ui_stream_nbgl.c
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ tz_ui_nav_cb(void)
tz_parser_state *st = &global.keys.apdu.sign.u.clear.parser_state;

// Continue receiving data from the apdu until s->full is true.
while (((s->total < 0) || ((s->current == s->total) && !s->full))
while (((s->total < 0) || (s->current == s->total)) && !s->full
&& (st->errno < TZ_ERR_INVALID_TAG)) {
PRINTF("tz_ui_nav_cb: Looping...\n");
tz_ui_continue();
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
39 changes: 39 additions & 0 deletions tests/integration/touch/test_sign_micheline.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/usr/bin/env python3
# Copyright 2023 Trilitech <[email protected]>

# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at

# http://www.apache.org/licenses/LICENSE-2.0

# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from utils import (
tezos_app,
send_payload
)

# full input: 0502000000080100000001300000
# full output: Expression {"0";0}

if __name__ == "__main__":
app = tezos_app(__file__)

app.assert_home()

app.send_initialize_msg("8004000011048000002c800006c18000000080000000")
send_payload(app, "800481ff0e0502000000080100000001300000")

app.review.next()
app.assert_screen("micheline_screen")

expected_apdu = "c871155802f26f35ea07a15c8002d836a8779ac8cc2feb0141f08831dad0326a0905cd4fc8f00615b7b4a78e7eaf7fcc0b7959e01e3119b6261ebd71d76d580b9000"
app.review_confirm_signing(expected_apdu)

app.assert_home()
app.quit()

0 comments on commit 10204ac

Please sign in to comment.