New source file added to acquire environmental noise and add it to the
[become] / src / blowfish.h
CommitLineData
c4f2d992 1/* -*-c-*-
2 *
03f996bd 3 * $Id: blowfish.h,v 1.2 1997/08/04 10:24:20 mdw Exp $
c4f2d992 4 *
5 * Blowfish encryption routines
6 *
7 * (c) 1997 Mark Wooding
8 */
9
10/*----- Licencing notice --------------------------------------------------*
11 *
12 * This file is part of `become'
13 *
14 * `Become' is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 2 of the License, or
17 * (at your option) any later version.
18 *
19 * `Become' is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
23 *
24 * You should have received a copy of the GNU General Public License
25 * along with `become'; if not, write to the Free Software
26 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
27 */
28
29/*----- Revision history --------------------------------------------------*
30 *
31 * $Log: blowfish.h,v $
03f996bd 32 * Revision 1.2 1997/08/04 10:24:20 mdw
33 * Sources placed under CVS control.
34 *
35 * Revision 1.1 1997/07/21 13:47:53 mdw
c4f2d992 36 * Initial revision
37 *
38 */
39
40#ifndef BLOWFISH_H
41#define BLOWFISH_H
42
43#ifdef __cplusplus
44 extern "C" {
45#endif
46
47/*----- Type definitions --------------------------------------------------*/
48
49/* --- A blowfish expanded key --- */
50
51typedef struct blowfish_key {
52 uint_32 p[18];
53 uint_32 s0[256];
54 uint_32 s1[256];
55 uint_32 s2[256];
56 uint_32 s3[256];
57} blowfish_key;
58
59/*----- Functions provided ------------------------------------------------*/
60
61/* --- @blowfish_encrypt@ --- *
62 *
63 * Arguments: @const blowfish_key *k@ = pointer to key block
64 * @const voic *from@ = block to encrypt from
65 * @void *to@ = block to encrypt to
66 *
67 * Returns: ---
68 *
69 * Use: Encrypts a block using the Blowfish algorithm.
70 */
71
72extern void blowfish_encrypt(const blowfish_key */*k*/,
73 const void */*from*/, void */*to*/);
74
75
76/* --- @blowfish_decrypt@ --- *
77 *
78 * Arguments: @const blowfish_key *k@ = pointer to key block
79 * @const void *from@ = block to decrypt from
80 * @void *to@ = block to decrypt to
81 *
82 * Returns: ---
83 *
84 * Use: Decrypts a block using the Blowfish algorithm.
85 */
86
87extern void blowfish_decrypt(const blowfish_key */*k*/,
88 const void */*from*/, void */*to*/);
89
90/* --- @blowfish_setKey@ --- *
91 *
92 * Arguments: @blowfish_key *kb@ = pointer to key block to fill
93 * @void *k@ = pointer to key data
94 * @size_t sz@ = length of data in bytes
95 *
96 * Returns: ---
97 *
98 * Use: Expands a key which isn't represented as a number of whole
99 * words. This is a nonstandard extension, although it can be
100 * used to support 40-bit keys, which some governments might
101 * find more palatable than 160-bit (or 448-bit!) keys.
102 */
103
104extern void blowfish_setKey(blowfish_key */*kb*/,
105 const void */*k*/, size_t /*sz*/);
106
107/*----- That's all, folks -------------------------------------------------*/
108
109#ifdef __cplusplus
110 }
111#endif
112
113#endif