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