Changeset a931b7b in mainline for uspace/lib/crypto/rc4.c
- Timestamp:
- 2015-04-13T20:48:33Z (10 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- cc575ef9
- Parents:
- 053fc2b
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/crypto/rc4.c
r053fc2b ra931b7b 82 82 * @param input Input data sequence to be processed. 83 83 * @param input_size Size of input data sequence. 84 * @param skip Number of bytes to be skipped from the beginning of key stream. 84 85 * @param output Result data sequence. 85 86 * … … 88 89 */ 89 90 int rc4(uint8_t *key, size_t key_size, uint8_t *input, size_t input_size, 90 uint8_t *output)91 size_t skip, uint8_t *output) 91 92 { 92 93 if(!key || !input) … … 100 101 create_sbox(key, key_size, sbox); 101 102 103 /* Skip first x bytes. */ 104 uint8_t i = 0, j = 0; 105 for(size_t k = 0; k < skip; k++) { 106 i = i+1; 107 j = j + sbox[i]; 108 swap(i, j, sbox); 109 } 110 102 111 /* Processing loop. */ 103 uint8_t i = 0, j = 0,val;112 uint8_t val; 104 113 for(size_t k = 0; k < input_size; k++) { 105 114 i = i+1;
Note:
See TracChangeset
for help on using the changeset viewer.