+/*
+ Bacula(R) - The Network Backup Solution
+
+ Copyright (C) 2000-2016 Kern Sibbald
+
+ The original author of Bacula is Kern Sibbald, with contributions
+ from many others, a complete list can be found in the file AUTHORS.
+
+ You may use this file and others of this release according to the
+ license defined in the LICENSE file, which includes the Affero General
+ Public License, v3.0 ("AGPLv3") and some additional permissions and
+ terms pursuant to its AGPLv3 Section 7.
+
+ This notice must be preserved when any source code is
+ conveyed and/or propagated.
+
+ Bacula(R) is a registered trademark of Kern Sibbald.
+*/
/*
* crypto.h Encryption support functions
*
*
* Version $Id$
*
- * Copyright (C) 2005 Kern Sibbald
- *
* This file was contributed to the Bacula project by Landon Fuller.
*
* Landon Fuller has been granted a perpetual, worldwide, non-exclusive,
* If you wish to license these contributions under an alternate open source
* license please contact Landon Fuller <landonf@opendarwin.org>.
*/
-/*
- Copyright (C) 2006 Kern Sibbald
-
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License
- version 2 as amended with additional clauses defined in the
- file LICENSE in the main source directory.
-
- This program 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
- the file LICENSE for additional details.
-
- */
#ifndef __CRYPTO_H_
#define __CRYPTO_H_
typedef struct X509_Keypair X509_KEYPAIR;
/* Opaque Message Digest Structure */
+/* Digest is defined (twice) in crypto.c */
typedef struct Digest DIGEST;
/* Opaque Message Signature Structure */
CRYPTO_DIGEST_SHA512 = 4
} crypto_digest_t;
+
+#ifdef HAVE_SHA2
+# define CRYPTO_DIGEST_DEFAULT CRYPTO_DIGEST_SHA256
+#else
+# define CRYPTO_DIGEST_DEFAULT CRYPTO_DIGEST_SHA1
+#endif
+
/* Cipher Types */
typedef enum {
/* These are not stored on disk */
- CRYPTO_CIPHER_AES_128_CBC,
+ CRYPTO_CIPHER_AES_128_CBC, /* Keep AES128 as the first one */
CRYPTO_CIPHER_AES_192_CBC,
CRYPTO_CIPHER_AES_256_CBC,
CRYPTO_CIPHER_BLOWFISH_CBC