UbixOS V2 2.0

pppcrypt.h
Go to the documentation of this file.
1 /*
2 * pppcrypt.c - PPP/DES linkage for MS-CHAP and EAP SRP-SHA1
3 *
4 * Extracted from chap_ms.c by James Carlson.
5 *
6 * Copyright (c) 1995 Eric Rosenquist. All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 *
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 *
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in
17 * the documentation and/or other materials provided with the
18 * distribution.
19 *
20 * 3. The name(s) of the authors of this software must not be used to
21 * endorse or promote products derived from this software without
22 * prior written permission.
23 *
24 * THE AUTHORS OF THIS SOFTWARE DISCLAIM ALL WARRANTIES WITH REGARD TO
25 * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
26 * AND FITNESS, IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
27 * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
28 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
29 * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
30 * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
31 */
32
33 #include "netif/ppp/ppp_opts.h"
34 #if PPP_SUPPORT /* don't build if not configured for use in lwipopts.h */
35
36 /* This header file is included in all PPP modules needing hashes and/or ciphers */
37
38 #ifndef PPPCRYPT_H
39 #define PPPCRYPT_H
40
41 /*
42 * If included PolarSSL copy is not used, user is expected to include
43 * external libraries in arch/cc.h (which is included by lwip/arch.h).
44 */
45 #include "net/arch.h"
46
47 /*
48 * Map hashes and ciphers functions to PolarSSL
49 */
50 #if !LWIP_USE_EXTERNAL_MBEDTLS
51
52 #include "netif/ppp/polarssl/md4.h"
53 #define lwip_md4_context md4_context
54 #define lwip_md4_init(context)
55 #define lwip_md4_starts md4_starts
56 #define lwip_md4_update md4_update
57 #define lwip_md4_finish md4_finish
58 #define lwip_md4_free(context)
59
60 #include "netif/ppp/polarssl/md5.h"
61 #define lwip_md5_context md5_context
62 #define lwip_md5_init(context)
63 #define lwip_md5_starts md5_starts
64 #define lwip_md5_update md5_update
65 #define lwip_md5_finish md5_finish
66 #define lwip_md5_free(context)
67
68 #include "netif/ppp/polarssl/sha1.h"
69 #define lwip_sha1_context sha1_context
70 #define lwip_sha1_init(context)
71 #define lwip_sha1_starts sha1_starts
72 #define lwip_sha1_update sha1_update
73 #define lwip_sha1_finish sha1_finish
74 #define lwip_sha1_free(context)
75
76 #include "netif/ppp/polarssl/des.h"
77 #define lwip_des_context des_context
78 #define lwip_des_init(context)
79 #define lwip_des_setkey_enc des_setkey_enc
80 #define lwip_des_crypt_ecb des_crypt_ecb
81 #define lwip_des_free(context)
82
83 #include "netif/ppp/polarssl/arc4.h"
84 #define lwip_arc4_context arc4_context
85 #define lwip_arc4_init(context)
86 #define lwip_arc4_setup arc4_setup
87 #define lwip_arc4_crypt arc4_crypt
88 #define lwip_arc4_free(context)
89
90 #endif /* !LWIP_USE_EXTERNAL_MBEDTLS */
91
92 /*
93 * Map hashes and ciphers functions to mbed TLS
94 */
95 #if LWIP_USE_EXTERNAL_MBEDTLS
96
97 #define lwip_md4_context mbedtls_md4_context
98 #define lwip_md4_init mbedtls_md4_init
99 #define lwip_md4_starts mbedtls_md4_starts
100 #define lwip_md4_update mbedtls_md4_update
101 #define lwip_md4_finish mbedtls_md4_finish
102 #define lwip_md4_free mbedtls_md4_free
103
104 #define lwip_md5_context mbedtls_md5_context
105 #define lwip_md5_init mbedtls_md5_init
106 #define lwip_md5_starts mbedtls_md5_starts
107 #define lwip_md5_update mbedtls_md5_update
108 #define lwip_md5_finish mbedtls_md5_finish
109 #define lwip_md5_free mbedtls_md5_free
110
111 #define lwip_sha1_context mbedtls_sha1_context
112 #define lwip_sha1_init mbedtls_sha1_init
113 #define lwip_sha1_starts mbedtls_sha1_starts
114 #define lwip_sha1_update mbedtls_sha1_update
115 #define lwip_sha1_finish mbedtls_sha1_finish
116 #define lwip_sha1_free mbedtls_sha1_free
117
118 #define lwip_des_context mbedtls_des_context
119 #define lwip_des_init mbedtls_des_init
120 #define lwip_des_setkey_enc mbedtls_des_setkey_enc
121 #define lwip_des_crypt_ecb mbedtls_des_crypt_ecb
122 #define lwip_des_free mbedtls_des_free
123
124 #define lwip_arc4_context mbedtls_arc4_context
125 #define lwip_arc4_init mbedtls_arc4_init
126 #define lwip_arc4_setup mbedtls_arc4_setup
127 #define lwip_arc4_crypt(context, buffer, length) mbedtls_arc4_crypt(context, length, buffer, buffer)
128 #define lwip_arc4_free mbedtls_arc4_free
129
130 #endif /* LWIP_USE_EXTERNAL_MBEDTLS */
131
132 void pppcrypt_56_to_64_bit_key(u_char *key, u_char *des_key);
133
134 #endif /* PPPCRYPT_H */
135
136 #endif /* PPP_SUPPORT */
sha1.h
arch.h
arc4.h
des.h
md4.h
md5.h
ppp_opts.h
u_char
unsigned char u_char
Definition: types.h:70