Skip to content

createSelfSignedCert running out of stack #48

Open
@ikostoski

Description

@ikostoski

Describe the bug
The createSelfSignedCert function from SSLCert.cpp crashes many times before occasionally generating the certificate.

How To Reproduce
Steps to reproduce the behavior:

  1. Compile and upload REST-API.ino.
  2. Watch the 'Guru Meditation' errors...

Expected Behavior
Self-signed certificate generation that works reliably.

Actual Behavior
'loopTask' Stack is overrun most of the time for 1024bit key, and always for 2048bit key

ESP32 Module
Please provide specifications of your module

  • RAM/PSRAM: 520Kb/None
  • Flash Size: 4MB
  • Other special properties:

Software (please complete the following information if applicable)

  • IDE and Version: Arduino 1.8.9
  • OS: N/A
  • Client used to access the server: N/A

Additional context
There appears to be many mbedtls structures allocated on the stack in 'cert_write' function, which may contribute to the problem, or simply mbedtls need space on stack to work with.
Workaround for reliable self-signed certificate generation seems to be running it in separate task with huge stack (i.e. 16Kb), just for this purpose, and than deleting the task afterwards.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions