Debian Codegraph @

common/compliance.h

raw ◀ ▶
Source reconstructed at patch state 0 of 2 — not the installed (fully patched) source.
2 Debian patches touch this file
1 /* compliance.h - Definitions for compliance modi
2 * Copyright (C) 2017 g10 Code GmbH
3 * Copyright (C) 2017 Bundesamt für Sicherheit in der Informationstechnik
4 *
5 * This file is part of GnuPG.
6 *
7 * This file is free software; you can redistribute it and/or modify
8 * it under the terms of either
9 *
10 * - the GNU Lesser General Public License as published by the Free
11 * Software Foundation; either version 3 of the License, or (at
12 * your option) any later version.
13 *
14 * or
15 *
16 * - the GNU General Public License as published by the Free
17 * Software Foundation; either version 2 of the License, or (at
18 * your option) any later version.
19 *
20 * or both in parallel, as here.
21 *
22 * This file is distributed in the hope that it will be useful,
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 * GNU General Public License for more details.
26 *
27 * You should have received a copy of the GNU General Public License
28 * along with this program; if not, see <https://www.gnu.org/licenses/>.
29 */
30
31 #ifndef GNUPG_COMMON_COMPLIANCE_H
32 #define GNUPG_COMMON_COMPLIANCE_H
33
34 #include <gcrypt.h>
35 #include "openpgpdefs.h"
36
37 void gnupg_initialize_compliance (int gnupg_module_name);
38
39 enum gnupg_compliance_mode
40 {
41 CO_GNUPG, CO_RFC4880, CO_RFC2440,
42 CO_PGP7, CO_PGP8, CO_DE_VS
43 };
44
45 enum pk_use_case
46 {
47 PK_USE_ENCRYPTION, PK_USE_DECRYPTION,
48 PK_USE_SIGNING, PK_USE_VERIFICATION
49 };
50
51 /* Flags to distinguish public key algorithm variants. */
52 #define PK_ALGO_FLAG_RSAPSS 1 /* Use rsaPSS padding. */
53 #define PK_ALGO_FLAG_ECC18 256 /* GCRY_PK_ECC is used in a generic way. */
54
55
56 int gnupg_pk_is_compliant (enum gnupg_compliance_mode compliance, int algo,
57 unsigned int algo_flags,
58 gcry_mpi_t key[], unsigned int keylength,
59 const char *curvename);
60 int gnupg_pk_is_allowed (enum gnupg_compliance_mode compliance,
61 enum pk_use_case use, int algo,
62 unsigned int algo_flags, gcry_mpi_t key[],
63 unsigned int keylength, const char *curvename);
64 int gnupg_cipher_is_compliant (enum gnupg_compliance_mode compliance,
65 cipher_algo_t cipher,
66 enum gcry_cipher_modes mode);
67 int gnupg_cipher_is_allowed (enum gnupg_compliance_mode compliance,
68 int producer,
69 cipher_algo_t cipher,
70 enum gcry_cipher_modes mode);
71 int gnupg_digest_is_compliant (enum gnupg_compliance_mode compliance,
72 digest_algo_t digest);
73 int gnupg_digest_is_allowed (enum gnupg_compliance_mode compliance,
74 int producer,
75 digest_algo_t digest);
76 int gnupg_rng_is_compliant (enum gnupg_compliance_mode compliance);
77 int gnupg_gcrypt_is_compliant (enum gnupg_compliance_mode compliance);
78
79 const char *gnupg_status_compliance_flag (enum gnupg_compliance_mode
80 compliance);
81
82 struct gnupg_compliance_option
83 {
84 const char *keyword;
85 int value;
86 };
87
88 int gnupg_parse_compliance_option (const char *string,
89 struct gnupg_compliance_option options[],
90 size_t length,
91 int quiet);
92 const char *gnupg_compliance_option_string (enum gnupg_compliance_mode
93 compliance);
94
95 void gnupg_set_compliance_extra_info (unsigned int min_rsa);
96
97
98 #endif /*GNUPG_COMMON_COMPLIANCE_H*/