wolf SSL / wolfSSL-TLS13-Beta

Fork of wolfSSL by wolf SSL

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers arc4.h Source File

arc4.h

00001 /* arc4.h
00002  *
00003  * Copyright (C) 2006-2016 wolfSSL Inc.
00004  *
00005  * This file is part of wolfSSL.
00006  *
00007  * wolfSSL is free software; you can redistribute it and/or modify
00008  * it under the terms of the GNU General Public License as published by
00009  * the Free Software Foundation; either version 2 of the License, or
00010  * (at your option) any later version.
00011  *
00012  * wolfSSL is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program; if not, write to the Free Software
00019  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
00020  */
00021 
00022 
00023 
00024 #ifndef WOLF_CRYPT_ARC4_H
00025 #define WOLF_CRYPT_ARC4_H
00026 
00027 #include <wolfssl/wolfcrypt/types.h>
00028 
00029 #ifdef __cplusplus
00030     extern "C" {
00031 #endif
00032 
00033 #ifdef WOLFSSL_ASYNC_CRYPT
00034     #include <wolfssl/wolfcrypt/async.h>
00035 #endif
00036 
00037 enum {
00038     ARC4_ENC_TYPE   = 4,    /* cipher unique type */
00039     ARC4_STATE_SIZE = 256
00040 };
00041 
00042 /* ARC4 encryption and decryption */
00043 typedef struct Arc4 {
00044     byte x;
00045     byte y;
00046     byte state[ARC4_STATE_SIZE];
00047 #ifdef WOLFSSL_ASYNC_CRYPT
00048     WC_ASYNC_DEV asyncDev;
00049 #endif
00050     void* heap;
00051 } Arc4;
00052 
00053 WOLFSSL_API int wc_Arc4Process(Arc4*, byte*, const byte*, word32);
00054 WOLFSSL_API int wc_Arc4SetKey(Arc4*, const byte*, word32);
00055 
00056 WOLFSSL_API int  wc_Arc4Init(Arc4*, void*, int);
00057 WOLFSSL_API void wc_Arc4Free(Arc4*);
00058 
00059 #ifdef __cplusplus
00060     } /* extern "C" */
00061 #endif
00062 
00063 
00064 #endif /* WOLF_CRYPT_ARC4_H */
00065 
00066