diff options
author | Andy Polyakov <appro@openssl.org> | 2007-08-29 21:30:13 +0000 |
---|---|---|
committer | Andy Polyakov <appro@openssl.org> | 2007-08-29 21:30:13 +0000 |
commit | d8803d5ae62ee5ae1d2ef6a68c81071f3e9b7dc9 (patch) | |
tree | 824e1bcd9193002bd2e854ba915bdf8616c329de /crypto/aes | |
parent | acfb4b5b9f014233af67e00d03bf6fdac2b94fe7 (diff) |
aes_ige suffered SIGBUS on RISC platforms.
Diffstat (limited to 'crypto/aes')
-rw-r--r-- | crypto/aes/aes_ige.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/crypto/aes/aes_ige.c b/crypto/aes/aes_ige.c index 8b5b36bacc..45d7096181 100644 --- a/crypto/aes/aes_ige.c +++ b/crypto/aes/aes_ige.c @@ -62,9 +62,11 @@ typedef struct { /* XXX: probably some better way to do this */ #if defined(__i386__) || defined(__x86_64__) #define UNALIGNED_MEMOPS_ARE_FAST 1 +#else +#define UNALIGNED_MEMOPS_ARE_FAST 0 #endif -#ifdef UNALIGNED_MEMOPS_ARE_FAST +#if UNALIGNED_MEMOPS_ARE_FAST #define load_block(d, s) (d) = *(const aes_block_t *)(s) #define store_block(d, s) *(aes_block_t *)(d) = (s) #else @@ -89,7 +91,8 @@ void AES_ige_encrypt(const unsigned char *in, unsigned char *out, if (AES_ENCRYPT == enc) { - if (in != out) + if (in != out && + (UNALIGNED_MEMOPS_ARE_FAST || ((size_t)in|(size_t)out|(size_t)ivec)%sizeof(long)==0)) { aes_block_t *ivp = (aes_block_t *)ivec; aes_block_t *iv2p = (aes_block_t *)(ivec + AES_BLOCK_SIZE); @@ -143,7 +146,8 @@ void AES_ige_encrypt(const unsigned char *in, unsigned char *out, } else { - if(in != out) + if (in != out && + (UNALIGNED_MEMOPS_ARE_FAST || ((size_t)in|(size_t)out|(size_t)ivec)%sizeof(long)==0)) { aes_block_t *ivp = (aes_block_t *)ivec; aes_block_t *iv2p = (aes_block_t *)(ivec + AES_BLOCK_SIZE); |