Rtos API example

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers arc4.h Source File

arc4.h

00001 /**
00002  * \file arc4.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_ARC4
00038 
00039 #ifndef LWIP_INCLUDED_POLARSSL_ARC4_H
00040 #define LWIP_INCLUDED_POLARSSL_ARC4_H
00041 
00042 /**
00043  * \brief          ARC4 context structure
00044  */
00045 typedef struct
00046 {
00047     int x ;                      /*!< permutation index */
00048     int y ;                      /*!< permutation index */
00049     unsigned char m[256];       /*!< permutation table */
00050 }
00051 arc4_context;
00052 
00053 #ifdef __cplusplus
00054 extern "C" {
00055 #endif
00056 
00057 /**
00058  * \brief          ARC4 key schedule
00059  *
00060  * \param ctx      ARC4 context to be initialized
00061  * \param key      the secret key
00062  * \param keylen   length of the key
00063  */
00064 void arc4_setup( arc4_context *ctx, unsigned char *key, int keylen );
00065 
00066 /**
00067  * \brief          ARC4 cipher function
00068  *
00069  * \param ctx      ARC4 context
00070  * \param buf      buffer to be processed
00071  * \param buflen   amount of data in buf
00072  */
00073 void arc4_crypt( arc4_context *ctx, unsigned char *buf, int buflen );
00074 
00075 #ifdef __cplusplus
00076 }
00077 #endif
00078 
00079 #endif /* LWIP_INCLUDED_POLARSSL_ARC4_H */
00080 
00081 #endif /* LWIP_INCLUDED_POLARSSL_ARC4 */