version 1.3.8.1, 2011/10/07 09:14:41
|
version 1.3.8.2, 2011/10/07 10:32:36
|
Line 176 io_Blowfish(u_char *pInput, int inLen, u_char **ppOutp
|
Line 176 io_Blowfish(u_char *pInput, int inLen, u_char **ppOutp
|
* @inLen = Input buffer data length |
* @inLen = Input buffer data length |
* @ppOutput = Output buffer with cipher data, must be free after use |
* @ppOutput = Output buffer with cipher data, must be free after use |
* @pKey = Key |
* @pKey = Key |
|
* @IV = IVector/Nonce/Counter |
* return: -1 error or >-1 how many cipher blocks proceeded |
* return: -1 error or >-1 how many cipher blocks proceeded |
*/ |
*/ |
int |
int |
io_ctr_AES(u_char *pInput, int inLen, u_char **ppOutput, u_char *pKey) | io_ctr_AES(u_char *pInput, int inLen, u_char **ppOutput, u_char *pKey, u_char IV[AES_BLOCK_SIZE]) |
{ |
{ |
u_int num; |
u_int num; |
AES_KEY key; |
AES_KEY key; |
u_char ivec[AES_BLOCK_SIZE] = { 0 }, ecount_buf[AES_BLOCK_SIZE] = { 0 }; | u_char ecount_buf[AES_BLOCK_SIZE] = { 0 }; |
int total = 0; |
int total = 0; |
|
|
if (!pInput || !inLen || !ppOutput) |
if (!pInput || !inLen || !ppOutput) |
Line 203 io_ctr_AES(u_char *pInput, int inLen, u_char **ppOutpu
|
Line 204 io_ctr_AES(u_char *pInput, int inLen, u_char **ppOutpu
|
memset(ecount_buf, 0, sizeof ecount_buf); |
memset(ecount_buf, 0, sizeof ecount_buf); |
AES_ctr128_encrypt(pInput + total, (*ppOutput) + total, |
AES_ctr128_encrypt(pInput + total, (*ppOutput) + total, |
(inLen / (AES_BLOCK_SIZE - 1)) ? (AES_BLOCK_SIZE - 1) : inLen, |
(inLen / (AES_BLOCK_SIZE - 1)) ? (AES_BLOCK_SIZE - 1) : inLen, |
&key, ivec, ecount_buf, &num); | &key, IV, ecount_buf, &num); |
if (num < 1) { |
if (num < 1) { |
free(*ppOutput); |
free(*ppOutput); |
*ppOutput = NULL; |
*ppOutput = NULL; |