Print this page
5007142 Add ntohll and htonll to sys/byteorder.h
6717509 Need to use bswap/bswapq for byte swap of 64-bit integer on x32/x64
PSARC 2008/474

*** 52,75 **** * 3. Added defines for AES_ENCRYPT, AES_DECRYPT, AES_REV_DKS, and ASM_AMD64_C * 4. Moved defines for IS_BIG_ENDIAN, IS_LITTLE_ENDIAN, PLATFORM_BYTE_ORDER * from brg_endian.h * 5. Undefined VIA_ACE_POSSIBLE and ASSUME_VIA_ACE_PRESENT * 6. Changed uint_8t and uint_32t to uint8_t and uint32_t ! * 7. cstyled and hdrchk code * */ #ifndef _AESOPT_H #define _AESOPT_H - #pragma ident "%Z%%M% %I% %E% SMI" - #ifdef __cplusplus extern "C" { #endif #include <sys/types.h> #include <aes_impl.h> /* SUPPORT FEATURES */ #define AES_ENCRYPT /* if support for encryption is needed */ #define AES_DECRYPT /* if support for decryption is needed */ --- 52,75 ---- * 3. Added defines for AES_ENCRYPT, AES_DECRYPT, AES_REV_DKS, and ASM_AMD64_C * 4. Moved defines for IS_BIG_ENDIAN, IS_LITTLE_ENDIAN, PLATFORM_BYTE_ORDER * from brg_endian.h * 5. Undefined VIA_ACE_POSSIBLE and ASSUME_VIA_ACE_PRESENT * 6. Changed uint_8t and uint_32t to uint8_t and uint32_t ! * 7. Defined aes_sw32 as htonl() for byte swapping ! * 8. Cstyled and hdrchk code * */ #ifndef _AESOPT_H #define _AESOPT_H #ifdef __cplusplus extern "C" { #endif #include <sys/types.h> + #include <sys/byteorder.h> #include <aes_impl.h> /* SUPPORT FEATURES */ #define AES_ENCRYPT /* if support for encryption is needed */ #define AES_DECRYPT /* if support for decryption is needed */
*** 519,537 **** #if DEC_ROUND == NO_TABLES && DEC_UNROLL != NONE #undef DEC_UNROLL #define DEC_UNROLL NONE #endif ! #if defined(bswap32) #define aes_sw32 bswap32 #elif defined(bswap_32) #define aes_sw32 bswap_32 #else ! #define brot(x, n) (((uint32_t)(x) << n) | ((uint32_t)(x) >> (32 - n))) #define aes_sw32(x) ((brot((x), 8) & 0x00ff00ff) | (brot((x), 24) & 0xff00ff00)) #endif /* * upr(x, n): rotates bytes within words by n positions, moving bytes to * higher index positions with wrap around into low positions * ups(x, n): moves bytes by n positions to higher index positions in * words but without wrap around --- 519,540 ---- #if DEC_ROUND == NO_TABLES && DEC_UNROLL != NONE #undef DEC_UNROLL #define DEC_UNROLL NONE #endif ! #if (ALGORITHM_BYTE_ORDER == IS_LITTLE_ENDIAN) ! #define aes_sw32 htonl ! #elif defined(bswap32) #define aes_sw32 bswap32 #elif defined(bswap_32) #define aes_sw32 bswap_32 #else ! #define brot(x, n) (((uint32_t)(x) << (n)) | ((uint32_t)(x) >> (32 - (n)))) #define aes_sw32(x) ((brot((x), 8) & 0x00ff00ff) | (brot((x), 24) & 0xff00ff00)) #endif + /* * upr(x, n): rotates bytes within words by n positions, moving bytes to * higher index positions with wrap around into low positions * ups(x, n): moves bytes by n positions to higher index positions in * words but without wrap around