mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-31 01:24:12 +02:00
Fix PeiCryptLib build issue.
Signed-off-by: Ye Ting <ting.ye@intel.com> Reviewed-by: Yao Jiewen <jiewen.yao@intel.com> git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13670 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
15f2d73901
commit
efad60c584
@ -30,25 +30,5 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||||||
#define OPENSSL_SYSNAME_UWIN
|
#define OPENSSL_SYSNAME_UWIN
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
|
||||||
Pop single certificate from STACK_OF(X509).
|
|
||||||
|
|
||||||
If X509Stack, Cert, or CertSize is NULL, then return FALSE.
|
|
||||||
|
|
||||||
@param[in] X509Stack Pointer to a X509 stack object.
|
|
||||||
@param[out] Cert Pointer to a X509 certificate.
|
|
||||||
@param[out] CertSize Length of output X509 certificate in bytes.
|
|
||||||
|
|
||||||
@retval TRUE The X509 stack pop succeeded.
|
|
||||||
@retval FALSE The pop operation failed.
|
|
||||||
|
|
||||||
**/
|
|
||||||
BOOLEAN
|
|
||||||
X509PopCertificate (
|
|
||||||
IN VOID *X509Stack,
|
|
||||||
OUT UINT8 **Cert,
|
|
||||||
OUT UINTN *CertSize
|
|
||||||
);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -61,6 +61,7 @@
|
|||||||
Rand/CryptRandNull.c
|
Rand/CryptRandNull.c
|
||||||
|
|
||||||
SysCall/CrtWrapper.c
|
SysCall/CrtWrapper.c
|
||||||
|
SysCall/ConstantTimeClock.c
|
||||||
SysCall/BaseMemAllocation.c
|
SysCall/BaseMemAllocation.c
|
||||||
|
|
||||||
|
|
||||||
|
@ -218,6 +218,91 @@ WrapPkcs7Data (
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Pop single certificate from STACK_OF(X509).
|
||||||
|
|
||||||
|
If X509Stack, Cert, or CertSize is NULL, then return FALSE.
|
||||||
|
|
||||||
|
@param[in] X509Stack Pointer to a X509 stack object.
|
||||||
|
@param[out] Cert Pointer to a X509 certificate.
|
||||||
|
@param[out] CertSize Length of output X509 certificate in bytes.
|
||||||
|
|
||||||
|
@retval TRUE The X509 stack pop succeeded.
|
||||||
|
@retval FALSE The pop operation failed.
|
||||||
|
|
||||||
|
**/
|
||||||
|
BOOLEAN
|
||||||
|
X509PopCertificate (
|
||||||
|
IN VOID *X509Stack,
|
||||||
|
OUT UINT8 **Cert,
|
||||||
|
OUT UINTN *CertSize
|
||||||
|
)
|
||||||
|
{
|
||||||
|
BIO *CertBio;
|
||||||
|
X509 *X509Cert;
|
||||||
|
STACK_OF(X509) *CertStack;
|
||||||
|
BOOLEAN Status;
|
||||||
|
int Result;
|
||||||
|
int Length;
|
||||||
|
VOID *Buffer;
|
||||||
|
|
||||||
|
Status = FALSE;
|
||||||
|
|
||||||
|
if ((X509Stack == NULL) || (Cert == NULL) || (CertSize == NULL)) {
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
CertStack = (STACK_OF(X509) *) X509Stack;
|
||||||
|
|
||||||
|
X509Cert = sk_X509_pop (CertStack);
|
||||||
|
|
||||||
|
if (X509Cert == NULL) {
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
Buffer = NULL;
|
||||||
|
|
||||||
|
CertBio = BIO_new (BIO_s_mem ());
|
||||||
|
if (CertBio == NULL) {
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
Result = i2d_X509_bio (CertBio, X509Cert);
|
||||||
|
if (Result == 0) {
|
||||||
|
goto _Exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
Length = ((BUF_MEM *) CertBio->ptr)->length;
|
||||||
|
if (Length <= 0) {
|
||||||
|
goto _Exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
Buffer = malloc (Length);
|
||||||
|
if (Buffer == NULL) {
|
||||||
|
goto _Exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
Result = BIO_read (CertBio, Buffer, Length);
|
||||||
|
if (Result != Length) {
|
||||||
|
goto _Exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
*Cert = Buffer;
|
||||||
|
*CertSize = Length;
|
||||||
|
|
||||||
|
Status = TRUE;
|
||||||
|
|
||||||
|
_Exit:
|
||||||
|
|
||||||
|
BIO_free (CertBio);
|
||||||
|
|
||||||
|
if (!Status && (Buffer != NULL)) {
|
||||||
|
free (Buffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Get the signer's certificates from PKCS#7 signed data as described in "PKCS #7:
|
Get the signer's certificates from PKCS#7 signed data as described in "PKCS #7:
|
||||||
Cryptographic Message Syntax Standard". The input signed data could be wrapped
|
Cryptographic Message Syntax Standard". The input signed data could be wrapped
|
||||||
|
@ -224,91 +224,6 @@ X509StackFree (
|
|||||||
sk_X509_pop_free ((STACK_OF(X509) *) X509Stack, X509_free);
|
sk_X509_pop_free ((STACK_OF(X509) *) X509Stack, X509_free);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
Pop single certificate from STACK_OF(X509).
|
|
||||||
|
|
||||||
If X509Stack, Cert, or CertSize is NULL, then return FALSE.
|
|
||||||
|
|
||||||
@param[in] X509Stack Pointer to a X509 stack object.
|
|
||||||
@param[out] Cert Pointer to a X509 certificate.
|
|
||||||
@param[out] CertSize Length of output X509 certificate in bytes.
|
|
||||||
|
|
||||||
@retval TRUE The X509 stack pop succeeded.
|
|
||||||
@retval FALSE The pop operation failed.
|
|
||||||
|
|
||||||
**/
|
|
||||||
BOOLEAN
|
|
||||||
X509PopCertificate (
|
|
||||||
IN VOID *X509Stack,
|
|
||||||
OUT UINT8 **Cert,
|
|
||||||
OUT UINTN *CertSize
|
|
||||||
)
|
|
||||||
{
|
|
||||||
BIO *CertBio;
|
|
||||||
X509 *X509Cert;
|
|
||||||
STACK_OF(X509) *CertStack;
|
|
||||||
BOOLEAN Status;
|
|
||||||
int Result;
|
|
||||||
int Length;
|
|
||||||
VOID *Buffer;
|
|
||||||
|
|
||||||
Status = FALSE;
|
|
||||||
|
|
||||||
if ((X509Stack == NULL) || (Cert == NULL) || (CertSize == NULL)) {
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
CertStack = (STACK_OF(X509) *) X509Stack;
|
|
||||||
|
|
||||||
X509Cert = sk_X509_pop (CertStack);
|
|
||||||
|
|
||||||
if (X509Cert == NULL) {
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
Buffer = NULL;
|
|
||||||
|
|
||||||
CertBio = BIO_new (BIO_s_mem ());
|
|
||||||
if (CertBio == NULL) {
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
Result = i2d_X509_bio (CertBio, X509Cert);
|
|
||||||
if (Result == 0) {
|
|
||||||
goto _Exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
Length = ((BUF_MEM *) CertBio->ptr)->length;
|
|
||||||
if (Length <= 0) {
|
|
||||||
goto _Exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
Buffer = malloc (Length);
|
|
||||||
if (Buffer == NULL) {
|
|
||||||
goto _Exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
Result = BIO_read (CertBio, Buffer, Length);
|
|
||||||
if (Result != Length) {
|
|
||||||
goto _Exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
*Cert = Buffer;
|
|
||||||
*CertSize = Length;
|
|
||||||
|
|
||||||
Status = TRUE;
|
|
||||||
|
|
||||||
_Exit:
|
|
||||||
|
|
||||||
BIO_free (CertBio);
|
|
||||||
|
|
||||||
if (!Status && (Buffer != NULL)) {
|
|
||||||
free (Buffer);
|
|
||||||
}
|
|
||||||
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Retrieve the subject bytes from one X.509 certificate.
|
Retrieve the subject bytes from one X.509 certificate.
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user