OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [ecos-2.0/] [packages/] [net/] [tcpip/] [v2_0/] [include/] [netinet/] [ip_blf.h] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1254 phoenix
//==========================================================================
2
//
3
//      include/netinet/ip_blf.h
4
//
5
//      
6
//
7
//==========================================================================
8
//####BSDCOPYRIGHTBEGIN####
9
//
10
// -------------------------------------------
11
//
12
// Portions of this software may have been derived from OpenBSD or other sources,
13
// and are covered by the appropriate copyright disclaimers included herein.
14
//
15
// -------------------------------------------
16
//
17
//####BSDCOPYRIGHTEND####
18
//==========================================================================
19
//#####DESCRIPTIONBEGIN####
20
//
21
// Author(s):    gthomas
22
// Contributors: gthomas
23
// Date:         2000-01-10
24
// Purpose:      
25
// Description:  
26
//              
27
//
28
//####DESCRIPTIONEND####
29
//
30
//==========================================================================
31
 
32
 
33
/* $OpenBSD: ip_blf.h,v 1.2 1999/02/23 05:15:09 angelos Exp $ */
34
/*
35
 * Blowfish - a fast block cipher designed by Bruce Schneier
36
 *
37
 * Copyright 1997 Niels Provos <provos@physnet.uni-hamburg.de>
38
 * All rights reserved.
39
 *
40
 * Redistribution and use in source and binary forms, with or without
41
 * modification, are permitted provided that the following conditions
42
 * are met:
43
 * 1. Redistributions of source code must retain the above copyright
44
 *    notice, this list of conditions and the following disclaimer.
45
 * 2. Redistributions in binary form must reproduce the above copyright
46
 *    notice, this list of conditions and the following disclaimer in the
47
 *    documentation and/or other materials provided with the distribution.
48
 * 3. All advertising materials mentioning features or use of this software
49
 *    must display the following acknowledgement:
50
 *      This product includes software developed by Niels Provos.
51
 * 4. The name of the author may not be used to endorse or promote products
52
 *    derived from this software without specific prior written permission.
53
 *
54
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
55
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
56
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
57
 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
58
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
59
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
60
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
61
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
62
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
63
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
64
 */
65
 
66
#ifndef _NETINET_IP_BLF_H_
67
#define _NETINET_IP_BLF_H_
68
 
69
/* Schneier states the maximum key length to be 56 bytes.
70
 * The way how the subkeys are initalized by the key up
71
 * to (N+2)*4 i.e. 72 bytes are utilized.
72
 * Warning: For normal blowfish encryption only 56 bytes
73
 * of the key affect all cipherbits.
74
 */
75
 
76
#define BLF_N   16                      /* Number of Subkeys */
77
#define BLF_MAXKEYLEN ((BLF_N-2)*4)     /* 448 bits */
78
 
79
/* Blowfish context */
80
typedef struct BlowfishContext {
81
        u_int32_t S[4][256];    /* S-Boxes */
82
        u_int32_t P[BLF_N + 2]; /* Subkeys */
83
} blf_ctx;
84
 
85
/* Raw access to customized Blowfish
86
 *      blf_key is just:
87
 *      Blowfish_initstate( state )
88
 *      Blowfish_expand0state( state, key, keylen )
89
 */
90
 
91
void Blowfish_encipher __P((blf_ctx *, u_int32_t *, u_int32_t *));
92
void Blowfish_decipher __P((blf_ctx *, u_int32_t *, u_int32_t *));
93
void Blowfish_initstate __P((blf_ctx *));
94
void Blowfish_expand0state __P((blf_ctx *, const u_int8_t *, u_int16_t));
95
void Blowfish_expandstate
96
    __P((blf_ctx *, const u_int8_t *, u_int16_t, const u_int8_t *, u_int16_t));
97
 
98
/* Standard Blowfish */
99
 
100
void blf_key __P((blf_ctx *, const u_int8_t *, u_int16_t));
101
void blf_enc __P((blf_ctx *, u_int32_t *, u_int16_t));
102
void blf_dec __P((blf_ctx *, u_int32_t *, u_int16_t));
103
 
104
/* Converts u_int8_t to u_int32_t */
105
u_int32_t Blowfish_stream2word __P((const u_int8_t *, u_int16_t ,
106
                                    u_int16_t *));
107
 
108
void blf_ecb_encrypt __P((blf_ctx *, u_int8_t *, u_int32_t));
109
void blf_ecb_decrypt __P((blf_ctx *, u_int8_t *, u_int32_t));
110
 
111
#endif // _NETINET_IP_BLF_H_

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.