Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of CyaSSL-forEncrypt by
ctc_aes.h
00001 /* ctc_aes.h 00002 * 00003 * Copyright (C) 2006-2009 Sawtooth Consulting Ltd. 00004 * 00005 * This file is part of CyaSSL. 00006 * 00007 * CyaSSL is free software; you can redistribute it and/or modify 00008 * it under the terms of the GNU General Public License as published by 00009 * the Free Software Foundation; either version 2 of the License, or 00010 * (at your option) any later version. 00011 * 00012 * CyaSSL is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 * GNU General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU General Public License 00018 * along with this program; if not, write to the Free Software 00019 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA 00020 */ 00021 00022 #ifndef NO_AES 00023 00024 #ifndef CTAO_CRYPT_AES_H 00025 #define CTAO_CRYPT_AES_H 00026 00027 00028 #include "types.h" 00029 00030 #ifdef CYASSL_AESNI 00031 00032 #include <wmmintrin.h> 00033 00034 #if !defined (ALIGN16) 00035 #if defined (__GNUC__) 00036 #define ALIGN16 __attribute__ ( (aligned (16))) 00037 #elif defined(_MSC_VER) 00038 #define ALIGN16 __declspec (align (16)) 00039 #else 00040 #define ALIGN16 00041 #endif 00042 #endif 00043 00044 #endif /* CYASSL_AESNI */ 00045 00046 #if !defined (ALIGN16) 00047 #define ALIGN16 00048 #endif 00049 00050 #ifdef __cplusplus 00051 extern "C" { 00052 #endif 00053 00054 00055 enum { 00056 AES_ENCRYPTION = 0, 00057 AES_DECRYPTION = 1, 00058 AES_BLOCK_SIZE = 16 00059 }; 00060 00061 00062 typedef struct Aes { 00063 /* AESNI needs key first, rounds 2nd, not sure why yet */ 00064 ALIGN16 word32 key[60]; 00065 word32 rounds; 00066 00067 ALIGN16 word32 reg[AES_BLOCK_SIZE / sizeof(word32)]; /* for CBC mode */ 00068 ALIGN16 word32 tmp[AES_BLOCK_SIZE / sizeof(word32)]; /* same */ 00069 } Aes; 00070 00071 00072 int AesSetKey(Aes* aes, const byte* key, word32 len, const byte* iv, int dir); 00073 void AesCbcEncrypt(Aes* aes, byte* out, const byte* in, word32 sz); 00074 void AesCbcDecrypt(Aes* aes, byte* out, const byte* in, word32 sz); 00075 void AesEncrypt(Aes* aes, const byte* inBlock, byte* outBlock); 00076 00077 #ifdef __cplusplus 00078 } /* extern "C" */ 00079 #endif 00080 00081 00082 #endif /* CTAO_CRYPT_AES_H */ 00083 #endif /* NO_AES */ 00084
Generated on Mon Jul 25 2022 10:27:44 by
1.7.2
