diff options
author | Werner Koch <[email protected]> | 2014-01-29 16:39:22 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2014-01-29 16:45:05 +0000 |
commit | 25b4c2acbd01f9b4c2c364f44c53b73498ed8469 (patch) | |
tree | 7e314c735d3f0b95947a4af7aafa31081bf14096 /g10/cipher.h | |
parent | gpg: Add another card vendor id. (diff) | |
download | gnupg-25b4c2acbd01f9b4c2c364f44c53b73498ed8469.tar.gz gnupg-25b4c2acbd01f9b4c2c364f44c53b73498ed8469.zip |
include: Remove this directory.
* include/cipher.h: Move to ...
* g10/cipher.h: here.
* agent/gpg-agent.c: Adjust header file name.
* include/host2net.h: Move to ...
* common/host2net.h: here. Change license to LGPLv3/GPLv2. Adjust
notices to reflect that only me worked on that file.
* include/types.h: Remove.
* common/types.h: Include inttypes.h. Add byte typedef and comments
for __riscos__.
* common/iobuf.h: Adjust header file name.
* include/_regex.h: Remove this unused file.
* include/Makefile.am: Remove.
* Makefile.am (SUBDIRS): Remove "include".
* configure.ac (AC_CONFIG_FILES): Remove include/Makefile.
* include/ChangeLog-2011: Move to ...
* common/ChangeLog-2011.include: here.
* common/Makefile.am (EXTRA_DIST): Add file.
* include/zlib-riscos.h: Move this repo only file to ...
* g10/zlib-riscos.h: here.
* include/: Remove.
--
include/ was a leftover from GnuPG 1.x times.
Signed-off-by: Werner Koch <[email protected]>
Diffstat (limited to 'g10/cipher.h')
-rw-r--r-- | g10/cipher.h | 108 |
1 files changed, 108 insertions, 0 deletions
diff --git a/g10/cipher.h b/g10/cipher.h new file mode 100644 index 000000000..7e784d238 --- /dev/null +++ b/g10/cipher.h @@ -0,0 +1,108 @@ +/* cipher.h - Definitions for OpenPGP + * Copyright (C) 1998, 1999, 2000, 2001, 2006, + * 2007, 2010 Free Software Foundation, Inc. + * + * This file is part of GnuPG. + * + * GnuPG is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * GnuPG is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see <http://www.gnu.org/licenses/>. + */ +#ifndef G10_CIPHER_H +#define G10_CIPHER_H + +#include <gcrypt.h> + +/* Constants for OpenPGP. */ + +#define CIPHER_ALGO_NONE /* 0 */ GCRY_CIPHER_NONE +#define CIPHER_ALGO_IDEA /* 1 */ GCRY_CIPHER_IDEA +#define CIPHER_ALGO_3DES /* 2 */ GCRY_CIPHER_3DES +#define CIPHER_ALGO_CAST5 /* 3 */ GCRY_CIPHER_CAST5 +#define CIPHER_ALGO_BLOWFISH /* 4 */ GCRY_CIPHER_BLOWFISH /* 128 bit */ +/* 5 & 6 are reserved */ +#define CIPHER_ALGO_AES /* 7 */ GCRY_CIPHER_AES +#define CIPHER_ALGO_AES192 /* 8 */ GCRY_CIPHER_AES192 +#define CIPHER_ALGO_AES256 /* 9 */ GCRY_CIPHER_AES256 +#define CIPHER_ALGO_RIJNDAEL CIPHER_ALGO_AES +#define CIPHER_ALGO_RIJNDAEL192 CIPHER_ALGO_AES192 +#define CIPHER_ALGO_RIJNDAEL256 CIPHER_ALGO_AES256 +#define CIPHER_ALGO_TWOFISH /* 10 */ GCRY_CIPHER_TWOFISH /* 256 bit */ +/* Note: Camellia ids don't match those used by libgcrypt. */ +#define CIPHER_ALGO_CAMELLIA128 11 +#define CIPHER_ALGO_CAMELLIA192 12 +#define CIPHER_ALGO_CAMELLIA256 13 +#define CIPHER_ALGO_DUMMY 110 /* No encryption at all. */ + +#define PUBKEY_ALGO_RSA /* 1 */ GCRY_PK_RSA +#define PUBKEY_ALGO_RSA_E /* 2 */ GCRY_PK_RSA_E /* RSA encrypt only. */ +#define PUBKEY_ALGO_RSA_S /* 3 */ GCRY_PK_RSA_S /* RSA sign only. */ +#define PUBKEY_ALGO_ELGAMAL_E /* 16 */ GCRY_PK_ELG_E /* Elgamal encr only */ +#define PUBKEY_ALGO_DSA /* 17 */ GCRY_PK_DSA +#define PUBKEY_ALGO_ECDH 18 +#define PUBKEY_ALGO_ECDSA 19 +#define PUBKEY_ALGO_ELGAMAL /* 20 */ GCRY_PK_ELG /* Elgamal encr+sign */ +#define PUBKEY_ALGO_EDDSA 105 /* Experimental! */ + +#define PUBKEY_USAGE_SIG GCRY_PK_USAGE_SIGN /* Good for signatures. */ +#define PUBKEY_USAGE_ENC GCRY_PK_USAGE_ENCR /* Good for encryption. */ +#define PUBKEY_USAGE_CERT GCRY_PK_USAGE_CERT /* Also good to certify keys.*/ +#define PUBKEY_USAGE_AUTH GCRY_PK_USAGE_AUTH /* Good for authentication. */ +#define PUBKEY_USAGE_UNKNOWN GCRY_PK_USAGE_UNKN /* Unknown usage flag. */ +#define PUBKEY_USAGE_NONE 256 /* No usage given. */ +#if (GCRY_PK_USAGE_SIGN | GCRY_PK_USAGE_ENCR | GCRY_PK_USAGE_CERT \ + | GCRY_PK_USAGE_AUTH | GCRY_PK_USAGE_UNKN) >= 256 +# error Please choose another value for PUBKEY_USAGE_NONE +#endif + +#define DIGEST_ALGO_MD5 /* 1 */ GCRY_MD_MD5 +#define DIGEST_ALGO_SHA1 /* 2 */ GCRY_MD_SHA1 +#define DIGEST_ALGO_RMD160 /* 3 */ GCRY_MD_RMD160 +/* 4, 5, 6, and 7 are reserved */ +#define DIGEST_ALGO_SHA256 /* 8 */ GCRY_MD_SHA256 +#define DIGEST_ALGO_SHA384 /* 9 */ GCRY_MD_SHA384 +#define DIGEST_ALGO_SHA512 /* 10 */ GCRY_MD_SHA512 +/* SHA224 is only available in libgcrypt 1.4.0; thus we + can't use the GCRY macro here. */ +#define DIGEST_ALGO_SHA224 /* 11 */ 11 /* GCRY_MD_SHA224 */ + +#define COMPRESS_ALGO_NONE 0 +#define COMPRESS_ALGO_ZIP 1 +#define COMPRESS_ALGO_ZLIB 2 +#define COMPRESS_ALGO_BZIP2 3 + +#define is_RSA(a) ((a)==PUBKEY_ALGO_RSA || (a)==PUBKEY_ALGO_RSA_E \ + || (a)==PUBKEY_ALGO_RSA_S ) +#define is_ELGAMAL(a) ((a)==PUBKEY_ALGO_ELGAMAL_E) +#define is_DSA(a) ((a)==PUBKEY_ALGO_DSA) + +/* The data encryption key object. */ +typedef struct +{ + int algo; + int keylen; + int algo_info_printed; + int use_mdc; + int symmetric; + byte key[32]; /* This is the largest used keylen (256 bit). */ + char s2k_cacheid[1+16+1]; +} DEK; + + + +/* Constants to allocate static MPI arrays. */ +#define PUBKEY_MAX_NPKEY 5 +#define PUBKEY_MAX_NSKEY 7 +#define PUBKEY_MAX_NSIG 2 +#define PUBKEY_MAX_NENC 2 + +#endif /*G10_CIPHER_H*/ |