Loading...
Searching...
No Matches
algorithm.h File Reference

Asymmetric encryption algorithm definitions for the PSA Crypto API. More...

Detailed Description

Asymmetric encryption algorithm definitions for the PSA Crypto API.

Author
Armin Wolf wolf..nosp@m.armi.nosp@m.n@mai.nosp@m.lbox.nosp@m..tu-d.nosp@m.resd.nosp@m.en.de
Lena Boeckmann lena..nosp@m.boec.nosp@m.kmann.nosp@m.@haw.nosp@m.-hamb.nosp@m.urg..nosp@m.de

Definition in file algorithm.h.

#include "psa/algorithm.h"
+ Include dependency graph for algorithm.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

#define PSA_ALG_CATEGORY_ASYMMETRIC_ENCRYPTION   ((psa_algorithm_t)0x07000000)
 Category for asymmetric encryption algorithms.
 
#define PSA_ALG_IS_ASYMMETRIC_ENCRYPTION(alg)    (((alg) & PSA_ALG_CATEGORY_MASK) == PSA_ALG_CATEGORY_ASYMMETRIC_ENCRYPTION)
 Whether the specified algorithm is an asymmetric encryption algorithm, also known as public-key encryption algorithm.
 
#define PSA_ALG_IS_RSA_OAEP(alg)    (((alg) & ~0x000000ff) == 0x07000300)
 Whether the specified algorithm is an RSA OAEP encryption algorithm.
 
#define PSA_ALG_RSA_PKCS1V15_CRYPT   ((psa_algorithm_t)0x07000200)
 The RSA PKCS#1 v1.5 asymmetric encryption algorithm.
 
#define PSA_ALG_RSA_OAEP(hash_alg)    ((psa_algorithm_t)(0x07000300 | ((hash_alg) & 0x000000ff)))
 The RSA OAEP asymmetric encryption algorithm.
 

Macro Definition Documentation

◆ PSA_ALG_CATEGORY_ASYMMETRIC_ENCRYPTION

#define PSA_ALG_CATEGORY_ASYMMETRIC_ENCRYPTION   ((psa_algorithm_t)0x07000000)

Category for asymmetric encryption algorithms.

Definition at line 34 of file algorithm.h.

◆ PSA_ALG_IS_ASYMMETRIC_ENCRYPTION

#define PSA_ALG_IS_ASYMMETRIC_ENCRYPTION (   alg)     (((alg) & PSA_ALG_CATEGORY_MASK) == PSA_ALG_CATEGORY_ASYMMETRIC_ENCRYPTION)

Whether the specified algorithm is an asymmetric encryption algorithm, also known as public-key encryption algorithm.

Parameters
algAn algorithm identifier: a value of type psa_algorithm_t.
Returns
1 if alg is an asymmetric encryption algorithm, 0 otherwise.

Definition at line 45 of file algorithm.h.

◆ PSA_ALG_IS_RSA_OAEP

#define PSA_ALG_IS_RSA_OAEP (   alg)     (((alg) & ~0x000000ff) == 0x07000300)

Whether the specified algorithm is an RSA OAEP encryption algorithm.

Parameters
algAn algorithm identifier: a value of type psa_algorithm_t.
Returns
1 if alg is a RSA OAEP algorithm 0 otherwise

Definition at line 56 of file algorithm.h.

◆ PSA_ALG_RSA_OAEP

#define PSA_ALG_RSA_OAEP (   hash_alg)     ((psa_algorithm_t)(0x07000300 | ((hash_alg) & 0x000000ff)))

The RSA OAEP asymmetric encryption algorithm.

This encryption scheme is defined by RFC8017 §7.1 under the name RSAES-OAEP, with the following options:

  • The mask generation function MGF1 defined in RFC8017 Appendix B.2.1.
  • The specified hash algorithm is used to hash the label, and for the mask generation function.

Compatible key types

Parameters
hash_algA hash algorithm: a value of type psa_algorithm_t such that PSA_ALG_IS_HASH(hash_alg) is true. The hash algorithm is used for MGF1.
Returns
The corresponding RSA OAEP encryption algorithm. Unspecified if hash_alg is not a supported hash algorithm.

Definition at line 94 of file algorithm.h.

◆ PSA_ALG_RSA_PKCS1V15_CRYPT

#define PSA_ALG_RSA_PKCS1V15_CRYPT   ((psa_algorithm_t)0x07000200)

The RSA PKCS#1 v1.5 asymmetric encryption algorithm.

This encryption scheme is defined by PKCS #1: RSA Cryptography Specifications Version 2.2 RFC8017 §7.2 under the name RSAES-PKCS-v1_5.

Compatible key types

Definition at line 70 of file algorithm.h.