[svn] / ecrypt / trunk / submissions / rabbit / opt / 2 / rabbit.c  

svn: ecrypt/trunk/submissions/rabbit/opt/2/rabbit.c

Diff for /ecrypt/trunk/submissions/rabbit/opt/2/rabbit.c between version 211 and 212

version 211, Thu Feb 14 05:39:03 2008 UTC version 212, Mon Feb 25 10:08:38 2008 UTC
Line 25 
Line 25 
 #include "ecrypt-sync.h"  #include "ecrypt-sync.h"
 #include "ecrypt-portable.h"  #include "ecrypt-portable.h"
   
   #if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
   #define RABBIT_GCC 1
   #endif
   
   #if defined(_MSC_VER) && defined(_M_IX86)
   #define RABBIT_MSC 1
   #endif
   
 /* -------------------------------------------------------------------------- */  /* -------------------------------------------------------------------------- */
 /* 32-bit G function macros */  /* 32-bit G function macros */
 /* Used in ECRYPT_VARIANT 1 */  /* Used in ECRYPT_VARIANT 1 */
Line 83 
Line 91 
 /* -------------------------------------------------------------------------- */  /* -------------------------------------------------------------------------- */
 /* Macros used in next-state function */  /* Macros used in next-state function */
   
 #if defined(_MSC_VER) && defined(_M_IX86) && (ECRYPT_VARIANT > 2)  #if defined(RABBIT_MSC) && (ECRYPT_VARIANT > 2)
    /* COMPILER : MICROSOFT OR INTEL */     /* COMPILER : MICROSOFT OR INTEL */
    /* PROCESSOR: x86 */     /* PROCESSOR: x86 */
   
Line 155 
Line 163 
    #define RABBIT_NS_POST \     #define RABBIT_NS_POST \
       _asm mov [esi]RABBIT_ctx.carry, ecx        _asm mov [esi]RABBIT_ctx.carry, ecx
   
 #elif defined(__GNUC__) && defined(__i386__) && (ECRYPT_VARIANT > 2)  #elif defined(RABBIT_GCC) && (ECRYPT_VARIANT > 2)
    /* COMPILER : GCC */     /* COMPILER : GCC */
    /* PROCESSOR: x86 */     /* PROCESSOR: x86 */
   
Line 345 
Line 353 
   
 /* ------------------------------------------------------------------------- */  /* ------------------------------------------------------------------------- */
   
 #if defined(_MSC_VER) && defined(_M_IX86) && (ECRYPT_VARIANT > 3)  #if defined(RABBIT_MSC) && (ECRYPT_VARIANT > 3)
    /* COMPILER : MICROSOFT OR INTEL */     /* COMPILER : MICROSOFT OR INTEL */
    /* PROCESSOR: x86 */     /* PROCESSOR: x86 */
   
Line 690 
Line 698 
   
 /* -------------------------------------------------------------------------- */  /* -------------------------------------------------------------------------- */
   
 #elif defined(__GNUC__) && defined(__i386__) && (ECRYPT_VARIANT > 4)  #elif defined(RABBIT_GCC) && (ECRYPT_VARIANT > 4)
    /* COMPILER : GCC */     /* COMPILER : GCC */
    /* PROCESSOR: x86 */     /* PROCESSOR: x86 */
   
Line 1095 
Line 1103 
    /* Clear carry bit */     /* Clear carry bit */
    ctx->master_ctx.carry = RABBIT_CARRY_INIT;     ctx->master_ctx.carry = RABBIT_CARRY_INIT;
   
 #if ((defined(_MSC_VER) && defined(_M_IX86)) || (defined(__GNUC__) && defined(__i386__))) && (ECRYPT_VARIANT > 4)  #if ((defined(RABBIT_MSC)) || defined(RABBIT_GCC)) && (ECRYPT_VARIANT > 4)
   
    p_instance = &(ctx->master_ctx);     p_instance = &(ctx->master_ctx);
   
Line 1177 
Line 1185 
 {  {
    /* Temporary variables */     /* Temporary variables */
    u32 i0, i1, i2, i3;     u32 i0, i1, i2, i3;
 #if (ECRYPT_VARIANT < 5) || !((defined(_MSC_VER) && defined(_M_IX86)))  #if (ECRYPT_VARIANT < 5) || !((defined(RABBIT_MSC)))
    u32 i;     u32 i;
    RABBIT_NS_VARS     RABBIT_NS_VARS
 #endif  #endif
Line 1211 
Line 1219 
   
    ctx->work_ctx.carry = ctx->master_ctx.carry;     ctx->work_ctx.carry = ctx->master_ctx.carry;
   
 #if ((defined(_MSC_VER) && defined(_M_IX86)) || (defined(__GNUC__) && defined(__i386__))) && (ECRYPT_VARIANT > 4)  #if (defined(RABBIT_MSC) || defined(RABBIT_GCC)) && (ECRYPT_VARIANT > 4)
    p_instance = &(ctx->work_ctx);     p_instance = &(ctx->work_ctx);
   
    RABBIT_NS_PRE     RABBIT_NS_PRE
Line 1280 
Line 1288 
    u8 buffer[16];     u8 buffer[16];
    /* ECRYPT_ctx* temp = ctx; */     /* ECRYPT_ctx* temp = ctx; */
   
 #if ((defined(_MSC_VER) && defined(_M_IX86)) || (defined(__GNUC__) && defined(__i386__))) && (ECRYPT_VARIANT > 4)  #if (defined(RABBIT_MSC) || defined(RABBIT_GCC)) && (ECRYPT_VARIANT > 4)
    /* RABBIT_ctx* p_instance = &ctx->work_ctx; */     /* RABBIT_ctx* p_instance = &ctx->work_ctx; */
    if (msglen >= 16)     if (msglen >= 16)
    {     {
Line 1344 
Line 1352 
    u32 i;     u32 i;
    u8 buffer[16];     u8 buffer[16];
   
 #if ((defined(_MSC_VER) && defined(_M_IX86)) || (defined(__GNUC__) && defined(__i386__))) && (ECRYPT_VARIANT > 4)  #if (defined(RABBIT_MSC) || defined(RABBIT_GCC)) && (ECRYPT_VARIANT > 4)
    if (length >= 16)     if (length >= 16)
    {     {
       _keystream_opt(&(ctx->work_ctx), keystream, keystream + (length&0xFFFFFFF0U));        _keystream_opt(&(ctx->work_ctx), keystream, keystream + (length&0xFFFFFFF0U));
Line 1403 
Line 1411 
 void ECRYPT_process_blocks(int action, ECRYPT_ctx* ctx, const u8* input,  void ECRYPT_process_blocks(int action, ECRYPT_ctx* ctx, const u8* input,
           u8* output, u32 blocks)            u8* output, u32 blocks)
 {  {
 #if ((defined(_MSC_VER) && defined(_M_IX86)) || (defined(__GNUC__) && defined(__i386__))) && (ECRYPT_VARIANT > 4)  #if (defined(RABBIT_MSC) || defined(RABBIT_GCC)) && (ECRYPT_VARIANT > 4)
    if (!blocks)     if (!blocks)
       return;        return;
    _process_opt(&(ctx->work_ctx), input, (s32)(output-input), input+(blocks*16));     _process_opt(&(ctx->work_ctx), input, (s32)(output-input), input+(blocks*16));


Generate output suitable for use with a patch program
Legend:
Removed from v.211  
changed lines
  Added in v.212

eSTREAM Project

Powered by ViewCVS 1.0-dev
(Powered by Apache)

ViewCVS and CVS Help