1*b0104773SPascal Brand /* 2*b0104773SPascal Brand * Copyright (c) 2014, STMicroelectronics International N.V. 3*b0104773SPascal Brand * All rights reserved. 4*b0104773SPascal Brand * 5*b0104773SPascal Brand * Redistribution and use in source and binary forms, with or without 6*b0104773SPascal Brand * modification, are permitted provided that the following conditions are met: 7*b0104773SPascal Brand * 8*b0104773SPascal Brand * 1. Redistributions of source code must retain the above copyright notice, 9*b0104773SPascal Brand * this list of conditions and the following disclaimer. 10*b0104773SPascal Brand * 11*b0104773SPascal Brand * 2. Redistributions in binary form must reproduce the above copyright notice, 12*b0104773SPascal Brand * this list of conditions and the following disclaimer in the documentation 13*b0104773SPascal Brand * and/or other materials provided with the distribution. 14*b0104773SPascal Brand * 15*b0104773SPascal Brand * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 16*b0104773SPascal Brand * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17*b0104773SPascal Brand * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18*b0104773SPascal Brand * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 19*b0104773SPascal Brand * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20*b0104773SPascal Brand * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21*b0104773SPascal Brand * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22*b0104773SPascal Brand * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23*b0104773SPascal Brand * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24*b0104773SPascal Brand * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25*b0104773SPascal Brand * POSSIBILITY OF SUCH DAMAGE. 26*b0104773SPascal Brand */ 27*b0104773SPascal Brand #ifndef GUARD_TEE_MATHAPI_H 28*b0104773SPascal Brand #define GUARD_TEE_MATHAPI_H 29*b0104773SPascal Brand 30*b0104773SPascal Brand #include <stddef.h> /* for size_t */ 31*b0104773SPascal Brand #include <stdint.h> /* for uint32_t and friends */ 32*b0104773SPascal Brand #include <stdbool.h> /* for bool (!) */ 33*b0104773SPascal Brand 34*b0104773SPascal Brand /************************************************************* 35*b0104773SPascal Brand * 36*b0104773SPascal Brand * MACRO DEFINITIONS 37*b0104773SPascal Brand * 38*b0104773SPascal Brand *************************************************************/ 39*b0104773SPascal Brand 40*b0104773SPascal Brand /*------------------------------------------------------------ 41*b0104773SPascal Brand * 42*b0104773SPascal Brand * How functions are exported 43*b0104773SPascal Brand * 44*b0104773SPascal Brand */ 45*b0104773SPascal Brand #define TEE_MATHAPI_EXPORT 46*b0104773SPascal Brand 47*b0104773SPascal Brand /* 48*b0104773SPascal Brand * The modes for String Conversion 49*b0104773SPascal Brand */ 50*b0104773SPascal Brand #define TEE_STRING_MODE_HEX_UC MPA_STRING_MODE_HEX_UC 51*b0104773SPascal Brand #define TEE_STRING_MODE_HEX_LC MPA_STRING_MODE_HEX_UC 52*b0104773SPascal Brand 53*b0104773SPascal Brand /*------------------------------------------------------------ 54*b0104773SPascal Brand * 55*b0104773SPascal Brand * Define IN, OUT, INBUF and OUTBUF to keep format from the spec. 56*b0104773SPascal Brand * 57*b0104773SPascal Brand */ 58*b0104773SPascal Brand #define IN const 59*b0104773SPascal Brand #define OUT 60*b0104773SPascal Brand #define INOUT 61*b0104773SPascal Brand #define INBUF const 62*b0104773SPascal Brand #define OUTBUF 63*b0104773SPascal Brand 64*b0104773SPascal Brand /************************************************************* 65*b0104773SPascal Brand * 66*b0104773SPascal Brand * MEMORY ALLOCATION AND SIZE 67*b0104773SPascal Brand * 68*b0104773SPascal Brand *************************************************************/ 69*b0104773SPascal Brand 70*b0104773SPascal Brand /* 71*b0104773SPascal Brand * THIS IS THE MAXIMUM NUMBER OF BITS THAT THE LIBRARY SUPPORTS. 72*b0104773SPascal Brand * It defines the size of the scratch memory pool for the underlying 73*b0104773SPascal Brand * mpa library. 74*b0104773SPascal Brand */ 75*b0104773SPascal Brand #define TEE_MAX_NUMBER_OF_SUPPORTED_BITS 2048 76*b0104773SPascal Brand 77*b0104773SPascal Brand /************************************************************* 78*b0104773SPascal Brand * 79*b0104773SPascal Brand * INITIALIZATION FUNCTIONS 80*b0104773SPascal Brand * 81*b0104773SPascal Brand *************************************************************/ 82*b0104773SPascal Brand 83*b0104773SPascal Brand /* 84*b0104773SPascal Brand * !!! This function must be called before you do anything else !!! 85*b0104773SPascal Brand * NOTE: Not part of the spec 86*b0104773SPascal Brand */ 87*b0104773SPascal Brand TEE_MATHAPI_EXPORT void TEE_MathAPI_Init(void); 88*b0104773SPascal Brand 89*b0104773SPascal Brand #endif 90