1e1051a39Sopenharmony_ci/* 2e1051a39Sopenharmony_ci * Copyright 2002-2021 The OpenSSL Project Authors. All Rights Reserved. 3e1051a39Sopenharmony_ci * 4e1051a39Sopenharmony_ci * Licensed under the Apache License 2.0 (the "License"). You may not use 5e1051a39Sopenharmony_ci * this file except in compliance with the License. You can obtain a copy 6e1051a39Sopenharmony_ci * in the file LICENSE in the source distribution or at 7e1051a39Sopenharmony_ci * https://www.openssl.org/source/license.html 8e1051a39Sopenharmony_ci */ 9e1051a39Sopenharmony_ci 10e1051a39Sopenharmony_ci#ifndef OSSL_CRYPTO_AES_LOCAL_H 11e1051a39Sopenharmony_ci# define OSSL_CRYPTO_AES_LOCAL_H 12e1051a39Sopenharmony_ci 13e1051a39Sopenharmony_ci# include <openssl/e_os2.h> 14e1051a39Sopenharmony_ci# include <stdio.h> 15e1051a39Sopenharmony_ci# include <stdlib.h> 16e1051a39Sopenharmony_ci# include <string.h> 17e1051a39Sopenharmony_ci 18e1051a39Sopenharmony_ci# if defined(_MSC_VER) && (defined(_M_IX86) || defined(_M_AMD64) || defined(_M_X64)) 19e1051a39Sopenharmony_ci# define SWAP(x) (_lrotl(x, 8) & 0x00ff00ff | _lrotr(x, 8) & 0xff00ff00) 20e1051a39Sopenharmony_ci# define GETU32(p) SWAP(*((u32 *)(p))) 21e1051a39Sopenharmony_ci# define PUTU32(ct, st) { *((u32 *)(ct)) = SWAP((st)); } 22e1051a39Sopenharmony_ci# else 23e1051a39Sopenharmony_ci# define GETU32(pt) (((u32)(pt)[0] << 24) ^ ((u32)(pt)[1] << 16) ^ ((u32)(pt)[2] << 8) ^ ((u32)(pt)[3])) 24e1051a39Sopenharmony_ci# define PUTU32(ct, st) { (ct)[0] = (u8)((st) >> 24); (ct)[1] = (u8)((st) >> 16); (ct)[2] = (u8)((st) >> 8); (ct)[3] = (u8)(st); } 25e1051a39Sopenharmony_ci# endif 26e1051a39Sopenharmony_ci 27e1051a39Sopenharmony_citypedef uint64_t u64; 28e1051a39Sopenharmony_ci# ifdef AES_LONG 29e1051a39Sopenharmony_citypedef unsigned long u32; 30e1051a39Sopenharmony_ci# else 31e1051a39Sopenharmony_citypedef unsigned int u32; 32e1051a39Sopenharmony_ci# endif 33e1051a39Sopenharmony_citypedef unsigned short u16; 34e1051a39Sopenharmony_citypedef unsigned char u8; 35e1051a39Sopenharmony_ci 36e1051a39Sopenharmony_ci# define MAXKC (256/32) 37e1051a39Sopenharmony_ci# define MAXKB (256/8) 38e1051a39Sopenharmony_ci# define MAXNR 14 39e1051a39Sopenharmony_ci 40e1051a39Sopenharmony_ci/* This controls loop-unrolling in aes_core.c */ 41e1051a39Sopenharmony_ci# undef FULL_UNROLL 42e1051a39Sopenharmony_ci 43e1051a39Sopenharmony_ci#endif /* !OSSL_CRYPTO_AES_LOCAL_H */ 44