1 /* SPDX-License-Identifier: BSD-2-Clause */ 2 /* 3 * Copyright (c) 2024, Siemens AG 4 * All rights reserved. 5 * Copyright (c) 2024, Linaro Limited 6 * 7 * Based on the original code by Microsoft. Modified to support using 8 * TEE functions to provide cryptographic functionality. 9 * 10 * Portions Copyright Microsoft Corporation, see below for details: 11 * 12 * The copyright in this software is being made available under the BSD 13 * License, included below. This software may be subject to other third 14 * party and contributor rights, including patent rights, and no such 15 * rights are granted under this license. 16 * 17 * Copyright (c) 2018 Microsoft Corporation 18 * 19 * All rights reserved. 20 * 21 * BSD License 22 * 23 * Redistribution and use in source and binary forms, with or without 24 * modification, are permitted provided that the following conditions are 25 * met: 26 * 27 * Redistributions of source code must retain the above copyright notice, 28 * this list of conditions and the following disclaimer. 29 * 30 * Redistributions in binary form must reproduce the above copyright 31 * notice, this list of conditions and the following disclaimer in the 32 * documentation and/or other materials provided with the distribution. 33 * 34 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 35 * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 36 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 37 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 38 * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 39 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 40 * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 41 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 42 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 43 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 44 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 45 */ 46 47 /* 48 * This file contains the structure definitions used for ECC in the TEE 49 * crypto API version of the code. These definitions would change, based on 50 * the library. The ECC-related structures that cross the TPM interface 51 * are defined in TpmTypes.h 52 */ 53 54 #ifndef MATH_LIB_DEFINED 55 #define MATH_LIB_DEFINED 56 57 #define MATH_LIB_TEE 58 59 typedef ECC_CURVE_DATA bnCurve_t; 60 61 typedef bnCurve_t* bigCurve; 62 63 #define SYMMETRIC_ALIGNMENT RADIX_BYTES 64 65 #define AccessCurveData(E) (E) 66 67 #define CURVE_INITIALIZED(name, initializer) \ 68 bnCurve_t* name = (ECC_CURVE_DATA*)GetCurveData(initializer) 69 70 #define CURVE_FREE(E) 71 72 #endif /*MATH_LIB_DEFINED*/ 73