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 · Fixed by #2214
Closed

mpi_write_hlp is not efficient and can cause stack overflow #2190

RonEld opened this issue Nov 13, 2018 · 1 comment · Fixed by #2214
Labels
bug component-crypto Crypto primitives and low-level interfaces

Comments

@RonEld
Copy link
Contributor

RonEld 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)

@RonEld RonEld added bug tracking component-crypto Crypto primitives and low-level interfaces labels Nov 13, 2018
@ciarmcom
Copy link

ARM Internal Ref: IOTSSL-2627

RonEld pushed a commit to RonEld/mbedtls that referenced this issue Nov 20, 2018
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 Mbed-TLS#2190
RonEld pushed a commit to RonEld/mbedtls that referenced this issue Nov 20, 2018
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 Mbed-TLS#2190
RonEld pushed a commit to RonEld/mbedtls that referenced this issue Nov 27, 2018
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 Mbed-TLS#2190
RonEld pushed a commit to RonEld/mbedtls that referenced this issue Nov 27, 2018
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 Mbed-TLS#2190
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug component-crypto Crypto primitives and low-level interfaces
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants