Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of wolfSSL by
chacha.h
00001 /* chacha.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 #ifndef WOLF_CRYPT_CHACHA_H 00024 #define WOLF_CRYPT_CHACHA_H 00025 00026 #include <wolfssl/wolfcrypt/types.h> 00027 00028 #ifdef HAVE_CHACHA 00029 00030 #ifdef __cplusplus 00031 extern "C" { 00032 #endif 00033 00034 /* Size of the IV */ 00035 #define CHACHA_IV_WORDS 3 00036 #define CHACHA_IV_BYTES (CHACHA_IV_WORDS * sizeof(word32)) 00037 00038 /* Size of ChaCha chunks */ 00039 #define CHACHA_CHUNK_WORDS 16 00040 #define CHACHA_CHUNK_BYTES (CHACHA_CHUNK_WORDS * sizeof(word32)) 00041 00042 enum { 00043 CHACHA_ENC_TYPE = 7 /* cipher unique type */ 00044 }; 00045 00046 typedef struct ChaCha { 00047 word32 X[CHACHA_CHUNK_WORDS]; /* state of cipher */ 00048 } ChaCha; 00049 00050 /** 00051 * IV(nonce) changes with each record 00052 * counter is for what value the block counter should start ... usually 0 00053 */ 00054 WOLFSSL_API int wc_Chacha_SetIV(ChaCha* ctx, const byte* inIv, word32 counter); 00055 00056 WOLFSSL_API int wc_Chacha_Process(ChaCha* ctx, byte* cipher, const byte* plain, 00057 word32 msglen); 00058 WOLFSSL_API int wc_Chacha_SetKey(ChaCha* ctx, const byte* key, word32 keySz); 00059 00060 #ifdef __cplusplus 00061 } /* extern "C" */ 00062 #endif 00063 00064 #endif /* HAVE_CHACHA */ 00065 #endif /* WOLF_CRYPT_CHACHA_H */ 00066 00067
Generated on Tue Jul 12 2022 23:30:54 by
 1.7.2 
    