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 mbedtls by
padlock.h
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-2015, ARM Limited, All Rights Reserved 00008 * SPDX-License-Identifier: Apache-2.0 00009 * 00010 * Licensed under the Apache License, Version 2.0 (the "License"); you may 00011 * not use this file except in compliance with the License. 00012 * You may obtain a copy of the License at 00013 * 00014 * http://www.apache.org/licenses/LICENSE-2.0 00015 * 00016 * Unless required by applicable law or agreed to in writing, software 00017 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 00018 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00019 * See the License for the specific language governing permissions and 00020 * limitations under the License. 00021 * 00022 * This file is part of mbed TLS (https://tls.mbed.org) 00023 */ 00024 #ifndef MBEDTLS_PADLOCK_H 00025 #define MBEDTLS_PADLOCK_H 00026 00027 #include "aes.h" 00028 00029 #define MBEDTLS_ERR_PADLOCK_DATA_MISALIGNED -0x0030 /**< Input data should be aligned. */ 00030 00031 #if defined(__has_feature) 00032 #if __has_feature(address_sanitizer) 00033 #define MBEDTLS_HAVE_ASAN 00034 #endif 00035 #endif 00036 00037 /* Some versions of ASan result in errors about not enough registers */ 00038 #if defined(MBEDTLS_HAVE_ASM) && defined(__GNUC__) && defined(__i386__) && \ 00039 !defined(MBEDTLS_HAVE_ASAN) 00040 00041 #ifndef MBEDTLS_HAVE_X86 00042 #define MBEDTLS_HAVE_X86 00043 #endif 00044 00045 #include <stdint.h> 00046 00047 #define MBEDTLS_PADLOCK_RNG 0x000C 00048 #define MBEDTLS_PADLOCK_ACE 0x00C0 00049 #define MBEDTLS_PADLOCK_PHE 0x0C00 00050 #define MBEDTLS_PADLOCK_PMM 0x3000 00051 00052 #define MBEDTLS_PADLOCK_ALIGN16(x) (uint32_t *) (16 + ((int32_t) x & ~15)) 00053 00054 #ifdef __cplusplus 00055 extern "C" { 00056 #endif 00057 00058 /** 00059 * \brief PadLock detection routine 00060 * 00061 * \param feature The feature to detect 00062 * 00063 * \return 1 if CPU has support for the feature, 0 otherwise 00064 */ 00065 int mbedtls_padlock_has_support( int feature ); 00066 00067 /** 00068 * \brief PadLock AES-ECB block en(de)cryption 00069 * 00070 * \param ctx AES context 00071 * \param mode MBEDTLS_AES_ENCRYPT or MBEDTLS_AES_DECRYPT 00072 * \param input 16-byte input block 00073 * \param output 16-byte output block 00074 * 00075 * \return 0 if success, 1 if operation failed 00076 */ 00077 int mbedtls_padlock_xcryptecb( mbedtls_aes_context *ctx, 00078 int mode, 00079 const unsigned char input[16], 00080 unsigned char output[16] ); 00081 00082 /** 00083 * \brief PadLock AES-CBC buffer en(de)cryption 00084 * 00085 * \param ctx AES context 00086 * \param mode MBEDTLS_AES_ENCRYPT or MBEDTLS_AES_DECRYPT 00087 * \param length length of the input data 00088 * \param iv initialization vector (updated after use) 00089 * \param input buffer holding the input data 00090 * \param output buffer holding the output data 00091 * 00092 * \return 0 if success, 1 if operation failed 00093 */ 00094 int mbedtls_padlock_xcryptcbc( mbedtls_aes_context *ctx, 00095 int mode, 00096 size_t length, 00097 unsigned char iv[16], 00098 const unsigned char *input, 00099 unsigned char *output ); 00100 00101 #ifdef __cplusplus 00102 } 00103 #endif 00104 00105 #endif /* HAVE_X86 */ 00106 00107 #endif /* padlock.h */
Generated on Tue Jul 12 2022 17:25:42 by
