Skip to content

Conversation

@gojimmypi
Copy link
Contributor

Description

This PR updates the Espressif hardware acceleration code, mostly surrounding SHA2.

There's a new ctx.lockDepth that keeps track of RTOS calls that lock the hardware for exclusive use. This was implemented as the Espressif lib does not properly track ref_counts[periph] in periph_ctrl.c, specifically periph_module_enable and periph_module_disable. If/when RTOS unexpected failures occur, there's a new esp_unroll_sha_module_enable to facilitate returning the peripheral to a known enabled state for the given ctx object.

The esp_sha_hw_lock and esp_sha_hw_unlock now take a ctx parameter.

Instead of assuming exact location in memory space (e.g. for hardware support on newer chipsets that may rearrange things, particularly on architecture change between Xtensa and RISC-V) - there's now a switch statement with reference to HW memory macros instead of a hard-coded address parameter value. For example, see esp_sha_start_process using sha->sha_type

Some preliminary CMakeFile changes were implemented to address some of the breaking changes between ESP-IDF V4 and the new V5.x . Additional work is needed to fully support V5.

Various other code cleanup, formatting, and commenting.

This is an interim PR with additional changes and additions planned with other hardware acceleration.

Fixes zd# (n/a)

Testing

Confirmed to be working with latest SSH to UART project. There should probably be more robust tests created in a future PR to actually compare HW & SW results and report success/failure.

Checklist

  • added tests
  • updated/added doxygen
  • updated appropriate READMEs
  • Updated manual and documentation

@gojimmypi gojimmypi requested a review from dgarske July 6, 2022 17:10
@gojimmypi gojimmypi self-assigned this Jul 6, 2022
Copy link
Contributor

@dgarske dgarske left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note we are in release code freeze. Please coordinate with Jacob is you want this in the release... it might be possible.

#
# Copyright (C) 2014-2022 wolfSSL Inc.
#
# This file is part of wolfSSH.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wolfSSL. Use the license header from wolfSSL, not wolfSSH.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch! updated.

#
# Copyright (C) 2014-2022 wolfSSL Inc.
#
# This file is part of wolfSSH.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wolfSSL license header.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

got it.


#define __ESP32_CRYPT_H__

#ifdef WOLFSSL_USER_SETTINGS
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please include wolfssl/wolfcrypt/settings.h always instead. It does this logic at top and ensures build options checks are done.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's good to know, thanks. fixed.

@gojimmypi gojimmypi requested a review from dgarske July 21, 2022 07:08
@dgarske dgarske merged commit 69e2f52 into wolfSSL:master Jul 21, 2022
@gojimmypi gojimmypi mentioned this pull request Jan 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants