/** * \file rsa.h * * \brief This file provides an API for the RSA public-key cryptosystem. * * The RSA public-key cryptosystem is defined in Public-Key * Cryptography Standards (PKCS) #1 v1.5: RSA Encryption * and Public-Key Cryptography Standards (PKCS) #1 v2.1: * RSA Cryptography Specifications. * */ /* * Copyright (C) 2006-2018, Arm Limited (or its affiliates), All Rights Reserved * Copyright (C) 2020, STMicroelectronics, All Rights Reserved * SPDX-License-Identifier: Apache-2.0 * * Licensed under the Apache License, Version 2.0 (the "License"); you may * not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * This file is part of Mbed TLS (https://tls.mbed.org) */ #ifndef MBEDTLS_RSA_ALT_H #define MBEDTLS_RSA_ALT_H #ifdef __cplusplus extern "C" { #endif #if defined(MBEDTLS_RSA_ALT) #include "stm32u5xx_hal.h" // Regular implementation // /** * \brief The RSA context structure. * * \note Direct manipulation of the members of this structure * is deprecated. All manipulation should instead be done through * the public interface functions. */ typedef struct mbedtls_rsa_context { int ver; /*!< Always 0.*/ size_t len; /*!< The size of \p N in Bytes. */ mbedtls_mpi N; /*!< The public modulus. */ mbedtls_mpi E; /*!< The public exponent. */ mbedtls_mpi D; /*!< The private exponent. */ mbedtls_mpi P; /*!< The first prime factor. */ mbedtls_mpi Q; /*!< The second prime factor. */ mbedtls_mpi DP; /*!< D % (P - 1). */ mbedtls_mpi DQ; /*!< D % (Q - 1). */ mbedtls_mpi QP; /*!< 1 / (Q % P). */ mbedtls_mpi RN; /*!< cached R^2 mod N. */ mbedtls_mpi RP; /*!< cached R^2 mod P. */ mbedtls_mpi RQ; /*!< cached R^2 mod Q. */ mbedtls_mpi Vi; /*!< The cached blinding value. */ mbedtls_mpi Vf; /*!< The cached un-blinding value. */ int padding; /*!< Selects padding mode: #MBEDTLS_RSA_PKCS_V15 for 1.5 padding and #MBEDTLS_RSA_PKCS_V21 for OAEP or PSS. */ int hash_id; /*!< Hash identifier of mbedtls_md_type_t type, as specified in md.h for use in the MGF mask generating function used in the EME-OAEP and EMSA-PSS encodings. */ #if defined(MBEDTLS_THREADING_C) mbedtls_threading_mutex_t mutex; /*!< Thread-safety mutex. */ #endif } mbedtls_rsa_context; #endif /* MBEDTLS_RSA_ALT */ #ifdef __cplusplus } #endif #endif /* MBEDTLS_RSA_ALT_H */