Hannes Tschofenig
/
aes-gcm-test-program
Example program to test AES-GCM functionality. Used for a workshop
Embed:
(wiki syntax)
Show/hide line numbers
arc4.h
Go to the documentation of this file.
00001 /** 00002 * \file arc4.h 00003 * 00004 * \brief The ARCFOUR stream cipher 00005 * 00006 * Copyright (C) 2006-2014, Brainspark B.V. 00007 * 00008 * This file is part of PolarSSL (http://www.polarssl.org) 00009 * Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org> 00010 * 00011 * All rights reserved. 00012 * 00013 * This program is free software; you can redistribute it and/or modify 00014 * it under the terms of the GNU General Public License as published by 00015 * the Free Software Foundation; either version 2 of the License, or 00016 * (at your option) any later version. 00017 * 00018 * This program is distributed in the hope that it will be useful, 00019 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00020 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00021 * GNU General Public License for more details. 00022 * 00023 * You should have received a copy of the GNU General Public License along 00024 * with this program; if not, write to the Free Software Foundation, Inc., 00025 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 00026 */ 00027 #ifndef POLARSSL_ARC4_H 00028 #define POLARSSL_ARC4_H 00029 00030 #if !defined(POLARSSL_CONFIG_FILE) 00031 #include "config.h" 00032 #else 00033 #include POLARSSL_CONFIG_FILE 00034 #endif 00035 00036 #include <string.h> 00037 00038 #if !defined(POLARSSL_ARC4_ALT) 00039 // Regular implementation 00040 // 00041 00042 #ifdef __cplusplus 00043 extern "C" { 00044 #endif 00045 00046 /** 00047 * \brief ARC4 context structure 00048 */ 00049 typedef struct 00050 { 00051 int x ; /*!< permutation index */ 00052 int y ; /*!< permutation index */ 00053 unsigned char m[256]; /*!< permutation table */ 00054 } 00055 arc4_context; 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, in bytes 00063 */ 00064 void arc4_setup( arc4_context *ctx, const unsigned char *key, 00065 unsigned int keylen ); 00066 00067 /** 00068 * \brief ARC4 cipher function 00069 * 00070 * \param ctx ARC4 context 00071 * \param length length of the input data 00072 * \param input buffer holding the input data 00073 * \param output buffer for the output data 00074 * 00075 * \return 0 if successful 00076 */ 00077 int arc4_crypt( arc4_context *ctx, size_t length, const unsigned char *input, 00078 unsigned char *output ); 00079 00080 #ifdef __cplusplus 00081 } 00082 #endif 00083 00084 #else /* POLARSSL_ARC4_ALT */ 00085 #include "arc4_alt.h" 00086 #endif /* POLARSSL_ARC4_ALT */ 00087 00088 #ifdef __cplusplus 00089 extern "C" { 00090 #endif 00091 00092 /** 00093 * \brief Checkup routine 00094 * 00095 * \return 0 if successful, or 1 if the test failed 00096 */ 00097 int arc4_self_test( int verbose ); 00098 00099 #ifdef __cplusplus 00100 } 00101 #endif 00102 00103 #endif /* arc4.h */ 00104 00105
Generated on Tue Jul 12 2022 19:40:15 by 1.7.2