wolfSSL SSL/TLS library, support up to TLS1.3

Dependents:   CyaSSL-Twitter-OAuth4Tw Example-client-tls-cert TwitterReader TweetTest ... more

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers arc4.h Source File

arc4.h

Go to the documentation of this file.
00001 /* arc4.h
00002  *
00003  * Copyright (C) 2006-2020 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     \file wolfssl/wolfcrypt/arc4.h
00024 */
00025 
00026 #ifndef WOLF_CRYPT_ARC4_H
00027 #define WOLF_CRYPT_ARC4_H
00028 
00029 #include <wolfssl/wolfcrypt/types.h >
00030 
00031 #ifdef __cplusplus
00032     extern "C" {
00033 #endif
00034 
00035 #ifdef WOLFSSL_ASYNC_CRYPT
00036     #include <wolfssl/wolfcrypt/async.h>
00037 #endif
00038 
00039 enum {
00040     ARC4_ENC_TYPE   = 4,    /* cipher unique type */
00041     ARC4_STATE_SIZE = 256,
00042     RC4_KEY_SIZE    = 16,   /* always 128bit           */
00043 };
00044 
00045 /* ARC4 encryption and decryption */
00046 typedef struct Arc4 {
00047     byte x;
00048     byte y;
00049     byte state[ARC4_STATE_SIZE];
00050 #ifdef WOLFSSL_ASYNC_CRYPT
00051     WC_ASYNC_DEV asyncDev;
00052 #endif
00053     void* heap;
00054 } Arc4;
00055 
00056 WOLFSSL_API int wc_Arc4Process(Arc4*, byte*, const byte*, word32);
00057 WOLFSSL_API int wc_Arc4SetKey(Arc4*, const byte*, word32);
00058 
00059 WOLFSSL_API int  wc_Arc4Init(Arc4*, void*, int);
00060 WOLFSSL_API void wc_Arc4Free(Arc4*);
00061 
00062 #ifdef __cplusplus
00063     } /* extern "C" */
00064 #endif
00065 
00066 
00067 #endif /* WOLF_CRYPT_ARC4_H */
00068 
00069