From 1eab9a1fbb6bcc3c616881da00c68bb2ef61589b Mon Sep 17 00:00:00 2001 From: Andy Polyakov Date: Sun, 2 Jan 2000 22:03:10 +0000 Subject: [PATCH] Metrowerks for Motorola tune-up. --- crypto/md32_common.h | 5 ++++- crypto/sha/sha_locl.h | 9 ++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/crypto/md32_common.h b/crypto/md32_common.h index 470a8c3e51..a5b838442b 100644 --- a/crypto/md32_common.h +++ b/crypto/md32_common.h @@ -182,8 +182,11 @@ # if defined(_MSC_VER) # define ROTATE(a,n) _lrotl(a,n) # elif defined(__MWERKS__) -# ifdef __POWERPC__ +# if defined(__POWERPC__) # define ROTATE(a,n) __rlwinm(a,n,0,31) +# elif defined(__MC68K__) + /* Motorola specific tweak. */ +# define ROTATE(a,n) ( n<24 ? __rol(a,n) : __ror(a,32-n) ) # else # define ROTATE(a,n) __rol(a,n) # endif diff --git a/crypto/sha/sha_locl.h b/crypto/sha/sha_locl.h index 80e70f046f..0a78b399a9 100644 --- a/crypto/sha/sha_locl.h +++ b/crypto/sha/sha_locl.h @@ -103,9 +103,16 @@ # define HASH_INIT SHA1_Init # define HASH_BLOCK_HOST_ORDER sha1_block_host_order # define HASH_BLOCK_DATA_ORDER sha1_block_data_order -# define Xupdate(a,ix,ia,ib,ic,id) ( (a)=(ia^ib^ic^id), \ +# if defined(__MWERKS__) && defined(__MC68K__) + /* Metrowerks for Motorola fails otherwise:-( */ +# define Xupdate(a,ix,ia,ib,ic,id) do { (a)=(ia^ib^ic^id); \ + ix=(a)=ROTATE((a),1); \ + } while (0) +# else +# define Xupdate(a,ix,ia,ib,ic,id) ( (a)=(ia^ib^ic^id), \ ix=(a)=ROTATE((a),1) \ ) +# endif # ifdef SHA1_ASM # if defined(__i386) || defined(_M_IX86) || defined(__INTEL__) -- 2.34.1