TianoCore EDK2 master
|
#include "InternalCryptLib.h"
#include <mbedtls/rsa.h>
Go to the source code of this file.
Functions | |
VOID *EFIAPI | RsaNew (VOID) |
VOID EFIAPI | RsaFree (IN VOID *RsaContext) |
BOOLEAN EFIAPI | RsaSetKey (IN OUT VOID *RsaContext, IN RSA_KEY_TAG KeyTag, IN CONST UINT8 *BigNumber, IN UINTN BnSize) |
BOOLEAN EFIAPI | RsaPkcs1Verify (IN VOID *RsaContext, IN CONST UINT8 *MessageHash, IN UINTN HashSize, IN CONST UINT8 *Signature, IN UINTN SigSize) |
RSA Asymmetric Cipher Wrapper Implementation over MbedTLS.
This file implements following APIs which provide basic capabilities for RSA: 1) RsaNew 2) RsaFree 3) RsaSetKey 4) RsaPkcs1Verify
RFC 8017 - PKCS #1: RSA Cryptography Specifications Version 2.2
Copyright (c) 2023, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
Definition in file CryptRsaBasic.c.
VOID EFIAPI RsaFree | ( | IN VOID * | RsaContext | ) |
Release the specified RSA context.
[in] | RsaContext | Pointer to the RSA context to be released. |
Definition at line 57 of file CryptRsaBasic.c.
VOID *EFIAPI RsaNew | ( | VOID | ) |
Allocates and initializes one RSA context for subsequent use.
Definition at line 30 of file CryptRsaBasic.c.
BOOLEAN EFIAPI RsaPkcs1Verify | ( | IN VOID * | RsaContext, |
IN CONST UINT8 * | MessageHash, | ||
IN UINTN | HashSize, | ||
IN CONST UINT8 * | Signature, | ||
IN UINTN | SigSize | ||
) |
Verifies the RSA-SSA signature with EMSA-PKCS1-v1_5 encoding scheme defined in RSA PKCS#1.
If RsaContext is NULL, then return FALSE. If MessageHash is NULL, then return FALSE. If Signature is NULL, then return FALSE. If HashSize is not equal to the size of MD5, SHA-1, SHA-256, SHA-384 or SHA-512 digest, then return FALSE.
[in] | RsaContext | Pointer to RSA context for signature verification. |
[in] | MessageHash | Pointer to octet message hash to be checked. |
[in] | HashSize | Size of the message hash in bytes. |
[in] | Signature | Pointer to RSA PKCS1-v1_5 signature to be verified. |
[in] | SigSize | Size of signature in bytes. |
TRUE | Valid signature encoded in PKCS1-v1_5. |
FALSE | Invalid signature or invalid RSA context. |
Definition at line 206 of file CryptRsaBasic.c.
BOOLEAN EFIAPI RsaSetKey | ( | IN OUT VOID * | RsaContext, |
IN RSA_KEY_TAG | KeyTag, | ||
IN CONST UINT8 * | BigNumber, | ||
IN UINTN | BnSize | ||
) |
Sets the tag-designated key component into the established RSA context.
This function sets the tag-designated RSA key component into the established RSA context from the user-specified non-negative integer (octet string format represented in RSA PKCS#1). If BigNumber is NULL, then the specified key component in RSA context is cleared.
If RsaContext is NULL, then return FALSE.
[in,out] | RsaContext | Pointer to RSA context being set. |
[in] | KeyTag | Tag of RSA key component being set. |
[in] | BigNumber | Pointer to octet integer buffer. If NULL, then the specified key component in RSA context is cleared. |
[in] | BnSize | Size of big number buffer in bytes. If BigNumber is NULL, then it is ignored. |
TRUE | RSA key component was set successfully. |
FALSE | Invalid RSA key component tag. |
Definition at line 91 of file CryptRsaBasic.c.