sdk-core v2026.11.05
PS2 SDK - core tier (build-critical EE/IOP modules)
Loading...
Searching...
No Matches
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
37#include "netif/ppp/ppp_opts.h"
38#if PPP_SUPPORT /* don't build if not configured for use in lwipopts.h */
39
40/* This header file is included in all PPP modules needing hashes and/or ciphers */
41
42#ifndef PPPCRYPT_H
43#define PPPCRYPT_H
44
45/*
46 * If included PolarSSL copy is not used, user is expected to include
47 * external libraries in arch/cc.h (which is included by lwip/arch.h).
48 */
49#include "lwip/arch.h"
50
51#ifdef __cplusplus
52extern "C" {
53#endif
54
55/*
56 * Map hashes and ciphers functions to PolarSSL
57 */
58#if !LWIP_USE_EXTERNAL_MBEDTLS
59
61#define lwip_md4_context md4_context
62#define lwip_md4_init(context)
63#define lwip_md4_starts md4_starts
64#define lwip_md4_update md4_update
65#define lwip_md4_finish md4_finish
66#define lwip_md4_free(context)
67
69#define lwip_md5_context md5_context
70#define lwip_md5_init(context)
71#define lwip_md5_starts md5_starts
72#define lwip_md5_update md5_update
73#define lwip_md5_finish md5_finish
74#define lwip_md5_free(context)
75
77#define lwip_sha1_context sha1_context
78#define lwip_sha1_init(context)
79#define lwip_sha1_starts sha1_starts
80#define lwip_sha1_update sha1_update
81#define lwip_sha1_finish sha1_finish
82#define lwip_sha1_free(context)
83
85#define lwip_des_context des_context
86#define lwip_des_init(context)
87#define lwip_des_setkey_enc des_setkey_enc
88#define lwip_des_crypt_ecb des_crypt_ecb
89#define lwip_des_free(context)
90
92#define lwip_arc4_context arc4_context
93#define lwip_arc4_init(context)
94#define lwip_arc4_setup arc4_setup
95#define lwip_arc4_crypt arc4_crypt
96#define lwip_arc4_free(context)
97
98#endif /* !LWIP_USE_EXTERNAL_MBEDTLS */
99
100/*
101 * Map hashes and ciphers functions to mbed TLS
102 */
103#if LWIP_USE_EXTERNAL_MBEDTLS
104
105#define lwip_md4_context mbedtls_md4_context
106#define lwip_md4_init mbedtls_md4_init
107#define lwip_md4_starts mbedtls_md4_starts
108#define lwip_md4_update mbedtls_md4_update
109#define lwip_md4_finish mbedtls_md4_finish
110#define lwip_md4_free mbedtls_md4_free
111
112#define lwip_md5_context mbedtls_md5_context
113#define lwip_md5_init mbedtls_md5_init
114#define lwip_md5_starts mbedtls_md5_starts
115#define lwip_md5_update mbedtls_md5_update
116#define lwip_md5_finish mbedtls_md5_finish
117#define lwip_md5_free mbedtls_md5_free
118
119#define lwip_sha1_context mbedtls_sha1_context
120#define lwip_sha1_init mbedtls_sha1_init
121#define lwip_sha1_starts mbedtls_sha1_starts
122#define lwip_sha1_update mbedtls_sha1_update
123#define lwip_sha1_finish mbedtls_sha1_finish
124#define lwip_sha1_free mbedtls_sha1_free
125
126#define lwip_des_context mbedtls_des_context
127#define lwip_des_init mbedtls_des_init
128#define lwip_des_setkey_enc mbedtls_des_setkey_enc
129#define lwip_des_crypt_ecb mbedtls_des_crypt_ecb
130#define lwip_des_free mbedtls_des_free
131
132#define lwip_arc4_context mbedtls_arc4_context
133#define lwip_arc4_init mbedtls_arc4_init
134#define lwip_arc4_setup mbedtls_arc4_setup
135#define lwip_arc4_crypt(context, buffer, length) mbedtls_arc4_crypt(context, length, buffer, buffer)
136#define lwip_arc4_free mbedtls_arc4_free
137
138#endif /* LWIP_USE_EXTERNAL_MBEDTLS */
139
140void pppcrypt_56_to_64_bit_key(u_char *key, u_char *des_key);
141
142#ifdef __cplusplus
143}
144#endif
145
146#endif /* PPPCRYPT_H */
147
148#endif /* PPP_SUPPORT */