2 * pppcrypt.c - PPP/DES linkage for MS-CHAP and EAP SRP-SHA1
4 * Extracted from chap_ms.c by James Carlson.
5 * Updated to better reflect RFC2759 by Eivind Naess
7 * Copyright (c) 2022 Eivind Naess. All rights reserved.
8 * Copyright (c) 1995 Eric Rosenquist. All rights reserved.
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
17 * 2. Redistributions in binary form must reproduce the above copyright
18 * notice, this list of conditions and the following disclaimer in
19 * the documentation and/or other materials provided with the
22 * 3. The name(s) of the authors of this software must not be used to
23 * endorse or promote products derived from this software without
24 * prior written permission.
26 * THE AUTHORS OF THIS SOFTWARE DISCLAIM ALL WARRANTIES WITH REGARD TO
27 * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
28 * AND FITNESS, IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
29 * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
30 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
31 * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
32 * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
34 #ifndef PPP_PPPCRYPT_H
35 #define PPP_PPPCRYPT_H
44 * This is the DES encrypt functions as described by RFC2759.
47 * const unsigned char *clear:
48 * A 8 byte input array to be encrypted
50 * const unsigned char *key:
51 * A raw 7-byte array to be expanded to 8 with odd-parity
53 * unsigned char *cipher:
54 * A 8 byte outut array providing space for the output data
56 * DesEncrypt returns 1 on success
58 int DesEncrypt(const unsigned char *clear, const unsigned char *key,
59 unsigned char *cipher);
62 * This is the DES decrypt functions as described by RFC2759.
65 * const unsigned char *cipher:
66 * A 8 byte input array to be decrypted
68 * const unsigned char *key:
69 * A raw 7-byte array to be expanded to a 8-byte key with odd-parity
71 * unsigned char *clear:
72 * A 8 byte output array providing space for the output data
74 * DesDecrypt returns 1 on success
76 int DesDecrypt(const unsigned char *cipher, const unsigned char *key,
77 unsigned char *clear);
83 #endif /* PPP_PPPCRYPT_H */