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