• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2017-2021 NXP
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  *
6  */
7 
8 #ifndef _RSA_H__
9 #define _RSA_H__
10 
11 /* RSA key size defines */
12 #define RSA_4K_KEY_SZ       4096
13 #define RSA_4K_KEY_SZ_BYTES (RSA_4K_KEY_SZ/8)
14 #define RSA_2K_KEY_SZ       2048
15 #define RSA_2K_KEY_SZ_BYTES (RSA_2K_KEY_SZ/8)
16 #define RSA_1K_KEY_SZ       1024
17 #define RSA_1K_KEY_SZ_BYTES (RSA_1K_KEY_SZ/8)
18 
19 #define SHA256_BYTES        (256/8)
20 
21 struct pk_in_params {
22 	uint8_t *e;
23 	uint32_t e_siz;
24 	uint8_t *n;
25 	uint32_t n_siz;
26 	uint8_t *a;
27 	uint32_t a_siz;
28 	uint8_t *b;
29 	uint32_t b_siz;
30 };
31 
32 struct rsa_context {
33 	struct pk_in_params pkin;
34 };
35 
36 int rsa_verify_signature(void *hash_ptr, unsigned int hash_len,
37 			 void *sig_ptr, unsigned int sig_len,
38 			 void *pk_ptr, unsigned int pk_len);
39 
40 #endif
41