- Timestamp:
- Jun 22, 2021, 9:00:19 PM (3 years ago)
- Location:
- azure_iot_hub_f767zi/trunk/wolfssl-4.7.0
- Files:
-
- 1 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
azure_iot_hub_f767zi/trunk/wolfssl-4.7.0/wolfssl/wolfcrypt/chacha.h
r457 r464 19 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA 20 20 */ 21 /* 21 22 23 DESCRIPTION 24 This library contains implementation for the ChaCha20 stream cipher. 25 26 */ 22 27 /*! 23 28 \file wolfssl/wolfcrypt/chacha.h … … 36 41 #endif 37 42 43 /* 44 Initialization vector starts at 13 with zero being the index origin of a matrix. 45 Block counter is located at index 12. 46 0 1 2 3 47 4 5 6 7 48 8 9 10 11 49 12 13 14 15 50 */ 51 #define CHACHA_MATRIX_CNT_IV 12 52 38 53 /* Size of the IV */ 39 54 #define CHACHA_IV_WORDS 3 40 #define CHACHA_IV_BYTES (CHACHA_IV_WORDS * sizeof(word32)) 55 56 /* Size of IV in bytes*/ 57 #define CHACHA_IV_BYTES 12 58 #ifdef HAVE_XCHACHA 59 #define XCHACHA_NONCE_BYTES 24 60 #endif 41 61 42 62 /* Size of ChaCha chunks */ … … 58 78 typedef struct ChaCha { 59 79 word32 X[CHACHA_CHUNK_WORDS]; /* state of cipher */ 60 word32 left; /* number of bytes leftover */61 80 #ifdef HAVE_INTEL_AVX1 62 81 /* vpshufd reads 16 bytes but we only use bottom 4. */ 63 82 byte extra[12]; 83 #endif 84 word32 left; /* number of bytes leftover */ 85 #if defined(USE_INTEL_CHACHA_SPEEDUP) || defined(WOLFSSL_ARMASM) 86 word32 over[CHACHA_CHUNK_WORDS]; 64 87 #endif 65 88 } ChaCha; … … 73 96 WOLFSSL_API int wc_Chacha_Process(ChaCha* ctx, byte* cipher, const byte* plain, 74 97 word32 msglen); 98 99 WOLFSSL_LOCAL void wc_Chacha_purge_current_block(ChaCha* ctx); 100 75 101 WOLFSSL_API int wc_Chacha_SetKey(ChaCha* ctx, const byte* key, word32 keySz); 102 103 #ifdef HAVE_XCHACHA 104 WOLFSSL_API int wc_XChacha_SetKey(ChaCha *ctx, const byte *key, word32 keySz, 105 const byte *nonce, word32 nonceSz, 106 word32 counter); 107 #endif 76 108 77 109 #ifdef __cplusplus
Note:
See TracChangeset
for help on using the changeset viewer.