12#include "InternalCryptLib.h"
13#include <mbedtls/rsa.h>
14#include <mbedtls/sha256.h>
15#include <mbedtls/sha512.h>
48 mbedtls_md_type_t MdAlg;
50 mbedtls_rsa_context *RsaKey;
52 if (RsaContext ==
NULL) {
56 if ((Message ==
NULL) || (MsgSize == 0) || (MsgSize > INT_MAX)) {
60 if (SaltLen != DigestLen) {
64 if ((Signature ==
NULL) || (SigSize == 0) || (SigSize > INT_MAX)) {
68 RsaKey = (mbedtls_rsa_context *)RsaContext;
69 if (mbedtls_rsa_complete (RsaKey) != 0) {
77 MdAlg = MBEDTLS_MD_SHA256;
78 if (mbedtls_sha256 (Message, MsgSize, HashValue,
FALSE) != 0) {
85 MdAlg = MBEDTLS_MD_SHA384;
86 if (mbedtls_sha512 (Message, MsgSize, HashValue,
TRUE) != 0) {
93 MdAlg = MBEDTLS_MD_SHA512;
94 if (mbedtls_sha512 (Message, MsgSize, HashValue,
FALSE) != 0) {
104 if (mbedtls_rsa_get_len (RsaContext) != SigSize) {
108 mbedtls_rsa_set_padding (RsaContext, MBEDTLS_RSA_PKCS_V21, MdAlg);
110 Ret = mbedtls_rsa_rsassa_pss_verify (
#define SHA512_DIGEST_SIZE
#define SHA256_DIGEST_SIZE
#define SHA384_DIGEST_SIZE
VOID *EFIAPI ZeroMem(OUT VOID *Buffer, IN UINTN Length)
BOOLEAN EFIAPI RsaPssVerify(IN VOID *RsaContext, IN CONST UINT8 *Message, IN UINTN MsgSize, IN CONST UINT8 *Signature, IN UINTN SigSize, IN UINT16 DigestLen, IN UINT16 SaltLen)