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

mpi_write_hlp is not efficient and can cause stack overflow #2190

Closed
RonEld opened this issue Nov 13, 2018 · 1 comment

Comments

Projects
None yet
2 participants
@RonEld
Copy link
Contributor

commented Nov 13, 2018

Description

  • Type: Bug
  • Priority: Major
    mpi_write_hlp is not efficient and can cause stack overflow.
    It is a recursive function, and depending on the mpi given.

Bug

OS
Mbed OS

mbed TLS build:
Version: 2.13.1
OS version: 5.10

Expected behavior
test to succeed and not crash
Actual behavior
On Target Test : features-mbedtls-tests-mbedtls-test_suite_mpi causes stack overflow, in this function.

Steps to reproduce
Run features-mbedtls-tests-mbedtls-test_suite_mpi On Target Test. ( tested on NRF52840_DK platform)

@ciarmcom

This comment has been minimized.

Copy link
Member

commented Nov 13, 2018

ARM Internal Ref: IOTSSL-2627

@ciarmcom ciarmcom added the mirrored label Nov 13, 2018

RonEld added a commit to RonEld/mbedtls that referenced this issue Nov 20, 2018

Refactor mpi_write_hlp to not be recursive
Refactor `mpi_write_hlp()` to not be recursive, to fix stack overflows.
Iterate over the `mbedtls_mpi` division of the radix requested,
until it is zero. Each iteration, put the residue in the next LSB
of the output buffer. Fixes ARMmbed#2190

RonEld added a commit to RonEld/mbedtls that referenced this issue Nov 20, 2018

Refactor mpi_write_hlp to not be recursive
Refactor `mpi_write_hlp()` to not be recursive, to fix stack overflows.
Iterate over the `mbedtls_mpi` division of the radix requested,
until it is zero. Each iteration, put the residue in the next LSB
of the output buffer. Fixes ARMmbed#2190

@RonEld RonEld referenced this issue Nov 20, 2018

Merged

Refactor mpi_write_hlp to not be recursive #2214

2 of 4 tasks complete

RonEld added a commit to RonEld/mbedtls that referenced this issue Nov 27, 2018

Refactor mpi_write_hlp to not be recursive
Refactor `mpi_write_hlp()` to not be recursive, to fix stack overflows.
Iterate over the `mbedtls_mpi` division of the radix requested,
until it is zero. Each iteration, put the residue in the next LSB
of the output buffer. Fixes ARMmbed#2190

RonEld added a commit to RonEld/mbedtls that referenced this issue Nov 27, 2018

Refactor mpi_write_hlp to not be recursive
Refactor `mpi_write_hlp()` to not be recursive, to fix stack overflows.
Iterate over the `mbedtls_mpi` division of the radix requested,
until it is zero. Each iteration, put the residue in the next LSB
of the output buffer. Fixes ARMmbed#2190
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.