TianoCore EDK2 master
Loading...
Searching...
No Matches
CryptRsaPssSign.c File Reference
#include "InternalCryptLib.h"
#include <openssl/bn.h>
#include <openssl/rsa.h>
#include <openssl/objects.h>
#include <openssl/evp.h>

Go to the source code of this file.

Functions

STATIC const EVP_MD * GetEvpMD (IN UINT16 DigestLen)
 
BOOLEAN EFIAPI RsaPssSign (IN VOID *RsaContext, IN CONST UINT8 *Message, IN UINTN MsgSize, IN UINT16 DigestLen, IN UINT16 SaltLen, OUT UINT8 *Signature, IN OUT UINTN *SigSize)
 

Detailed Description

RSA PSS Asymmetric Cipher Wrapper Implementation over OpenSSL.

This file implements following APIs which provide basic capabilities for RSA: 1) RsaPssSign

Copyright (c) 2021, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file CryptRsaPssSign.c.

Function Documentation

◆ GetEvpMD()

STATIC const EVP_MD * GetEvpMD ( IN UINT16  DigestLen)

Retrieve a pointer to EVP message digest object.

Parameters
[in]DigestLenLength of the message digest.

Definition at line 28 of file CryptRsaPssSign.c.

◆ RsaPssSign()

BOOLEAN EFIAPI RsaPssSign ( IN VOID *  RsaContext,
IN CONST UINT8 *  Message,
IN UINTN  MsgSize,
IN UINT16  DigestLen,
IN UINT16  SaltLen,
OUT UINT8 *  Signature,
IN OUT UINTN SigSize 
)

Carries out the RSA-SSA signature generation with EMSA-PSS encoding scheme.

This function carries out the RSA-SSA signature generation with EMSA-PSS encoding scheme defined in RFC 8017. Mask generation function is the same as the message digest algorithm. If the Signature buffer is too small to hold the contents of signature, FALSE is returned and SigSize is set to the required buffer size to obtain the signature.

If RsaContext is NULL, then return FALSE. If Message is NULL, then return FALSE. If MsgSize is zero or > INT_MAX, then return FALSE. If DigestLen is NOT 32, 48 or 64, return FALSE. If SaltLen is not equal to DigestLen, then return FALSE. If SigSize is large enough but Signature is NULL, then return FALSE. If this interface is not supported, then return FALSE.

Parameters
[in]RsaContextPointer to RSA context for signature generation.
[in]MessagePointer to octet message to be signed.
[in]MsgSizeSize of the message in bytes.
[in]DigestLenLength of the digest in bytes to be used for RSA signature operation.
[in]SaltLenLength of the salt in bytes to be used for PSS encoding.
[out]SignaturePointer to buffer to receive RSA PSS signature.
[in,out]SigSizeOn input, the size of Signature buffer in bytes. On output, the size of data returned in Signature buffer in bytes.
Return values
TRUESignature successfully generated in RSASSA-PSS.
FALSESignature generation failed.
FALSESigSize is too small.
FALSEThis interface is not supported.

Definition at line 81 of file CryptRsaPssSign.c.