void ECRYPT_FFCSR::ECRYPT_ivsetup( void* ctxa, const u8* iv) { FFCSR_ctx* ctx = (FFCSR_ctx*)ctxa; u32 i=0; ctx->state[0] = ctx->init[0]; ctx->state[1] = ctx->init[1]; ctx->state[2] = ctx->init[2]; ctx->state[2] ^= iv[9]<<16 | iv[8]<<24; ctx->state[3] = iv[7] | iv[6]<<8 | iv[5]<<16 | iv[4]<<24; ctx->state[4] = iv[3] | iv[2]<<8 | iv[1]<<16 | iv[0]<<24; ctx->carry[0] = 0; ctx->carry[1] = 0; ctx->carry[2] = 0; ctx->carry[3] = 0; ctx->carry[4] = 0; for( i=0; i<160*(float(numRounds)/5) ; i++) { FFCSR_clock(ctx, numRounds); } }
void ECRYPT_FFCSR::FFCSR_process_bytes(int action, /* 0 = encrypt; 1 = decrypt; */ void* ctxa, const u8* input, u8* output, u32 msglen) /* Message length in bytes. */ { FFCSR_ctx* ctx = (FFCSR_ctx*)ctxa; u32 i; for (i = 0; i < msglen; i++) { FFCSR_clock(ctx, _rounds); output[i] = input[i] ^ FFCSR_filter(ctx, _rounds); } }