File indexing completed on 2025-01-18 10:02:16
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035 #ifndef NETTLE_SALSA20_H_INCLUDED
0036 #define NETTLE_SALSA20_H_INCLUDED
0037
0038 #include "nettle-types.h"
0039
0040 #ifdef __cplusplus
0041 extern "C" {
0042 #endif
0043
0044
0045 #define salsa20_set_key nettle_salsa20_set_key
0046 #define salsa20_128_set_key nettle_salsa20_128_set_key
0047 #define salsa20_256_set_key nettle_salsa20_256_set_key
0048 #define salsa20_set_nonce nettle_salsa20_set_nonce
0049 #define salsa20_crypt nettle_salsa20_crypt
0050
0051 #define salsa20r12_crypt nettle_salsa20r12_crypt
0052
0053
0054 #define salsa20_set_iv nettle_salsa20_set_nonce
0055
0056
0057 #define SALSA20_128_KEY_SIZE 16
0058 #define SALSA20_256_KEY_SIZE 32
0059 #define SALSA20_BLOCK_SIZE 64
0060 #define SALSA20_NONCE_SIZE 8
0061 #define SALSA20_IV_SIZE SALSA20_NONCE_SIZE
0062
0063
0064 #define SALSA20_MIN_KEY_SIZE 16
0065 #define SALSA20_MAX_KEY_SIZE 32
0066 #define SALSA20_KEY_SIZE 32
0067
0068 #define _SALSA20_INPUT_LENGTH 16
0069
0070 struct salsa20_ctx
0071 {
0072
0073
0074
0075
0076
0077
0078
0079
0080
0081 uint32_t input[_SALSA20_INPUT_LENGTH];
0082 };
0083
0084 void
0085 salsa20_128_set_key(struct salsa20_ctx *ctx, const uint8_t *key);
0086 void
0087 salsa20_256_set_key(struct salsa20_ctx *ctx, const uint8_t *key);
0088
0089 void
0090 salsa20_set_key(struct salsa20_ctx *ctx,
0091 size_t length, const uint8_t *key);
0092
0093 void
0094 salsa20_set_nonce(struct salsa20_ctx *ctx, const uint8_t *nonce);
0095
0096 void
0097 salsa20_crypt(struct salsa20_ctx *ctx,
0098 size_t length, uint8_t *dst,
0099 const uint8_t *src);
0100
0101 void
0102 salsa20r12_crypt(struct salsa20_ctx *ctx,
0103 size_t length, uint8_t *dst,
0104 const uint8_t *src);
0105
0106 #ifdef __cplusplus
0107 }
0108 #endif
0109
0110 #endif