Hannes Tschofenig
/
aes-gcm-test-program
Example program to test AES-GCM functionality. Used for a workshop
Embed:
(wiki syntax)
Show/hide line numbers
padlock.h
Go to the documentation of this file.
00001 /** 00002 * \file padlock.h 00003 * 00004 * \brief VIA PadLock ACE for HW encryption/decryption supported by some 00005 * processors 00006 * 00007 * Copyright (C) 2006-2014, Brainspark B.V. 00008 * 00009 * This file is part of PolarSSL (http://www.polarssl.org) 00010 * Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org> 00011 * 00012 * All rights reserved. 00013 * 00014 * This program is free software; you can redistribute it and/or modify 00015 * it under the terms of the GNU General Public License as published by 00016 * the Free Software Foundation; either version 2 of the License, or 00017 * (at your option) any later version. 00018 * 00019 * This program is distributed in the hope that it will be useful, 00020 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00021 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00022 * GNU General Public License for more details. 00023 * 00024 * You should have received a copy of the GNU General Public License along 00025 * with this program; if not, write to the Free Software Foundation, Inc., 00026 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 00027 */ 00028 #ifndef POLARSSL_PADLOCK_H 00029 #define POLARSSL_PADLOCK_H 00030 00031 #include "aes.h" 00032 00033 #define POLARSSL_ERR_PADLOCK_DATA_MISALIGNED -0x0030 /**< Input data should be aligned. */ 00034 00035 #if defined(POLARSSL_HAVE_ASM) && defined(__GNUC__) && defined(__i386__) 00036 00037 #ifndef POLARSSL_HAVE_X86 00038 #define POLARSSL_HAVE_X86 00039 #endif 00040 00041 #if defined(_MSC_VER) && !defined(EFIX64) && !defined(EFI32) 00042 #include <basetsd.h> 00043 typedef INT32 int32_t; 00044 #else 00045 #include <inttypes.h> 00046 #endif 00047 00048 00049 #define PADLOCK_RNG 0x000C 00050 #define PADLOCK_ACE 0x00C0 00051 #define PADLOCK_PHE 0x0C00 00052 #define PADLOCK_PMM 0x3000 00053 00054 #define PADLOCK_ALIGN16(x) (uint32_t *) (16 + ((int32_t) x & ~15)) 00055 00056 #ifdef __cplusplus 00057 extern "C" { 00058 #endif 00059 00060 /** 00061 * \brief PadLock detection routine 00062 * 00063 * \param feature The feature to detect 00064 * 00065 * \return 1 if CPU has support for the feature, 0 otherwise 00066 */ 00067 int padlock_supports( int feature ); 00068 00069 /** 00070 * \brief PadLock AES-ECB block en(de)cryption 00071 * 00072 * \param ctx AES context 00073 * \param mode AES_ENCRYPT or AES_DECRYPT 00074 * \param input 16-byte input block 00075 * \param output 16-byte output block 00076 * 00077 * \return 0 if success, 1 if operation failed 00078 */ 00079 int padlock_xcryptecb( aes_context *ctx, 00080 int mode, 00081 const unsigned char input[16], 00082 unsigned char output[16] ); 00083 00084 /** 00085 * \brief PadLock AES-CBC buffer en(de)cryption 00086 * 00087 * \param ctx AES context 00088 * \param mode AES_ENCRYPT or AES_DECRYPT 00089 * \param length length of the input data 00090 * \param iv initialization vector (updated after use) 00091 * \param input buffer holding the input data 00092 * \param output buffer holding the output data 00093 * 00094 * \return 0 if success, 1 if operation failed 00095 */ 00096 int padlock_xcryptcbc( aes_context *ctx, 00097 int mode, 00098 size_t length, 00099 unsigned char iv[16], 00100 const unsigned char *input, 00101 unsigned char *output ); 00102 00103 #ifdef __cplusplus 00104 } 00105 #endif 00106 00107 #endif /* HAVE_X86 */ 00108 00109 #endif /* padlock.h */ 00110 00111
Generated on Tue Jul 12 2022 19:40:18 by 1.7.2