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