iPXE
rsa.h File Reference

RSA public-key cryptography. More...

#include <stdarg.h>
#include <ipxe/crypto.h>
#include <ipxe/bigint.h>
#include <ipxe/asn1.h>
#include <ipxe/tables.h>

Go to the source code of this file.

Data Structures

struct  rsa_digestinfo_prefix
 An RSA digestInfo prefix. More...

Macros

#define RSA_DIGESTALGORITHM_CONTENTS(...)
 RSA digestAlgorithm sequence contents.
#define RSA_DIGESTALGORITHM(...)
 RSA digestAlgorithm sequence.
#define RSA_DIGEST_PREFIX(digest_size)
 RSA digest prefix.
#define RSA_DIGESTINFO_PREFIX(digest_size, ...)
 RSA digestInfo prefix.
#define RSA_DIGESTINFO_PREFIXES    __table ( struct rsa_digestinfo_prefix, "rsa_digestinfo_prefixes" )
 RSA digestInfo prefix table.
#define __rsa_digestinfo_prefix   __table_entry ( RSA_DIGESTINFO_PREFIXES, 01 )
 Declare an RSA digestInfo prefix.

Functions

 FILE_LICENCE (GPL2_OR_LATER_OR_UBDL)
 FILE_SECBOOT (PERMITTED)

Variables

struct pubkey_algorithm rsa_algorithm
 RSA public-key algorithm.

Detailed Description

RSA public-key cryptography.

Definition in file rsa.h.

Macro Definition Documentation

◆ RSA_DIGESTALGORITHM_CONTENTS

#define RSA_DIGESTALGORITHM_CONTENTS ( ...)
Value:
ASN1_OID, VA_ARG_COUNT ( __VA_ARGS__ ), __VA_ARGS__, \
ASN1_NULL, 0x00
#define ASN1_NULL
ASN.1 null.
Definition asn1.h:72
#define ASN1_OID
ASN.1 object identifier.
Definition asn1.h:75
#define VA_ARG_COUNT(...)
Definition stdarg.h:28

RSA digestAlgorithm sequence contents.

Definition at line 19 of file rsa.h.

19#define RSA_DIGESTALGORITHM_CONTENTS( ... ) \
20 ASN1_OID, VA_ARG_COUNT ( __VA_ARGS__ ), __VA_ARGS__, \
21 ASN1_NULL, 0x00

◆ RSA_DIGESTALGORITHM

#define RSA_DIGESTALGORITHM ( ...)
Value:
VA_ARG_COUNT ( RSA_DIGESTALGORITHM_CONTENTS ( __VA_ARGS__ ) ), \
RSA_DIGESTALGORITHM_CONTENTS ( __VA_ARGS__ )
#define ASN1_SEQUENCE
ASN.1 sequence.
Definition asn1.h:90
#define RSA_DIGESTALGORITHM_CONTENTS(...)
RSA digestAlgorithm sequence contents.
Definition rsa.h:19

RSA digestAlgorithm sequence.

Definition at line 24 of file rsa.h.

24#define RSA_DIGESTALGORITHM( ... ) \
25 ASN1_SEQUENCE, \
26 VA_ARG_COUNT ( RSA_DIGESTALGORITHM_CONTENTS ( __VA_ARGS__ ) ), \
27 RSA_DIGESTALGORITHM_CONTENTS ( __VA_ARGS__ )

◆ RSA_DIGEST_PREFIX

#define RSA_DIGEST_PREFIX ( digest_size)
Value:
ASN1_OCTET_STRING, digest_size
#define ASN1_OCTET_STRING
ASN.1 octet string.
Definition asn1.h:69

RSA digest prefix.

Definition at line 30 of file rsa.h.

30#define RSA_DIGEST_PREFIX( digest_size ) \
31 ASN1_OCTET_STRING, digest_size

◆ RSA_DIGESTINFO_PREFIX

#define RSA_DIGESTINFO_PREFIX ( digest_size,
... )
Value:
( VA_ARG_COUNT ( RSA_DIGESTALGORITHM ( __VA_ARGS__ ) ) + \
VA_ARG_COUNT ( RSA_DIGEST_PREFIX ( digest_size ) ) + \
digest_size ), \
RSA_DIGESTALGORITHM ( __VA_ARGS__ ), \
RSA_DIGEST_PREFIX ( digest_size )
#define RSA_DIGEST_PREFIX(digest_size)
RSA digest prefix.
Definition rsa.h:30
#define RSA_DIGESTALGORITHM(...)
RSA digestAlgorithm sequence.
Definition rsa.h:24

RSA digestInfo prefix.

Definition at line 34 of file rsa.h.

34#define RSA_DIGESTINFO_PREFIX( digest_size, ... ) \
35 ASN1_SEQUENCE, \
36 ( VA_ARG_COUNT ( RSA_DIGESTALGORITHM ( __VA_ARGS__ ) ) + \
37 VA_ARG_COUNT ( RSA_DIGEST_PREFIX ( digest_size ) ) + \
38 digest_size ), \
39 RSA_DIGESTALGORITHM ( __VA_ARGS__ ), \
40 RSA_DIGEST_PREFIX ( digest_size )

◆ RSA_DIGESTINFO_PREFIXES

#define RSA_DIGESTINFO_PREFIXES    __table ( struct rsa_digestinfo_prefix, "rsa_digestinfo_prefixes" )

RSA digestInfo prefix table.

Definition at line 53 of file rsa.h.

53#define RSA_DIGESTINFO_PREFIXES \
54 __table ( struct rsa_digestinfo_prefix, "rsa_digestinfo_prefixes" )

Referenced by rsa_find_prefix().

◆ __rsa_digestinfo_prefix

#define __rsa_digestinfo_prefix   __table_entry ( RSA_DIGESTINFO_PREFIXES, 01 )

Declare an RSA digestInfo prefix.

Definition at line 57 of file rsa.h.

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )

◆ FILE_SECBOOT()

FILE_SECBOOT ( PERMITTED )

Variable Documentation

◆ rsa_algorithm

struct pubkey_algorithm rsa_algorithm
extern

RSA public-key algorithm.

Definition at line 661 of file rsa.c.

661 {
662 .name = "rsa",
663 .encrypt = rsa_encrypt,
664 .decrypt = rsa_decrypt,
665 .sign = rsa_sign,
666 .verify = rsa_verify,
667 .match = rsa_match,
668};
static int rsa_verify(const struct asn1_cursor *key, struct digest_algorithm *digest, const void *value, const struct asn1_cursor *signature)
Verify signed digest value using RSA.
Definition rsa.c:563
static int rsa_match(const struct asn1_cursor *private_key, const struct asn1_cursor *public_key)
Check for matching RSA public/private key pair.
Definition rsa.c:637
static int rsa_sign(const struct asn1_cursor *key, struct digest_algorithm *digest, const void *value, struct asn1_builder *signature)
Sign digest value using RSA.
Definition rsa.c:514
static int rsa_decrypt(const struct asn1_cursor *key, const struct asn1_cursor *ciphertext, struct asn1_builder *plaintext)
Decrypt using RSA.
Definition rsa.c:373
static int rsa_encrypt(const struct asn1_cursor *key, const struct asn1_cursor *plaintext, struct asn1_builder *ciphertext)
Encrypt using RSA.
Definition rsa.c:298

Referenced by __tls_cipher_suite(), __tls_cipher_suite(), __tls_cipher_suite(), __tls_cipher_suite(), __tls_cipher_suite(), __tls_cipher_suite(), __tls_cipher_suite(), __tls_cipher_suite(), __tls_cipher_suite(), __tls_cipher_suite(), __tls_cipher_suite(), __tls_cipher_suite(), __tls_cipher_suite(), __tls_cipher_suite(), __tls_cipher_suite(), __tls_cipher_suite(), __tls_cipher_suite(), __tls_cipher_suite(), icert_cert(), PUBKEY_SIGN_TEST(), PUBKEY_SIGN_TEST(), PUBKEY_SIGN_TEST(), PUBKEY_TEST(), PUBKEY_TEST(), and REQUIRING_SYMBOL().