| OLD | NEW |
| 1 /* Software-Based Trusted Platform Module (TPM) Emulator for Linux | 1 /* Software-based Trusted Platform Module (TPM) Emulator |
| 2 * Copyright (C) 2004 Mario Strasser <mast@gmx.net>, | 2 * Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net> |
| 3 * Swiss Federal Institute of Technology (ETH) Zurich | |
| 4 * | 3 * |
| 5 * This module is free software; you can redistribute it and/or modify | 4 * This module is free software; you can redistribute it and/or modify |
| 6 * it under the terms of the GNU General Public License as published | 5 * it under the terms of the GNU General Public License as published |
| 7 * by the Free Software Foundation; either version 2 of the License, | 6 * by the Free Software Foundation; either version 2 of the License, |
| 8 * or (at your option) any later version. | 7 * or (at your option) any later version. |
| 9 * | 8 * |
| 10 * This module is distributed in the hope that it will be useful, | 9 * This module is distributed in the hope that it will be useful, |
| 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 * GNU General Public License for more details. | 12 * GNU General Public License for more details. |
| 14 * | 13 * |
| 15 * $Id$ | 14 * $Id: rc4.c 364 2010-02-11 10:24:45Z mast $ |
| 16 */ | 15 */ |
| 17 | 16 |
| 18 #include "rc4.h" | 17 #include "rc4.h" |
| 19 | 18 |
| 20 void tpm_rc4_init(tpm_rc4_ctx_t *ctx, uint8_t *key, size_t key_len) | 19 void tpm_rc4_init(tpm_rc4_ctx_t *ctx, uint8_t *key, size_t key_len) |
| 21 { | 20 { |
| 22 int i; | 21 int i; |
| 23 uint8_t a, j, k; | 22 uint8_t a, j, k; |
| 24 | 23 |
| 25 ctx->x = ctx->y = 0; | 24 ctx->x = ctx->y = 0; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 54 a = state[x]; | 53 a = state[x]; |
| 55 state[x] = state[y]; | 54 state[x] = state[y]; |
| 56 state[y] = a; | 55 state[y] = a; |
| 57 a += state[x]; | 56 a += state[x]; |
| 58 *out++ = *in++ ^ state[a]; | 57 *out++ = *in++ ^ state[a]; |
| 59 } | 58 } |
| 60 ctx->x = x; | 59 ctx->x = x; |
| 61 ctx->y = y; | 60 ctx->y = y; |
| 62 } | 61 } |
| 63 | 62 |
| OLD | NEW |