iPXE
rsa.h
Go to the documentation of this file.
1 #ifndef _IPXE_RSA_H
2 #define _IPXE_RSA_H
3 
4 /** @file
5  *
6  * RSA public-key cryptography
7  */
8 
9 FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
10 
11 #include <stdarg.h>
12 #include <ipxe/crypto.h>
13 #include <ipxe/bigint.h>
14 #include <ipxe/asn1.h>
15 #include <ipxe/tables.h>
16 
17 /** RSA digestAlgorithm sequence contents */
18 #define RSA_DIGESTALGORITHM_CONTENTS( ... ) \
19  ASN1_OID, VA_ARG_COUNT ( __VA_ARGS__ ), __VA_ARGS__, \
20  ASN1_NULL, 0x00
21 
22 /** RSA digestAlgorithm sequence */
23 #define RSA_DIGESTALGORITHM( ... ) \
24  ASN1_SEQUENCE, \
25  VA_ARG_COUNT ( RSA_DIGESTALGORITHM_CONTENTS ( __VA_ARGS__ ) ), \
26  RSA_DIGESTALGORITHM_CONTENTS ( __VA_ARGS__ )
27 
28 /** RSA digest prefix */
29 #define RSA_DIGEST_PREFIX( digest_size ) \
30  ASN1_OCTET_STRING, digest_size
31 
32 /** RSA digestInfo prefix */
33 #define RSA_DIGESTINFO_PREFIX( digest_size, ... ) \
34  ASN1_SEQUENCE, \
35  ( VA_ARG_COUNT ( RSA_DIGESTALGORITHM ( __VA_ARGS__ ) ) + \
36  VA_ARG_COUNT ( RSA_DIGEST_PREFIX ( digest_size ) ) + \
37  digest_size ), \
38  RSA_DIGESTALGORITHM ( __VA_ARGS__ ), \
39  RSA_DIGEST_PREFIX ( digest_size )
40 
41 /** An RSA digestInfo prefix */
43  /** Digest algorithm */
45  /** Prefix */
46  const void *data;
47  /** Length of prefix */
48  size_t len;
49 };
50 
51 /** RSA digestInfo prefix table */
52 #define RSA_DIGESTINFO_PREFIXES \
53  __table ( struct rsa_digestinfo_prefix, "rsa_digestinfo_prefixes" )
54 
55 /** Declare an RSA digestInfo prefix */
56 #define __rsa_digestinfo_prefix __table_entry ( RSA_DIGESTINFO_PREFIXES, 01 )
57 
58 extern struct pubkey_algorithm rsa_algorithm;
59 
60 #endif /* _IPXE_RSA_H */
Cryptographic API.
Big integer support.
struct pubkey_algorithm rsa_algorithm
RSA public-key algorithm.
Definition: rsa.c:699
ASN.1 encoding.
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
const void * data
Prefix.
Definition: rsa.h:46
An RSA digestInfo prefix.
Definition: rsa.h:42
size_t len
Length of prefix.
Definition: rsa.h:48
A message digest algorithm.
Definition: crypto.h:18
Linker tables.
struct digest_algorithm * digest
Digest algorithm.
Definition: rsa.h:44
A public key algorithm.
Definition: crypto.h:121