2006-10-24 Marcus Brinkmann <marcus@g10code.de>
[gnupg.git] / include / cipher.h
blobd8b15cf9a80b44d0a4873a78b7fd99286681a58c
1 /* cipher.h - Definitions for OpenPGP
2 * Copyright (C) 1998, 1999, 2000, 2001, 2006 Free Software Foundation, Inc.
4 * This file is part of GnuPG.
6 * GnuPG is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * GnuPG is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
19 * USA.
21 #ifndef G10_CIPHER_H
22 #define G10_CIPHER_H
24 #include <gcrypt.h>
26 /* Macros for compatibility with older libgcrypt versions. */
27 #ifndef GCRY_PK_USAGE_CERT
28 # define GCRY_PK_USAGE_CERT 4
29 # define GCRY_PK_USAGE_AUTH 8
30 # define GCRY_PK_USAGE_UNKN 128
31 #endif
34 /* Constants for OpenPGP. */
36 #define CIPHER_ALGO_NONE /* 0 */ GCRY_CIPHER_NONE
37 #define CIPHER_ALGO_IDEA /* 1 */ GCRY_CIPHER_IDEA
38 #define CIPHER_ALGO_3DES /* 2 */ GCRY_CIPHER_3DES
39 #define CIPHER_ALGO_CAST5 /* 3 */ GCRY_CIPHER_CAST5
40 #define CIPHER_ALGO_BLOWFISH /* 4 */ GCRY_CIPHER_BLOWFISH /* 128 bit */
41 /* 5 & 6 are reserved */
42 #define CIPHER_ALGO_AES /* 7 */ GCRY_CIPHER_AES
43 #define CIPHER_ALGO_AES192 /* 8 */ GCRY_CIPHER_AES192
44 #define CIPHER_ALGO_AES256 /* 9 */ GCRY_CIPHER_AES256
45 #define CIPHER_ALGO_RIJNDAEL CIPHER_ALGO_AES
46 #define CIPHER_ALGO_RIJNDAEL192 CIPHER_ALGO_AES192
47 #define CIPHER_ALGO_RIJNDAEL256 CIPHER_ALGO_AES256
48 #define CIPHER_ALGO_TWOFISH /* 10 */ GCRY_CIPHER_TWOFISH /* 256 bit */
49 #define CIPHER_ALGO_DUMMY 110 /* No encryption at all. */
51 #define PUBKEY_ALGO_RSA /* 1 */ GCRY_PK_RSA
52 #define PUBKEY_ALGO_RSA_E /* 2 */ GCRY_PK_RSA_E /* RSA encrypt only. */
53 #define PUBKEY_ALGO_RSA_S /* 3 */ GCRY_PK_RSA_S /* RSA sign only. */
54 #define PUBKEY_ALGO_ELGAMAL_E /* 16 */ GCRY_PK_ELG_E /* Elgamal encr only */
55 #define PUBKEY_ALGO_DSA /* 17 */ GCRY_PK_DSA
56 #define PUBKEY_ALGO_ELGAMAL /* 20 */ GCRY_PK_ELG /* Elgamal encr+sign */
58 #define PUBKEY_USAGE_SIG GCRY_PK_USAGE_SIGN /* Good for signatures. */
59 #define PUBKEY_USAGE_ENC GCRY_PK_USAGE_ENCR /* Good for encryption. */
60 #define PUBKEY_USAGE_CERT GCRY_PK_USAGE_CERT /* Also good to certify keys. */
61 #define PUBKEY_USAGE_AUTH GCRY_PK_USAGE_AUTH /* Good for authentication. */
62 #define PUBKEY_USAGE_UNKNOWN GCRY_PK_USAGE_UNKN /* Unknown usage flag. */
64 #define DIGEST_ALGO_MD5 /* 1 */ GCRY_MD_MD5
65 #define DIGEST_ALGO_SHA1 /* 2 */ GCRY_MD_SHA1
66 #define DIGEST_ALGO_RMD160 /* 3 */ GCRY_MD_RMD160
67 /* 4, 5, 6, and 7 are reserved */
68 #define DIGEST_ALGO_SHA256 /* 8 */ GCRY_MD_SHA256
69 #define DIGEST_ALGO_SHA384 /* 9 */ GCRY_MD_SHA384
70 #define DIGEST_ALGO_SHA512 /* 10 */ GCRY_MD_SHA512
71 /* SHA224 is as of now only defined in the libgcrypt SVN; thus we
72 can't use that macro. */
73 #define DIGEST_ALGO_SHA224 /* 11 */ 11 /* GCRY_MD_SHA224 */
75 #define COMPRESS_ALGO_NONE 0
76 #define COMPRESS_ALGO_ZIP 1
77 #define COMPRESS_ALGO_ZLIB 2
78 #define COMPRESS_ALGO_BZIP2 3
80 #define is_RSA(a) ((a)==PUBKEY_ALGO_RSA || (a)==PUBKEY_ALGO_RSA_E \
81 || (a)==PUBKEY_ALGO_RSA_S )
82 #define is_ELGAMAL(a) ((a)==PUBKEY_ALGO_ELGAMAL_E)
83 #define is_DSA(a) ((a)==PUBKEY_ALGO_DSA)
85 /* The data encryption key object. */
86 typedef struct
88 int algo;
89 int keylen;
90 int algo_info_printed;
91 int use_mdc;
92 int symmetric;
93 byte key[32]; /* This is the largest used keylen (256 bit). */
94 } DEK;
98 /* Constants to allocate static MPI arrays. */
99 #define PUBKEY_MAX_NPKEY 4
100 #define PUBKEY_MAX_NSKEY 6
101 #define PUBKEY_MAX_NSIG 2
102 #define PUBKEY_MAX_NENC 2
104 #endif /*G10_CIPHER_H*/