4 * \brief VIA PadLock ACE for HW encryption/decryption supported by some
7 * Copyright (C) 2006-2014, ARM Limited, All Rights Reserved
9 * This file is part of mbed TLS (https://polarssl.org)
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License along
22 * with this program; if not, write to the Free Software Foundation, Inc.,
23 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
25 #ifndef POLARSSL_PADLOCK_H
26 #define POLARSSL_PADLOCK_H
30 #define POLARSSL_ERR_PADLOCK_DATA_MISALIGNED -0x0030 /**< Input data should be aligned. */
32 #if defined(POLARSSL_HAVE_ASM) && defined(__GNUC__) && defined(__i386__)
34 #ifndef POLARSSL_HAVE_X86
35 #define POLARSSL_HAVE_X86
38 #if defined(_MSC_VER) && !defined(EFIX64) && !defined(EFI32)
40 typedef INT32
int32_t;
46 #define PADLOCK_RNG 0x000C
47 #define PADLOCK_ACE 0x00C0
48 #define PADLOCK_PHE 0x0C00
49 #define PADLOCK_PMM 0x3000
51 #define PADLOCK_ALIGN16(x) (uint32_t *) (16 + ((int32_t) x & ~15))
58 * \brief PadLock detection routine
60 * \param feature The feature to detect
62 * \return 1 if CPU has support for the feature, 0 otherwise
64 int padlock_supports( int feature
);
67 * \brief PadLock AES-ECB block en(de)cryption
69 * \param ctx AES context
70 * \param mode AES_ENCRYPT or AES_DECRYPT
71 * \param input 16-byte input block
72 * \param output 16-byte output block
74 * \return 0 if success, 1 if operation failed
76 int padlock_xcryptecb( aes_context
*ctx
,
78 const unsigned char input
[16],
79 unsigned char output
[16] );
82 * \brief PadLock AES-CBC buffer en(de)cryption
84 * \param ctx AES context
85 * \param mode AES_ENCRYPT or AES_DECRYPT
86 * \param length length of the input data
87 * \param iv initialization vector (updated after use)
88 * \param input buffer holding the input data
89 * \param output buffer holding the output data
91 * \return 0 if success, 1 if operation failed
93 int padlock_xcryptcbc( aes_context
*ctx
,
97 const unsigned char *input
,
98 unsigned char *output
);
104 #endif /* HAVE_X86 */
106 #endif /* padlock.h */