| 1 |
/** @file |
| 2 |
RSA Asymmetric Cipher Wrapper Implementation over OpenSSL. |
| 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 - 2012, Intel Corporation. All rights reserved.<BR> |
| 11 |
This program and the accompanying materials |
| 12 |
are licensed and made available under the terms and conditions of the BSD License |
| 13 |
which accompanies this distribution. The full text of the license may be found at |
| 14 |
http://opensource.org/licenses/bsd-license.php |
| 15 |
|
| 16 |
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, |
| 17 |
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. |
| 18 |
|
| 19 |
**/ |
| 20 |
|
| 21 |
#include "InternalCryptLib.h" |
| 22 |
|
| 23 |
/** |
| 24 |
Gets the tag-designated RSA key component from the established RSA context. |
| 25 |
|
| 26 |
Return FALSE to indicate this interface is not supported. |
| 27 |
|
| 28 |
@param[in, out] RsaContext Pointer to RSA context being set. |
| 29 |
@param[in] KeyTag Tag of RSA key component being set. |
| 30 |
@param[out] BigNumber Pointer to octet integer buffer. |
| 31 |
@param[in, out] BnSize On input, the size of big number buffer in bytes. |
| 32 |
On output, the size of data returned in big number buffer in bytes. |
| 33 |
|
| 34 |
@retval FALSE This interface is not supported. |
| 35 |
|
| 36 |
**/ |
| 37 |
BOOLEAN |
| 38 |
EFIAPI |
| 39 |
RsaGetKey ( |
| 40 |
IN OUT VOID *RsaContext, |
| 41 |
IN RSA_KEY_TAG KeyTag, |
| 42 |
OUT UINT8 *BigNumber, |
| 43 |
IN OUT UINTN *BnSize |
| 44 |
) |
| 45 |
{ |
| 46 |
ASSERT (FALSE); |
| 47 |
return FALSE; |
| 48 |
} |
| 49 |
|
| 50 |
/** |
| 51 |
Generates RSA key components. |
| 52 |
|
| 53 |
Return FALSE to indicate this interface is not supported. |
| 54 |
|
| 55 |
@param[in, out] RsaContext Pointer to RSA context being set. |
| 56 |
@param[in] ModulusLength Length of RSA modulus N in bits. |
| 57 |
@param[in] PublicExponent Pointer to RSA public exponent. |
| 58 |
@param[in] PublicExponentSize Size of RSA public exponent buffer in bytes. |
| 59 |
|
| 60 |
@retval FALSE This interface is not supported. |
| 61 |
|
| 62 |
**/ |
| 63 |
BOOLEAN |
| 64 |
EFIAPI |
| 65 |
RsaGenerateKey ( |
| 66 |
IN OUT VOID *RsaContext, |
| 67 |
IN UINTN ModulusLength, |
| 68 |
IN CONST UINT8 *PublicExponent, |
| 69 |
IN UINTN PublicExponentSize |
| 70 |
) |
| 71 |
{ |
| 72 |
ASSERT (FALSE); |
| 73 |
return FALSE; |
| 74 |
} |
| 75 |
|
| 76 |
/** |
| 77 |
Validates key components of RSA context. |
| 78 |
|
| 79 |
Return FALSE to indicate this interface is not supported. |
| 80 |
|
| 81 |
@param[in] RsaContext Pointer to RSA context to check. |
| 82 |
|
| 83 |
@retval FALSE This interface is not supported. |
| 84 |
|
| 85 |
**/ |
| 86 |
BOOLEAN |
| 87 |
EFIAPI |
| 88 |
RsaCheckKey ( |
| 89 |
IN VOID *RsaContext |
| 90 |
) |
| 91 |
{ |
| 92 |
ASSERT (FALSE); |
| 93 |
return FALSE; |
| 94 |
} |
| 95 |
|
| 96 |
/** |
| 97 |
Carries out the RSA-SSA signature generation with EMSA-PKCS1-v1_5 encoding scheme. |
| 98 |
|
| 99 |
Return FALSE to indicate this interface is not supported. |
| 100 |
|
| 101 |
@param[in] RsaContext Pointer to RSA context for signature generation. |
| 102 |
@param[in] MessageHash Pointer to octet message hash to be signed. |
| 103 |
@param[in] HashSize Size of the message hash in bytes. |
| 104 |
@param[out] Signature Pointer to buffer to receive RSA PKCS1-v1_5 signature. |
| 105 |
@param[in, out] SigSize On input, the size of Signature buffer in bytes. |
| 106 |
On output, the size of data returned in Signature buffer in bytes. |
| 107 |
|
| 108 |
@retval FALSE This interface is not supported. |
| 109 |
|
| 110 |
**/ |
| 111 |
BOOLEAN |
| 112 |
EFIAPI |
| 113 |
RsaPkcs1Sign ( |
| 114 |
IN VOID *RsaContext, |
| 115 |
IN CONST UINT8 *MessageHash, |
| 116 |
IN UINTN HashSize, |
| 117 |
OUT UINT8 *Signature, |
| 118 |
IN OUT UINTN *SigSize |
| 119 |
) |
| 120 |
{ |
| 121 |
ASSERT (FALSE); |
| 122 |
return FALSE; |
| 123 |
} |
| 124 |
|
| 125 |
|