Loading...
Searching...
No Matches
algorithm.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2024 TU Dresden
3 * Copyright (C) 2021 HAW Hamburg
4 *
5 * This file is subject to the terms and conditions of the GNU Lesser
6 * General Public License v2.1. See the file LICENSE in the top level
7 * directory for more details.
8 */
9
10#pragma once
11
23
24#ifdef __cplusplus
25extern "C" {
26#endif
27
28#include "psa/algorithm.h"
29#include "psa/hash/algorithm.h"
30
34#define PSA_ALG_CATEGORY_SIGN ((psa_algorithm_t)0x06000000)
35
45#define PSA_ALG_IS_SIGN(alg) \
46 (((alg) & PSA_ALG_CATEGORY_MASK) == PSA_ALG_CATEGORY_ASYMMETRIC_SIGNATURE)
47
56#define PSA_ALG_IS_RSA_PKCS1V15_SIGN(alg) \
57 (((alg) & ~0x000000ff) == 0x06000200)
58
70#define PSA_ALG_IS_RSA_PSS(alg) \
71 (((alg) & ~0x000000ff) == 0x06000300)
72
87#define PSA_ALG_IS_RSA_PSS_ANY_SALT(alg) \
88 (((alg) & ~0x000000ff) == 0x06001300)
89
104#define PSA_ALG_IS_RSA_PSS_STANDARD_SALT(alg) \
105 (((alg) & ~0x000000ff) == 0x06000300)
106
115#define PSA_ALG_IS_ECDSA(alg) \
116 (((alg) & PSA_ALG_CATEGORY_MASK) == PSA_ALG_CATEGORY_SIGN)
117
128#define PSA_ALG_IS_DETERMINISTIC_ECDSA(alg) \
129 (((alg) & ~0x000000ff) == 0x06000700)
130
141#define PSA_ALG_IS_RANDOMIZED_ECDSA(alg) \
142 (((alg) & ~0x000000ff) == 0x06000600)
143
152#define PSA_ALG_IS_HASH_EDDSA(alg) \
153 (((alg) & ~0x000000ff) == 0x06000900)
154
170#define PSA_ALG_IS_SIGN_HASH(alg) \
171 (PSA_ALG_IS_RSA_PSS(alg) || PSA_ALG_IS_RSA_PKCS1V15_SIGN(alg) || \
172 PSA_ALG_IS_ECDSA(alg) || PSA_ALG_IS_HASH_EDDSA(alg))
173
206#define PSA_ALG_IS_HASH_AND_SIGN(alg) \
207 (PSA_ALG_IS_SIGN_HASH(alg) && \
208 ((alg) & PSA_ALG_HASH_MASK) != 0)
209
221#define PSA_ALG_IS_SIGN_MESSAGE(alg) \
222 (PSA_ALG_IS_SIGN_HASH(alg) || (alg) == PSA_ALG_PURE_EDDSA)
223
238#define PSA_ALG_IS_WILDCARD(alg) \
239 (PSA_ALG_GET_HASH(alg) == PSA_ALG_ANY_HASH)
240
283#define PSA_ALG_ANY_HASH ((psa_algorithm_t)0x020000ff)
284
310#define PSA_ALG_RSA_PKCS1V15_SIGN(hash_alg) \
311 ((psa_algorithm_t)(0x06000200 | ((hash_alg) & 0x000000ff)))
312
335#define PSA_ALG_RSA_PKCS1V15_SIGN_RAW ((psa_algorithm_t)0x06000200)
336
366#define PSA_ALG_RSA_PSS(hash_alg) \
367 ((psa_algorithm_t)(0x06000300 | ((hash_alg) & 0x000000ff)))
368
399#define PSA_ALG_RSA_PSS_ANY_SALT(hash_alg) \
400 ((psa_algorithm_t)(0x06001300 | ((hash_alg) & 0x000000ff)))
401
405#define PSA_ALG_ECDSA_BASE ((psa_algorithm_t)0x06000600)
406
456#define PSA_ALG_ECDSA(hash_alg) \
457 (PSA_ALG_ECDSA_BASE | ((hash_alg) & PSA_ALG_HASH_MASK))
458
486#define PSA_ALG_ECDSA_ANY PSA_ALG_ECDSA_BASE
487
529#define PSA_ALG_DETERMINISTIC_ECDSA(hash_alg) \
530 ((psa_algorithm_t)(0x06000700 | ((hash_alg) & 0x000000ff)))
531
567#define PSA_ALG_PURE_EDDSA ((psa_algorithm_t)0x06000800)
568
596#define PSA_ALG_ED25519PH ((psa_algorithm_t)0x0600090B)
597
626#define PSA_ALG_ED448PH ((psa_algorithm_t)0x06000915)
627
628#ifdef __cplusplus
629}
630#endif
631
Algorithm definitions for the PSA Crypto API.
Hash algorithm definitions for the PSA Crypto API.