Welcome to mirror list, hosted at ThFree Co, Russian Federation.

rsa_pkcs1v15.h « PKCS#1v15 « RSA « Inc « cryptographic « ble « STM32_WPAN « ST « Middlewares - github.com/Flipper-Zero/STM32CubeWB.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 32515b2095cd7389794474c2cf46c6969d34f3e7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
/**
  ******************************************************************************
  * @file    rsa.h
  * @author  MCD Application Team
  * @brief   Provides RSA operations with support for PKCS#1v1.5
  ******************************************************************************
  * @attention
  *
  * <h2><center>&copy; Copyright (c) 2015 STMicroelectronics.
  * All rights reserved.</center></h2>
  *
  * This software component is licensed by ST under Image license SLA0044,
  * 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.st.com/SLA0044
  *
  ******************************************************************************/

/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __CRL_RSA_H__
#define __CRL_RSA_H__

#ifdef __cplusplus
extern "C"
{
#endif

  /* Includes ------------------------------------------------------------------*/

  /** @ingroup RSA
    * @{
    */

  /**
    * @brief  Structure type for RSA public key
    */
  typedef struct
  {
    uint8_t  *pmModulus;    /*!< RSA Modulus */
    int32_t  mModulusSize;  /*!< Size of RSA Modulus */
    uint8_t  *pmExponent;   /*!< RSA Public Exponent */
    int32_t  mExponentSize; /*!< Size of RSA Public Exponent */
  }
  RSApubKey_stt;

  /**
    * @brief  Structure type for RSA private key
    */
  typedef struct
  {
    uint8_t  *pmModulus; /*!< RSA Modulus */
    int32_t  mModulusSize; /*!< Size of RSA Modulus */
    uint8_t  *pmExponent; /*!< RSA Private Exponent */
    int32_t  mExponentSize; /*!< Size of RSA Private Exponent */
  }
  RSAprivKey_stt;

  /**
    * @brief Structure type for input/output of PKCS#1 encryption/decryption operation
    */
  typedef struct
  {
    const uint8_t *pmInput;       /*!< Pointer to input buffer */
    int32_t mInputSize; /*!< Size of input buffer */
    uint8_t *pmOutput;      /*!< Pointer to output buffer */
  }
  RSAinOut_stt;

  int32_t RSA_PKCS1v15_Sign(const RSAprivKey_stt *P_pPrivKey, const uint8_t *P_pDigest, hashType_et P_hashType, uint8_t *P_pSignature, membuf_stt *P_pMemBuf);

  int32_t RSA_PKCS1v15_Verify(const RSApubKey_stt *P_pPubKey, const uint8_t *P_pDigest, hashType_et P_hashType, const uint8_t *P_pSignature, membuf_stt *P_pMemBuf);

  int32_t RSA_PKCS1v15_Encrypt (const RSApubKey_stt *P_pPubKey,
                                RSAinOut_stt *P_pInOut_st,
                                RNGstate_stt *P_pRandomState,
                                membuf_stt *P_pMemBuf);

  int32_t RSA_PKCS1v15_Decrypt (const RSAprivKey_stt *P_pPrivKey,
                                RSAinOut_stt *P_pInOut_st,
                                int32_t *P_pOutputSize,
                                membuf_stt *P_pMemBuf);

  /**
    * @}
    */

#ifdef __cplusplus
}
#endif

#endif /* __CRL_RSA_H__ */


/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/