1
/* cipher.h - Definitions for OpenPGP
2
* Copyright (C) 1998, 1999, 2000, 2001, 2006,
3
* 2007 Free Software Foundation, Inc.
5
* This file is part of GnuPG.
7
* GnuPG is free software; you can redistribute it and/or modify
8
* it under the terms of the GNU General Public License as published by
9
* the Free Software Foundation; either version 3 of the License, or
10
* (at your option) any later version.
12
* GnuPG is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
* GNU General Public License for more details.
17
* You should have received a copy of the GNU General Public License
18
* along with this program; if not, see <http://www.gnu.org/licenses/>.
25
/* Macros for compatibility with older libgcrypt versions. */
26
#ifndef GCRY_PK_USAGE_CERT
27
# define GCRY_PK_USAGE_CERT 4
28
# define GCRY_PK_USAGE_AUTH 8
29
# define GCRY_PK_USAGE_UNKN 128
33
/* Constants for OpenPGP. */
35
#define CIPHER_ALGO_NONE /* 0 */ GCRY_CIPHER_NONE
36
#define CIPHER_ALGO_IDEA /* 1 */ GCRY_CIPHER_IDEA
37
#define CIPHER_ALGO_3DES /* 2 */ GCRY_CIPHER_3DES
38
#define CIPHER_ALGO_CAST5 /* 3 */ GCRY_CIPHER_CAST5
39
#define CIPHER_ALGO_BLOWFISH /* 4 */ GCRY_CIPHER_BLOWFISH /* 128 bit */
40
/* 5 & 6 are reserved */
41
#define CIPHER_ALGO_AES /* 7 */ GCRY_CIPHER_AES
42
#define CIPHER_ALGO_AES192 /* 8 */ GCRY_CIPHER_AES192
43
#define CIPHER_ALGO_AES256 /* 9 */ GCRY_CIPHER_AES256
44
#define CIPHER_ALGO_RIJNDAEL CIPHER_ALGO_AES
45
#define CIPHER_ALGO_RIJNDAEL192 CIPHER_ALGO_AES192
46
#define CIPHER_ALGO_RIJNDAEL256 CIPHER_ALGO_AES256
47
#define CIPHER_ALGO_TWOFISH /* 10 */ GCRY_CIPHER_TWOFISH /* 256 bit */
48
/* Note: Camellia ids don't match those used by libgcrypt. */
49
#define CIPHER_ALGO_CAMELLIA128 11
50
#define CIPHER_ALGO_CAMELLIA192 12
51
#define CIPHER_ALGO_CAMELLIA256 13
52
#define CIPHER_ALGO_DUMMY 110 /* No encryption at all. */
54
#define PUBKEY_ALGO_RSA /* 1 */ GCRY_PK_RSA
55
#define PUBKEY_ALGO_RSA_E /* 2 */ GCRY_PK_RSA_E /* RSA encrypt only. */
56
#define PUBKEY_ALGO_RSA_S /* 3 */ GCRY_PK_RSA_S /* RSA sign only. */
57
#define PUBKEY_ALGO_ELGAMAL_E /* 16 */ GCRY_PK_ELG_E /* Elgamal encr only */
58
#define PUBKEY_ALGO_DSA /* 17 */ GCRY_PK_DSA
59
#define PUBKEY_ALGO_ECDH 18
60
#define PUBKEY_ALGO_ECDSA 19
61
#define PUBKEY_ALGO_ELGAMAL /* 20 */ GCRY_PK_ELG /* Elgamal encr+sign */
63
#define PUBKEY_USAGE_SIG GCRY_PK_USAGE_SIGN /* Good for signatures. */
64
#define PUBKEY_USAGE_ENC GCRY_PK_USAGE_ENCR /* Good for encryption. */
65
#define PUBKEY_USAGE_CERT GCRY_PK_USAGE_CERT /* Also good to certify keys. */
66
#define PUBKEY_USAGE_AUTH GCRY_PK_USAGE_AUTH /* Good for authentication. */
67
#define PUBKEY_USAGE_UNKNOWN GCRY_PK_USAGE_UNKN /* Unknown usage flag. */
69
#define DIGEST_ALGO_MD5 /* 1 */ GCRY_MD_MD5
70
#define DIGEST_ALGO_SHA1 /* 2 */ GCRY_MD_SHA1
71
#define DIGEST_ALGO_RMD160 /* 3 */ GCRY_MD_RMD160
72
/* 4, 5, 6, and 7 are reserved */
73
#define DIGEST_ALGO_SHA256 /* 8 */ GCRY_MD_SHA256
74
#define DIGEST_ALGO_SHA384 /* 9 */ GCRY_MD_SHA384
75
#define DIGEST_ALGO_SHA512 /* 10 */ GCRY_MD_SHA512
76
/* SHA224 is only available in libgcrypt 1.4.0; thus we
77
can't use the GCRY macro here. */
78
#define DIGEST_ALGO_SHA224 /* 11 */ 11 /* GCRY_MD_SHA224 */
80
#define COMPRESS_ALGO_NONE 0
81
#define COMPRESS_ALGO_ZIP 1
82
#define COMPRESS_ALGO_ZLIB 2
83
#define COMPRESS_ALGO_BZIP2 3
85
#define is_RSA(a) ((a)==PUBKEY_ALGO_RSA || (a)==PUBKEY_ALGO_RSA_E \
86
|| (a)==PUBKEY_ALGO_RSA_S )
87
#define is_ELGAMAL(a) ((a)==PUBKEY_ALGO_ELGAMAL_E)
88
#define is_DSA(a) ((a)==PUBKEY_ALGO_DSA)
90
/* The data encryption key object. */
95
int algo_info_printed;
98
byte key[32]; /* This is the largest used keylen (256 bit). */
99
char s2k_cacheid[1+16+1];
104
/* Constants to allocate static MPI arrays. */
105
#define PUBKEY_MAX_NPKEY 4
106
#define PUBKEY_MAX_NSKEY 6
107
#define PUBKEY_MAX_NSIG 2
108
#define PUBKEY_MAX_NENC 2
110
#endif /*G10_CIPHER_H*/