Skip to content

Commit c6ea2e3

Browse files
committed
FIX: conflicting types
1 parent 87a2dd8 commit c6ea2e3

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

src/include/sys-chacha20.h

+13-13
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
2323
#define ROTL32(v, n) ((v) << (n)) | ((v) >> (32 - (n)))
2424

2525

26-
#define U32V(v) ((uint32_t)(v) & U32_C(0xFFFFFFFF))
26+
#define U32V(v) ((u32)(v) & U32_C(0xFFFFFFFF))
2727
#define ROTATE(v,c) (ROTL32(v,c))
2828
#define XOR(v,w) ((v) ^ (w))
2929
#define PLUS(v,w) (U32V((v) + (w)))
@@ -41,8 +41,8 @@ extern "C"
4141

4242
struct chacha20_ctx
4343
{
44-
uint32_t schedule[16];
45-
uint32_t keystream[16];
44+
u32 schedule[16];
45+
u32 keystream[16];
4646
size_t available;
4747
size_t nonce_length; // may be 8 or 12
4848
};
@@ -51,30 +51,30 @@ typedef struct chacha20_ctx chacha20_ctx;
5151

5252
typedef struct chacha20poly1305_ctx {
5353
chacha20_ctx local_chacha;
54-
uint8_t local_iv[12];
54+
u8 local_iv[12];
5555
chacha20_ctx remote_chacha;
56-
uint8_t remote_iv[12];
56+
u8 remote_iv[12];
5757
} chacha20poly1305_ctx;
5858

5959

6060

6161
//Call this to initilize a chacha20_ctx, must be called before all other functions
62-
void chacha20_keysetup(chacha20_ctx *ctx, const uint8_t *key, size_t length);
63-
void chacha20_ivsetup(chacha20_ctx *ctx, const uint8_t *nonce, size_t nonce_length, uint64_t counter, const uint8_t *sequence);
62+
void chacha20_keysetup(chacha20_ctx *ctx, const u8 *key, size_t length);
63+
void chacha20_ivsetup(chacha20_ctx *ctx, const u8 *nonce, size_t nonce_length, u64 counter, const u8 *sequence);
6464

6565

6666
//Call this if you need to process a particular block number
67-
void chacha20_counter_set(chacha20_ctx *ctx, uint64_t counter);
67+
void chacha20_counter_set(chacha20_ctx *ctx, u64 counter);
6868

69-
//Raw keystream for the current block, convert output to uint8_t[] for individual bytes. Counter is incremented upon use
70-
void chacha20_block(chacha20_ctx *ctx, uint32_t output[16]);
69+
//Raw keystream for the current block, convert output to u8[] for individual bytes. Counter is incremented upon use
70+
void chacha20_block(chacha20_ctx *ctx, u32 output[16]);
7171

7272
//Encrypt an arbitrary amount of plaintext, call continuously as needed
73-
void chacha20_encrypt(chacha20_ctx *ctx, const uint8_t *in, uint8_t *out, size_t length);
74-
void chacha_encrypt_bytes(chacha20_ctx *x, const uint8_t *m, uint8_t *c, uint32_t bytes) ;
73+
void chacha20_encrypt(chacha20_ctx *ctx, const u8 *in, u8 *out, size_t length);
74+
void chacha_encrypt_bytes(chacha20_ctx *x, const u8 *m, u8 *c, u32 bytes) ;
7575

7676
//Decrypt an arbitrary amount of ciphertext. Actually, for chacha20, decryption is the same function as encryption
77-
void chacha20_decrypt(chacha20_ctx *ctx, const uint8_t *in, uint8_t *out, size_t length);
77+
void chacha20_decrypt(chacha20_ctx *ctx, const u8 *in, u8 *out, size_t length);
7878

7979
//Generate POLY1305 key
8080
void chacha20_poly1305_key(struct chacha20_ctx *ctx, unsigned char *poly1305_key);

0 commit comments

Comments
 (0)