Changeset 1201 for trunk/library/aes.c


Ignore:
Timestamp:
02/12/12 18:31:04 (3 months ago)
Author:
paul
Message:
  • AES code only check for Padlock once
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/library/aes.c

    r1052 r1201  
    5858    (b)[(i) + 3] = (unsigned char) ( (n) >> 24 );       \ 
    5959} 
     60#endif 
     61 
     62#if defined(POLARSSL_PADLOCK_C) 
     63static int aes_padlock_ace = -1; 
    6064#endif 
    6165 
     
    450454        aes_gen_tables(); 
    451455        aes_init_done = 1; 
     456 
    452457    } 
    453458#endif 
     
    461466    } 
    462467 
    463 #if defined(PADLOCK_ALIGN16) 
    464     ctx->rk = RK = PADLOCK_ALIGN16( ctx->buf ); 
    465 #else 
     468#if defined(POLARSSL_PADLOCK_C) && defined(PADLOCK_ALIGN16) 
     469    if( aes_padlock_ace == -1 ) 
     470        aes_padlock_ace = padlock_supports( PADLOCK_ACE ); 
     471 
     472    if( aes_padlock_ace ) 
     473        ctx->rk = RK = PADLOCK_ALIGN16( ctx->buf ); 
     474    else 
     475#endif 
    466476    ctx->rk = RK = ctx->buf; 
    467 #endif 
    468477 
    469478    for( i = 0; i < (keysize >> 5); i++ ) 
     
    561570    } 
    562571 
    563 #if defined(PADLOCK_ALIGN16) 
    564     ctx->rk = RK = PADLOCK_ALIGN16( ctx->buf ); 
    565 #else 
     572#if defined(POLARSSL_PADLOCK_C) && defined(PADLOCK_ALIGN16) 
     573    if( aes_padlock_ace == -1 ) 
     574        aes_padlock_ace = padlock_supports( PADLOCK_ACE ); 
     575 
     576    if( aes_padlock_ace ) 
     577        ctx->rk = RK = PADLOCK_ALIGN16( ctx->buf ); 
     578    else 
     579#endif 
    566580    ctx->rk = RK = ctx->buf; 
    567 #endif 
    568581 
    569582    ret = aes_setkey_enc( &cty, key, keysize ); 
     
    657670 
    658671#if defined(POLARSSL_PADLOCK_C) && defined(POLARSSL_HAVE_X86) 
    659     if( padlock_supports( PADLOCK_ACE ) ) 
     672    if( aes_padlock_ace ) 
    660673    { 
    661674        if( padlock_xcryptecb( ctx, mode, input, output ) == 0 ) 
     
    769782 
    770783#if defined(POLARSSL_PADLOCK_C) && defined(POLARSSL_HAVE_X86) 
    771     if( padlock_supports( PADLOCK_ACE ) ) 
     784    if( aes_padlock_ace ) 
    772785    { 
    773786        if( padlock_xcryptcbc( ctx, mode, length, iv, input, output ) == 0 ) 
Note: See TracChangeset for help on using the changeset viewer.

What are you looking for?