blob: 4247b534c1f547ca70841946eceb16a4457ee670 [file] [log] [blame]
rjw1f884582022-01-06 17:20:42 +08001#ifndef _RSA_H
2#define _RSA_H
3
4#include <errno.h>
5#include "image.h"
6
7#define RSA2048_BYTES (2048 / 8)
8#define RSA4096_BYTES (4096 / 8)
9
10/* This is the minimum/maximum key size we support, in bits */
11#define RSA_MIN_KEY_BITS 2048
12#define RSA_MAX_KEY_BITS 4096
13
14/* This is the maximum signature length that we support, in bits */
15#define RSA_MAX_SIG_BITS 4096
16
17struct key_prop {
18
19 const void *rr;
20 const void *modulus;
21 const void *public_exponent;
22 uint64_t n0inv;
23 int num_bits;
24 uint32_t exp_len;
25};
26
27int rsa_verify(struct sig_info *info,
28 const struct fdt_region region[], int region_count,
29 uint8_t *sig, uint sig_len);
30void get_pubkey_info(struct key_prop *pubkey, const void *blob,int node,
31 int *len);
32
33#endif