• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  *  Copyright 2014-2022 The GmSSL Project. All Rights Reserved.
3  *
4  *  Licensed under the Apache License, Version 2.0 (the License); you may
5  *  not use this file except in compliance with the License.
6  *
7  *  http://www.apache.org/licenses/LICENSE-2.0
8  */
9 
10 
11 
12 #ifndef GMSSL_RC4_H
13 #define GMSSL_RC4_H
14 
15 
16 #include <string.h>
17 #include <stdint.h>
18 
19 
20 #ifdef __cplusplus
21 extern "C" {
22 #endif
23 
24 
25 #define RC4_MIN_KEY_BITS	40
26 #define RC4_STATE_NUM_WORDS	256
27 
28 
29 typedef struct {
30 	uint8_t d[RC4_STATE_NUM_WORDS];
31 } RC4_STATE;
32 
33 void rc4_init(RC4_STATE *state, const uint8_t *key, size_t keylen);
34 void rc4_generate_keystream(RC4_STATE *state, size_t outlen, uint8_t *out);
35 
36 
37 #ifdef __cplusplus
38 }
39 #endif
40 #endif
41