1 /** @file
2   RSA Asymmetric Cipher Wrapper Null Implementation.
3 
4   This file does not provide real capabilities for following APIs in RSA handling:
5   1) RsaGetKey
6   2) RsaGenerateKey
7   3) RsaCheckKey
8   4) RsaPkcs1Sign
9 
10 Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
11 SPDX-License-Identifier: BSD-2-Clause-Patent
12 
13 **/
14 
15 #include "InternalCryptLib.h"
16 
17 /**
18   Gets the tag-designated RSA key component from the established RSA context.
19 
20   Return FALSE to indicate this interface is not supported.
21 
22   @param[in, out]  RsaContext  Pointer to RSA context being set.
23   @param[in]       KeyTag      Tag of RSA key component being set.
24   @param[out]      BigNumber   Pointer to octet integer buffer.
25   @param[in, out]  BnSize      On input, the size of big number buffer in bytes.
26                                On output, the size of data returned in big number buffer in bytes.
27 
28   @retval FALSE  This interface is not supported.
29 
30 **/
31 BOOLEAN
32 EFIAPI
RsaGetKey(IN OUT VOID * RsaContext,IN RSA_KEY_TAG KeyTag,OUT UINT8 * BigNumber,IN OUT UINTN * BnSize)33 RsaGetKey (
34   IN OUT  VOID         *RsaContext,
35   IN      RSA_KEY_TAG  KeyTag,
36   OUT     UINT8        *BigNumber,
37   IN OUT  UINTN        *BnSize
38   )
39 {
40   ASSERT (FALSE);
41   return FALSE;
42 }
43 
44 /**
45   Generates RSA key components.
46 
47   Return FALSE to indicate this interface is not supported.
48 
49   @param[in, out]  RsaContext           Pointer to RSA context being set.
50   @param[in]       ModulusLength        Length of RSA modulus N in bits.
51   @param[in]       PublicExponent       Pointer to RSA public exponent.
52   @param[in]       PublicExponentSize   Size of RSA public exponent buffer in bytes.
53 
54   @retval FALSE  This interface is not supported.
55 
56 **/
57 BOOLEAN
58 EFIAPI
RsaGenerateKey(IN OUT VOID * RsaContext,IN UINTN ModulusLength,IN CONST UINT8 * PublicExponent,IN UINTN PublicExponentSize)59 RsaGenerateKey (
60   IN OUT  VOID         *RsaContext,
61   IN      UINTN        ModulusLength,
62   IN      CONST UINT8  *PublicExponent,
63   IN      UINTN        PublicExponentSize
64   )
65 {
66   ASSERT (FALSE);
67   return FALSE;
68 }
69 
70 /**
71   Validates key components of RSA context.
72 
73   Return FALSE to indicate this interface is not supported.
74 
75   @param[in]  RsaContext  Pointer to RSA context to check.
76 
77   @retval FALSE  This interface is not supported.
78 
79 **/
80 BOOLEAN
81 EFIAPI
RsaCheckKey(IN VOID * RsaContext)82 RsaCheckKey (
83   IN  VOID  *RsaContext
84   )
85 {
86   ASSERT (FALSE);
87   return FALSE;
88 }
89 
90 /**
91   Carries out the RSA-SSA signature generation with EMSA-PKCS1-v1_5 encoding scheme.
92 
93   Return FALSE to indicate this interface is not supported.
94 
95   @param[in]       RsaContext   Pointer to RSA context for signature generation.
96   @param[in]       MessageHash  Pointer to octet message hash to be signed.
97   @param[in]       HashSize     Size of the message hash in bytes.
98   @param[out]      Signature    Pointer to buffer to receive RSA PKCS1-v1_5 signature.
99   @param[in, out]  SigSize      On input, the size of Signature buffer in bytes.
100                                 On output, the size of data returned in Signature buffer in bytes.
101 
102   @retval FALSE  This interface is not supported.
103 
104 **/
105 BOOLEAN
106 EFIAPI
RsaPkcs1Sign(IN VOID * RsaContext,IN CONST UINT8 * MessageHash,IN UINTN HashSize,OUT UINT8 * Signature,IN OUT UINTN * SigSize)107 RsaPkcs1Sign (
108   IN      VOID         *RsaContext,
109   IN      CONST UINT8  *MessageHash,
110   IN      UINTN        HashSize,
111   OUT     UINT8        *Signature,
112   IN OUT  UINTN        *SigSize
113   )
114 {
115   ASSERT (FALSE);
116   return FALSE;
117 }
118 
119 
120