rsa_pss.h 1002 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /*
  2. * SPDX-FileCopyrightText: 2020-2022 Espressif Systems (Shanghai) CO LTD
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. */
  6. #pragma once
  7. #include "sdkconfig.h"
  8. #if CONFIG_ESP32_REV_MIN_FULL >= 300
  9. #include <stdint.h>
  10. #include <stdbool.h>
  11. #include <stddef.h>
  12. #ifdef __cplusplus
  13. extern "C" {
  14. #endif
  15. #define ETS_SIG_LEN 384 /* Bytes */
  16. #define ETS_DIGEST_LEN 32 /* SHA-256, bytes */
  17. /* Secure Boot Version 2 - Public Key format */
  18. typedef struct {
  19. uint8_t n[384]; /* Public key modulus */
  20. uint32_t e; /* Public key exponent */
  21. uint8_t rinv[384];
  22. uint32_t mdash;
  23. } ets_rsa_pubkey_t;
  24. bool ets_rsa_pss_verify(const ets_rsa_pubkey_t *key, const uint8_t *sig, const uint8_t *digest, uint8_t *verified_digest);
  25. void ets_mgf1_sha256(const uint8_t *mgfSeed, size_t seedLen, size_t maskLen, uint8_t *mask);
  26. bool ets_emsa_pss_verify(const uint8_t *encoded_message, const uint8_t *mhash, uint8_t *verified_digest);
  27. #ifdef __cplusplus
  28. }
  29. #endif
  30. #endif // CONFIG_ESP32_REV_MIN_FULL >= 300