Renesas / SecureDweet
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 #define WOLFSSL_ARC4_CAVIUM_MAGIC 0xBEEF0001
00034 
00035 enum {
00036     ARC4_ENC_TYPE   = 4,    /* cipher unique type */
00037     ARC4_STATE_SIZE = 256
00038 };
00039 
00040 /* ARC4 encryption and decryption */
00041 typedef struct Arc4 {
00042     byte x;
00043     byte y;
00044     byte state[ARC4_STATE_SIZE];
00045 #ifdef HAVE_CAVIUM
00046     int    devId;           /* nitrox device id */
00047     word32 magic;           /* using cavium magic */
00048     word64 contextHandle;   /* nitrox context memory handle */
00049 #endif
00050 } Arc4;
00051 
00052 WOLFSSL_API void wc_Arc4Process(Arc4*, byte*, const byte*, word32);
00053 WOLFSSL_API void wc_Arc4SetKey(Arc4*, const byte*, word32);
00054 
00055 #ifdef HAVE_CAVIUM
00056     WOLFSSL_API int  wc_Arc4InitCavium(Arc4*, int);
00057     WOLFSSL_API void wc_Arc4FreeCavium(Arc4*);
00058 #endif
00059 
00060 #ifdef __cplusplus
00061     } /* extern "C" */
00062 #endif
00063 
00064 
00065 #endif /* WOLF_CRYPT_ARC4_H */
00066 
00067