1 /* arctwo.h --- The arctwo block cipher
2 * Copyright (C) 2000, 2001, 2002, 2003, 2005, 2009, 2010 Free Software
5 * This file is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published
7 * by the Free Software Foundation; either version 2, or (at your
8 * option) any later version.
10 * This file is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this file; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
22 /* Code from Libgcrypt adapted for gnulib by Simon Josefsson. */
35 #define ARCTWO_BLOCK_SIZE 8
37 /* Initialize CONTEXT using KEY of KEYLEN length. If
38 EFFECTIVE_KEYLEN, truncate the key (using a special algorithm) to
39 only be of EFFECTIVE_KEYLEN bits. Normally, you use
40 EFFECTIVE_KEYLEN of 0, but see RFC 2268 for more information. */
42 arctwo_setkey_ekb (arctwo_context *context,
43 size_t keylen, const char *key, size_t effective_keylen);
45 #define arctwo_setkey(context,keylen,key) \
46 arctwo_setkey_ekb (context, keylen, key, 8 * (keylen))
48 /* Encrypt INBUF of size LENGTH into OUTBUF. LENGTH must be a
49 multiple of ARCTWO_BLOCK_SIZE. CONTEXT hold the encryption key,
50 and must have been initialized with arctwo_setkey or
53 arctwo_encrypt (arctwo_context *context, const char *inbuf,
54 char *outbuf, size_t length);
56 /* Decrypt INBUF of size LENGTH into OUTBUF. LENGTH must be a
57 multiple of ARCTWO_BLOCK_SIZE. CONTEXT hold the decryption key,
58 and must have been initialized with arctwo_setkey or
61 arctwo_decrypt (arctwo_context *context, const char *inbuf,
62 char *outbuf, size_t length);