Mistake on this page?
Report an issue in GitHub or email us
des.h
1 /**
2  * /@code
3  *
4  * \file des.h
5  *
6  * Based on XySSL: Copyright (C) 2006-2008 Christophe Devine
7  *
8  * Copyright (C) 2009 Paul Bakker <polarssl_maintainer at polarssl dot org>
9  *
10  * All rights reserved.
11  *
12  * Redistribution and use in source and binary forms, with or without
13  * modification, are permitted provided that the following conditions
14  * are met:
15  *
16  * * Redistributions of source code must retain the above copyright
17  * notice, this list of conditions and the following disclaimer.
18  * * Redistributions in binary form must reproduce the above copyright
19  * notice, this list of conditions and the following disclaimer in the
20  * documentation and/or other materials provided with the distribution.
21  * * Neither the names of PolarSSL or XySSL nor the names of its contributors
22  * may be used to endorse or promote products derived from this software
23  * without specific prior written permission.
24  *
25  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
28  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
29  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
30  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
31  * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
32  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
34  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36  *
37  * /@endcode
38  *
39  */
40 
41 #include "ppp_opts.h"
42 #if PPP_INCLUDED_POLARSSL_DES
43 
44 #ifndef PPP_INCLUDED_POLARSSL_DES_H
45 #define PPP_INCLUDED_POLARSSL_DES_H
46 
47 #define DES_ENCRYPT 1
48 #define DES_DECRYPT 0
49 
50 /**
51  * \brief DES context structure
52  */
53 typedef struct
54 {
55  int mode; /*!< encrypt/decrypt */
56  unsigned long sk[32]; /*!< DES subkeys */
57 }
58 des_context;
59 
60 #ifdef __cplusplus
61 extern "C" {
62 #endif
63 
64 /**
65  * \brief DES key schedule (56-bit, encryption)
66  *
67  * \param ctx DES context to be initialized
68  * \param key 8-byte secret key
69  */
70 void des_setkey_enc( des_context *ctx, unsigned char key[8] );
71 
72 /**
73  * \brief DES key schedule (56-bit, decryption)
74  *
75  * \param ctx DES context to be initialized
76  * \param key 8-byte secret key
77  */
78 void des_setkey_dec( des_context *ctx, unsigned char key[8] );
79 
80 /**
81  * \brief DES-ECB block encryption/decryption
82  *
83  * \param ctx DES context
84  * \param input 64-bit input block
85  * \param output 64-bit output block
86  */
87 void des_crypt_ecb( des_context *ctx,
88  const unsigned char input[8],
89  unsigned char output[8] );
90 
91 #ifdef __cplusplus
92 }
93 #endif
94 
95 #endif /* PPP_INCLUDED_POLARSSL_DES_H */
96 
97 #endif /* PPP_INCLUDED_POLARSSL_DES */
Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.