Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/nettle/arctwo.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /* arctwo.h
0002 
0003    The arctwo/rfc2268 block cipher.
0004 
0005    Copyright (C) 2004 Simon Josefsson
0006    Copyright (C) 2002, 2004, 2014 Niels Möller
0007 
0008    This file is part of GNU Nettle.
0009 
0010    GNU Nettle is free software: you can redistribute it and/or
0011    modify it under the terms of either:
0012 
0013      * the GNU Lesser General Public License as published by the Free
0014        Software Foundation; either version 3 of the License, or (at your
0015        option) any later version.
0016 
0017    or
0018 
0019      * the GNU General Public License as published by the Free
0020        Software Foundation; either version 2 of the License, or (at your
0021        option) any later version.
0022 
0023    or both in parallel, as here.
0024 
0025    GNU Nettle is distributed in the hope that it will be useful,
0026    but WITHOUT ANY WARRANTY; without even the implied warranty of
0027    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0028    General Public License for more details.
0029 
0030    You should have received copies of the GNU General Public License and
0031    the GNU Lesser General Public License along with this program.  If
0032    not, see http://www.gnu.org/licenses/.
0033 */
0034 
0035 #ifndef NETTLE_ARCTWO_H_INCLUDED
0036 #define NETTLE_ARCTWO_H_INCLUDED
0037 
0038 #include "nettle-types.h"
0039 
0040 #ifdef __cplusplus
0041 extern "C" {
0042 #endif
0043 
0044 /* Name mangling */
0045 #define arctwo_set_key nettle_arctwo_set_key
0046 #define arctwo_set_key_ekb nettle_arctwo_set_key_ekb
0047 #define arctwo_set_key_gutmann nettle_arctwo_set_key_gutmann
0048 #define arctwo40_set_key nettle_arctwo40_set_key
0049 #define arctwo64_set_key nettle_arctwo64_set_key
0050 #define arctwo128_set_key nettle_arctwo128_set_key
0051 #define arctwo128_set_key_gutmann nettle_arctwo128_set_key_gutmann
0052 #define arctwo_encrypt nettle_arctwo_encrypt
0053 #define arctwo_decrypt nettle_arctwo_decrypt
0054 
0055 #define ARCTWO_BLOCK_SIZE 8
0056 
0057 /* Variable key size from 1 byte to 128 bytes. */
0058 #define ARCTWO_MIN_KEY_SIZE 1
0059 #define ARCTWO_MAX_KEY_SIZE 128
0060 
0061 #define ARCTWO_KEY_SIZE 8
0062 
0063 struct arctwo_ctx
0064 {
0065   uint16_t S[64];
0066 };
0067 
0068 /* Key expansion function that takes the "effective key bits", 1-1024,
0069    as an explicit argument. 0 means maximum key bits. */
0070 void
0071 arctwo_set_key_ekb (struct arctwo_ctx *ctx,
0072             size_t length, const uint8_t * key, unsigned ekb);
0073 
0074 /* Equvivalent to arctwo_set_key_ekb, with ekb = 8 * length */
0075 void
0076 arctwo_set_key (struct arctwo_ctx *ctx, size_t length, const uint8_t *key);
0077 void
0078 arctwo40_set_key (struct arctwo_ctx *ctx, const uint8_t *key);
0079 void
0080 arctwo64_set_key (struct arctwo_ctx *ctx, const uint8_t *key);
0081 void
0082 arctwo128_set_key (struct arctwo_ctx *ctx, const uint8_t *key);
0083 
0084 /* Equvivalent to arctwo_set_key_ekb, with ekb = 1024 */
0085 void
0086 arctwo_set_key_gutmann (struct arctwo_ctx *ctx,
0087             size_t length, const uint8_t *key);
0088 void
0089 arctwo128_set_key_gutmann (struct arctwo_ctx *ctx,
0090                const uint8_t *key);
0091 
0092 void
0093 arctwo_encrypt (struct arctwo_ctx *ctx,
0094         size_t length, uint8_t *dst, const uint8_t *src);
0095 void
0096 arctwo_decrypt (struct arctwo_ctx *ctx,
0097         size_t length, uint8_t *dst, const uint8_t *src);
0098 
0099 #ifdef __cplusplus
0100 }
0101 #endif
0102 
0103 #endif /* NETTLE_ARCTWO_H_INCLUDED */