| 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 |
* Updated to better reflect RFC2759 by Eivind Naess |
| 6 |
* |
| 7 |
* Copyright (c) 2022 Eivind Naess. All rights reserved. |
| 8 |
* Copyright (c) 1995 Eric Rosenquist. All rights reserved. |
| 9 |
* |
| 10 |
* Redistribution and use in source and binary forms, with or without |
| 11 |
* modification, are permitted provided that the following conditions |
| 12 |
* are met: |
| 13 |
* |
| 14 |
* 1. Redistributions of source code must retain the above copyright |
| 15 |
* notice, this list of conditions and the following disclaimer. |
| 16 |
* |
| 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 |
| 20 |
* distribution. |
| 21 |
* |
| 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. |
| 25 |
* |
| 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. |
| 33 |
*/ |
| 34 |
#ifndef PPP_PPPCRYPT_H |
| 35 |
#define PPP_PPPCRYPT_H |
| 36 |
|
| 37 |
#include "pppdconf.h" |
| 38 |
|
| 39 |
#ifdef __cplusplus |
| 40 |
extern "C" { |
| 41 |
#endif |
| 42 |
|
| 43 |
/** |
| 44 |
* This is the DES encrypt functions as described by RFC2759. |
| 45 |
* |
| 46 |
* Parameters: |
| 47 |
* const unsigned char *clear: |
| 48 |
* A 8 byte input array to be encrypted |
| 49 |
* |
| 50 |
* const unsigned char *key: |
| 51 |
* A raw 7-byte array to be expanded to 8 with odd-parity |
| 52 |
* |
| 53 |
* unsigned char *cipher: |
| 54 |
* A 8 byte outut array providing space for the output data |
| 55 |
* |
| 56 |
* DesEncrypt returns 1 on success |
| 57 |
*/ |
| 58 |
int DesEncrypt(const unsigned char *clear, const unsigned char *key, |
| 59 |
unsigned char *cipher); |
| 60 |
|
| 61 |
/** |
| 62 |
* This is the DES decrypt functions as described by RFC2759. |
| 63 |
* |
| 64 |
* Parameters: |
| 65 |
* const unsigned char *cipher: |
| 66 |
* A 8 byte input array to be decrypted |
| 67 |
* |
| 68 |
* const unsigned char *key: |
| 69 |
* A raw 7-byte array to be expanded to a 8-byte key with odd-parity |
| 70 |
* |
| 71 |
* unsigned char *clear: |
| 72 |
* A 8 byte output array providing space for the output data |
| 73 |
* |
| 74 |
* DesDecrypt returns 1 on success |
| 75 |
*/ |
| 76 |
int DesDecrypt(const unsigned char *cipher, const unsigned char *key, |
| 77 |
unsigned char *clear); |
| 78 |
|
| 79 |
#ifdef __cplusplus |
| 80 |
} |
| 81 |
#endif |
| 82 |
|
| 83 |
#endif /* PPP_PPPCRYPT_H */ |