Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: TYBLE16_simple_data_logger TYBLE16_MP3_Air
des.h
00001 /** 00002 * /@code 00003 * 00004 * \file des.h 00005 * 00006 * Based on XySSL: Copyright (C) 2006-2008 Christophe Devine 00007 * 00008 * Copyright (C) 2009 Paul Bakker <polarssl_maintainer at polarssl dot org> 00009 * 00010 * All rights reserved. 00011 * 00012 * Redistribution and use in source and binary forms, with or without 00013 * modification, are permitted provided that the following conditions 00014 * are met: 00015 * 00016 * * Redistributions of source code must retain the above copyright 00017 * notice, this list of conditions and the following disclaimer. 00018 * * Redistributions in binary form must reproduce the above copyright 00019 * notice, this list of conditions and the following disclaimer in the 00020 * documentation and/or other materials provided with the distribution. 00021 * * Neither the names of PolarSSL or XySSL nor the names of its contributors 00022 * may be used to endorse or promote products derived from this software 00023 * without specific prior written permission. 00024 * 00025 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00026 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00027 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 00028 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 00029 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 00030 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 00031 * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 00032 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 00033 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 00034 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00035 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00036 * 00037 * /@endcode 00038 * 00039 */ 00040 00041 #include "ppp_opts.h" 00042 #if PPP_INCLUDED_POLARSSL_DES 00043 00044 #ifndef PPP_INCLUDED_POLARSSL_DES_H 00045 #define PPP_INCLUDED_POLARSSL_DES_H 00046 00047 #define DES_ENCRYPT 1 00048 #define DES_DECRYPT 0 00049 00050 /** 00051 * \brief DES context structure 00052 */ 00053 typedef struct 00054 { 00055 int mode ; /*!< encrypt/decrypt */ 00056 unsigned long sk[32]; /*!< DES subkeys */ 00057 } 00058 des_context; 00059 00060 #ifdef __cplusplus 00061 extern "C" { 00062 #endif 00063 00064 /** 00065 * \brief DES key schedule (56-bit, encryption) 00066 * 00067 * \param ctx DES context to be initialized 00068 * \param key 8-byte secret key 00069 */ 00070 void des_setkey_enc( des_context *ctx, unsigned char key[8] ); 00071 00072 /** 00073 * \brief DES key schedule (56-bit, decryption) 00074 * 00075 * \param ctx DES context to be initialized 00076 * \param key 8-byte secret key 00077 */ 00078 void des_setkey_dec( des_context *ctx, unsigned char key[8] ); 00079 00080 /** 00081 * \brief DES-ECB block encryption/decryption 00082 * 00083 * \param ctx DES context 00084 * \param input 64-bit input block 00085 * \param output 64-bit output block 00086 */ 00087 void des_crypt_ecb( des_context *ctx, 00088 const unsigned char input[8], 00089 unsigned char output[8] ); 00090 00091 #ifdef __cplusplus 00092 } 00093 #endif 00094 00095 #endif /* PPP_INCLUDED_POLARSSL_DES_H */ 00096 00097 #endif /* PPP_INCLUDED_POLARSSL_DES */
Generated on Tue Jul 12 2022 13:54:16 by
