Yi Li
0c9d4ad788
CryptoPkg/Test: Add unit test for CryptoBn
...
Add unit test for CryptoBn.
Cc: Jiewen Yao <jiewen.yao@intel.com >
Cc: Jian J Wang <jian.j.wang@intel.com >
Cc: Xiaoyu Lu <xiaoyu1.lu@intel.com >
Cc: Guomin Jiang <guomin.jiang@intel.com >
Signed-off-by: Yi Li <yi1.li@intel.com >
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com >
2022-09-23 10:08:24 +00:00
Yi Li
fd0ad0c346
CryptoPkg: Add BigNum support
...
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3828
This patch is used to add CryptBn library, which is wrapped
over OpenSSL.
Cc: Jiewen Yao <jiewen.yao@intel.com >
Cc: Jian J Wang <jian.j.wang@intel.com >
Cc: Xiaoyu Lu <xiaoyu1.lu@intel.com >
Cc: Guomin Jiang <guomin.jiang@intel.com >
Signed-off-by: Yi Li <yi1.li@intel.com >
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com >
2022-09-23 10:08:24 +00:00
Qi Zhang
5f403cdc6a
CryptoPkg: add UnitTest for AeadAesGcm.
...
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4036
Signed-off-by: Qi Zhang <qi1.zhang@intel.com >
Cc: Jiewen Yao <jiewen.yao@intel.com >
Cc: Jian J Wang <jian.j.wang@intel.com >
Cc: Xiaoyu Lu <xiaoyu1.lu@intel.com >
Cc: Guomin Jiang <guomin.jiang@intel.com >
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com >
2022-09-23 08:24:42 +00:00
Qi Zhang
a23f76e184
CryptoPkg: add AeadAesGcm support.
...
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4036
Signed-off-by: Qi Zhang <qi1.zhang@intel.com >
Cc: Jiewen Yao <jiewen.yao@intel.com >
Cc: Jian J Wang <jian.j.wang@intel.com >
Cc: Xiaoyu Lu <xiaoyu1.lu@intel.com >
Cc: Guomin Jiang <guomin.jiang@intel.com >
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com >
2022-09-23 08:24:42 +00:00
Qi Zhang
11b24ef0d7
CryptoPkg: add new Hkdf api in Crypt Lib.
...
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4033
Signed-off-by: Qi Zhang <qi1.zhang@intel.com >
Cc: Jiewen Yao <jiewen.yao@intel.com >
Cc: Jian J Wang <jian.j.wang@intel.com >
Cc: Xiaoyu Lu <xiaoyu1.lu@intel.com >
Cc: Guomin Jiang <guomin.jiang@intel.com >
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com >
2022-09-23 07:35:08 +00:00
Qi Zhang
f3c69cb5a1
CryptoPkg: add Hmac Sha384 to host UnitTest.
...
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4025
Signed-off-by: Qi Zhang <qi1.zhang@intel.com >
Cc: Jiewen Yao <jiewen.yao@intel.com >
Cc: Jian J Wang <jian.j.wang@intel.com >
Cc: Xiaoyu Lu <xiaoyu1.lu@intel.com >
Cc: Guomin Jiang <guomin.jiang@intel.com >
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com >
2022-09-23 06:55:58 +00:00
Qi Zhang
cbb3b6b950
CryptoPkg: Update CryptLib inf as the file name changed.
...
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4025
Signed-off-by: Qi Zhang <qi1.zhang@intel.com >
Cc: Jiewen Yao <jiewen.yao@intel.com >
Cc: Jian J Wang <jian.j.wang@intel.com >
Cc: Xiaoyu Lu <xiaoyu1.lu@intel.com >
Cc: Guomin Jiang <guomin.jiang@intel.com >
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com >
2022-09-23 06:55:58 +00:00
Qi Zhang
0b1a1bdc30
CryptoPkg: Add HMAC-SHA384 cipher support.
...
Rename file from CryptHmacSha256 to CryptHmac and
add HmacSha384 and HmacSha256All funcitons.
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4025
Signed-off-by: Qi Zhang <qi1.zhang@intel.com >
Cc: Jiewen Yao <jiewen.yao@intel.com >
Cc: Jian J Wang <jian.j.wang@intel.com >
Cc: Xiaoyu Lu <xiaoyu1.lu@intel.com >
Cc: Guomin Jiang <guomin.jiang@intel.com >
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com >
2022-09-23 06:55:58 +00:00
Wenyi Xie
6f340acfb1
CryptoPkg/BaseCryptLib:Remove redundant init
...
CertCtx is used to be defined as a struct and ZeroMem is called to
init this struct. But now CertCtx is defined as a point, so use
ZeroMem (&CertCtx, sizeof (CertCtx)) is not correct any more.
Cc: Jiewen Yao <jiewen.yao@intel.com >
Cc: Jian J Wang <jian.j.wang@intel.com >
Cc: Xiaoyu Lu <xiaoyu1.lu@intel.com >
Cc: Guomin Jiang <guomin.jiang@intel.com >
Signed-off-by: Wenyi Xie <xiewenyi2@huawei.com >
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com >
2022-09-23 00:36:29 +00:00
Min Xu
b1567b2e15
CryptoPkg: Add SecCryptLib
...
RFC: https://bugzilla.tianocore.org/show_bug.cgi?id=3853
This is the Cryptographic library instance for SEC. The motivation of
this library is to support SHA384 in SEC phase for Td guest. So only
Hash/CryptSha512.c is included which supports SHA384 and SHA512. Other
cryptographics are added with the null version, such as CryptMd5Null.c.
Cc: Jiewen Yao <jiewen.yao@intel.com >
Cc: Jian J Wang <jian.j.wang@intel.com >
Cc: Xiaoyu Lu <xiaoyu1.lu@intel.com >
Cc: Guomin Jiang <guomin.jiang@intel.com >
Cc: Gerd Hoffmann <kraxel@redhat.com >
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com >
Signed-off-by: Min Xu <min.m.xu@intel.com >
2022-06-03 11:41:36 +00:00
Rebecca Cran
e9eeb0ad2b
CryptoPkg: Remove RVCT support
...
RVCT is obsolete and no longer used.
Remove support for it.
Signed-off-by: Rebecca Cran <quic_rcran@quicinc.com >
Reviewed-by: Ard Biesheuvel <ardb@kernel.org >
2022-05-13 14:58:54 +00:00
Yi Li
43613b2fe8
CryptoPkg: Rename PCD about openssl EC configuration
...
PcdOpensslXXXEnabled is a more appropriate choice.
Signed-off-by: Yi Li <yi1.li@intel.com >
Cc: Jiewen Yao <jiewen.yao@intel.com >
Cc: Jian J Wang <jian.j.wang@intel.com >
Cc: Xiaoyu Lu <xiaoyu1.lu@intel.com >
Cc: Guomin Jiang <guomin.jiang@intel.com >
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com >
2022-05-11 00:04:39 +00:00
Yi Li
b06a007b64
CryptoPkg: Declare PcdEcEnabled in Library consuming OpensslLib
...
REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3679
REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3828
Tls/Base/Pei/Smm/RuntimeCryptLib.inf will use OpensslLib,
and the opensslconf.h in openssllib will use PcdEcEnabled,
but it is not declared in the inf file now,
it will cause warnings in some compilers.
Cc: Jiewen Yao <jiewen.yao@intel.com >
Cc: Jian J Wang <jian.j.wang@intel.com >
Signed-off-by: Yi Li <yi1.li@intel.com >
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com >
2022-04-21 05:06:37 +00:00
Gerd Hoffmann
532bd4ec38
CryptoPkg/Crt: fix strcpy build on older VS compilers
...
Drop 'restrict' keyword which older visual studio compiler
versions complain about.
Fixes: fab6285a73
("CryptoPkg/CrtLibSupport: fix strcpy")
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com >
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com >
2022-04-20 10:56:03 +00:00
Gerd Hoffmann
fab6285a73
CryptoPkg/CrtLibSupport: fix strcpy
...
strcpy() returns a pointer to the destination string, AsciiStrCpyS()
does not. So a simple #define does not work. Create a function
instead.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com >
Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com >
2022-04-12 14:39:01 +00:00
Li, Zhihao
355515a06a
CryptoPkg? Redefinition bug in CrtLibSupport.h.
...
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3885
Parallel hash patch redefines uint_64 type in CrtLibSupport.h
which has been defined in openssl/include/openssl/e_os2.h.
CryptMd5.c including e_os2.h cause redefinition bug.
Cc: Jiewen Yao <jiewen.yao@intel.com >
Cc: Jian J Wang <jian.j.wang@intel.com >
Cc: Xiaoyu Lu <xiaoyu1.lu@intel.com >
Cc: Guomin Jiang <guomin.jiang@intel.com >
Cc: Siyuan Fu <siyuan.fu@intel.com >
Signed-off-by: Zhihao Li <zhihao.li@intel.com >
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com >
2022-03-26 10:40:04 +00:00
Zhihao Li
c1e662101a
CryptoPkg: Add new hash algorithm ParallelHash256HashAll in BaseCryptLib.
...
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3596
Parallel hash function ParallelHash256HashAll, as defined in NIST's
Special Publication 800-185, published December 2016. It utilizes
multi-process to calculate the digest.
Passed CI test.
Onprotocol version code passed test.
Cc: Jiewen Yao <jiewen.yao@intel.com >
Cc: Jian J Wang <jian.j.wang@intel.com >
Cc: Xiaoyu Lu <xiaoyu1.lu@intel.com >
Cc: Guomin Jiang <guomin.jiang@intel.com >
Cc: Siyuan Fu <siyuan.fu@intel.com >
Signed-off-by: Zhihao Li <zhihao.li@intel.com >
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com >
2022-03-18 06:49:18 +00:00
Michael Kubacki
7c34237831
CryptoPkg: Apply uncrustify changes
...
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3737
Apply uncrustify changes to .c/.h files in the CryptoPkg package
Cc: Andrew Fish <afish@apple.com >
Cc: Leif Lindholm <leif@nuviainc.com >
Cc: Michael D Kinney <michael.d.kinney@intel.com >
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com >
Reviewed-by: Jian J Wang <jian.j.wang@intel.com >
2021-12-07 17:24:28 +00:00
Michael D Kinney
c8f46130f8
CryptoPkg: Change OPTIONAL keyword usage style
...
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3760
Update all use of ', OPTIONAL' to ' OPTIONAL,' for function params.
Cc: Andrew Fish <afish@apple.com >
Cc: Leif Lindholm <leif@nuviainc.com >
Cc: Michael Kubacki <michael.kubacki@microsoft.com >
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com >
Reviewed-by: Jian J Wang <jian.j.wang@intel.com >
2021-12-07 17:24:28 +00:00
Bob Morgan
f22feb0e3b
CryptoPkg/BaseCryptLib: Eliminate extra buffer copy in Pkcs7Verify()
...
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3617
Create a read-only openSSL BIO wrapper for the existing input
buffer passed to Pkcs7Verify() instead of copying the buffer
into an empty writable BIO which causes memory allocations
within openSSL.
Cc: Jiewen Yao <jiewen.yao@intel.com >
Cc: Jian J Wang <jian.j.wang@intel.com >
Cc: Xiaoyu Lu <xiaoyux.lu@intel.com >
Cc: Guomin Jiang <guomin.jiang@intel.com >
Signed-off-by: Bob Morgan <bobm@nvidia.com >
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com >
2021-10-13 01:45:18 +00:00
Stewart, Chris (SW Architect) via groups.io
7b4a99be8a
CryptoPkg: BaseCryptLib fix incorrect param order
...
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3550
Function ConvertAsn1TimeToEfiTime initializes timestamp to zeroes with
SetMem, but the actual parameters are out of order. The result is
the SetMem operation has no effect. The fix is to put the actual
parameters in the correct order.
Signed-off-by: Chris Stewart <chris.stewart@hp.com >
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn >
Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com >
Cc: Jiewen Yao <jiewen.yao@intel.com >
Cc: Jian J Wang <jian.j.wang@intel.com >
Cc: Xiaoyu Lu <xiaoyux.lu@intel.com >
Cc: Guomin Jiang <guomin.jiang@intel.com >
2021-08-24 00:35:06 +00:00
xueshengfeng
eba32695ee
CryptoPkg/BaseCryptLib: Enabled CryptSha512 for Smm/Runtime drivers
...
Intel Platform utility Syscfg/sysfwupdt will trigger SMI
to enter BIOS interface. then BIOS invoke EncodePassword
in SMM mode to check password.
it's need sha384(in CryptSha512.c) in SMM mode.
the origin SmmCryptLib.lib size is 1389KB,
after changed, the size is 1391KB.
the origin RuntimeCryptLib.lib size is 911KB,
after changed,the size is 913KB.
in SmmCryptLib.inf and RuntimeCryptLib.inf,
change CryptSha512NULL.c to CryptSha512.c.
https://bugzilla.tianocore.org/show_bug.cgi?id=3423
Signed-off-by: xueshengfeng <xueshengfeng@byosoft.com.cn >
Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com >
2021-06-24 02:46:14 +00:00
Agrawal, Sachin
20ca528828
CryptoPkg: BaseCryptLib: Update Salt length requirement for RSA-PSS scheme.
...
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3455
Enforce salt length to be equal to digest length for RSA-PSS
encoding scheme.
Cc: Jiewen Yao <jiewen.yao@intel.com >
Cc: Jian J Wang <jian.j.wang@intel.com >
Cc: Xiaoyu Lu <xiaoyux.lu@intel.com >
Cc: Guomin Jiang <guomin.jiang@intel.com >
Signed-off-by: Sachin Agrawal <sachin.agrawal@intel.com >
Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com >
2021-06-23 15:19:44 +00:00
Sergei Dmitrouk
15ee7b7689
CryptoPkg/BaseCryptLib: Fix possible uninitialized use
...
`Result` can be used uninitialized in both functions after following
either first or second `goto` statement.
Cc: Jiewen Yao <jiewen.yao@intel.com >
Cc: Jian J Wang <jian.j.wang@intel.com >
Cc: Xiaoyu Lu <xiaoyux.lu@intel.com >
Cc: Guomin Jiang <guomin.jiang@intel.com >
Signed-off-by: Sergei Dmitrouk <sergei@posteo.net >
Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com >
2021-05-19 01:39:49 +00:00
Sachin Agrawal
22ac5cc9d9
CryptoPkg: BaseCryptLib: Add RSA PSS verify support
...
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3314
This patch uses Openssl's EVP API's to perform RSASSA-PSS verification
of a binary blob.
Cc: Jiewen Yao <jiewen.yao@intel.com >
Cc: Jian J Wang <jian.j.wang@intel.com >
Cc: Xiaoyu Lu <xiaoyux.lu@intel.com >
Cc: Guomin Jiang <guomin.jiang@intel.com >
Signed-off-by: Sachin Agrawal <sachin.agrawal@intel.com >
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com >
2021-05-14 03:35:33 +00:00
Kun Qin
21f984cede
CryptoPkg: BaseCryptLib: Fix buffer double free in CryptPkcs7VerifyEku
...
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2459
SignerCert is part of Pkcs7 instance when both have valid content. OpenSLL
PKCS7_free function will release the memory of SignerCert when applicable.
Freeing SignerCert with X509_free again might cause page fault if use-
after-free guard is enabled.
Cc: Jian J Wang <jian.j.wang@intel.com >
Cc: Xiaoyu Lu <xiaoyux.lu@intel.com >
Cc: Jiewen Yao <jiewen.yao@intel.com >
Cc: Guomin Jiang <guomin.jiang@intel.com >
Signed-off-by: Kun Qin <kun.q@outlook.com >
Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com >
2020-11-26 03:22:24 +00:00
Gao, Zhichao
e6a12a0fc8
CryptoPkg: Make the MD5 disable as default for security
...
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3021
Make the deprecated MD5 disable as default setting for
security.
Cc: Jiewen Yao <jiewen.yao@intel.com >
Cc: Jian J Wang <jian.j.wang@intel.com >
Cc: Xiaoyu Lu <xiaoyux.lu@intel.com >
Cc: Guomin Jiang <guomin.jiang@intel.com >
Signed-off-by: Zhichao Gao <zhichao.gao@intel.com >
Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com >
Message-Id: <20201112055558.2348-14-zhichao.gao@intel.com >
2020-11-17 19:26:50 +00:00
Jian J Wang
26442d11e6
CryptoPkg/BaseCryptLib: fix NULL dereference (CVE-2019-14584)
...
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1914
AuthenticodeVerify() calls OpenSSLs d2i_PKCS7() API to parse asn encoded
signed authenticode pkcs#7 data. when this successfully returns, a type
check is done by calling PKCS7_type_is_signed() and then
Pkcs7->d.sign->contents->type is used. It is possible to construct an asn1
blob that successfully decodes and have d2i_PKCS7() return a valid pointer
and have PKCS7_type_is_signed() also return success but have Pkcs7->d.sign
be a NULL pointer.
Looking at how PKCS7_verify() [inside of OpenSSL] implements checking for
pkcs7 structs it does the following:
- call PKCS7_type_is_signed()
- call PKCS7_get_detached()
Looking into how PKCS7_get_detatched() is implemented, it checks to see if
p7->d.sign is NULL or if p7->d.sign->contents->d.ptr is NULL.
As such, the fix is to do the same as OpenSSL after calling d2i_PKCS7().
- Add call to PKS7_get_detached() to existing error handling
Cc: Xiaoyu Lu <xiaoyux.lu@intel.com >
Cc: Guomin Jiang <guomin.jiang@intel.com >
Cc: Jiewen Yao <jiewen.yao@intel.com >
Cc: Laszlo Ersek <lersek@redhat.com >
Signed-off-by: Jian J Wang <jian.j.wang@intel.com >
Reviewed-by: Laszlo Ersek <lersek@redhat.com >
Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com >
2020-10-21 06:32:46 +00:00
Matthew Carlson
694bfd6ff5
CryptoPkg: BaseCryptLib: Add unit tests (Host and Shell based)
...
This adds a new INF for BaseCryptLib suitable for
host based environments. It adds a host based unit test for
BaseCryptLib that can also be built as a shell based Unit Test.
In addition, this also adds a UnitTestHostCrtWrapper.c file, which provides
some of the functionality not provided by the default host based unit test
system that OpenSSL expects. This is used by UnitTestHostBaseCryptLib, a
version of the BaseCryptLib meant specifically for host based unit testing.
Cc: Jian J Wang <jian.j.wang@intel.com >
Cc: Xiaoyu Lu <xiaoyux.lu@intel.com >
Cc: Jiewen Yao <jiewen.yao@intel.com >
Cc: Guomin Jiang <guomin.jiang@intel.com >
Signed-off-by: Matthew Carlson <matthewfcarlson@gmail.com >
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com >
2020-10-18 00:49:58 +00:00
Wang, Jian J
52dbaaeace
CryptoPkg/BaseCryptLib: add crypto algorithms needed by variable protection
...
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2594
Crypto algorithms, hkdf-sha256/hmac-sha256/aes, are needed to verify
integrity of variable data, derive hmac and encryption keys, and
encrypt/decrypt varible. Replacing null version source code with real
implementations makes sure we can enable full functionalities of protected
variable later.
Cc: Xiaoyu Lu <xiaoyux.lu@intel.com >
Cc: Jiewen Yao <jiewen.yao@intel.com >
Cc: Guomin Jiang <guomin.jiang@intel.com >
Cc: Nishant C Mistry <nishant.c.mistry@intel.com >
Signed-off-by: Jian J Wang <jian.j.wang@intel.com >
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com >
2020-09-29 05:58:58 +00:00
Guomin Jiang
8c30327deb
CryptoPkg/OpensslLib: Upgrade OpenSSL to 1.1.1g
...
Upgrade openssl to 1.1.1g. the directory have been reorganized,
openssl moved crypto/include/internal to include/crypto folder.
So we change directory to match the re-organization.
The dso_conf.h and opensslconf.h will generated in UNIX format,
change process_files.pl to covent the EOL automatically.
Cc: Jian J Wang <jian.j.wang@intel.com >
Cc: Xiaoyu Lu <xiaoyux.lu@intel.com >
Signed-off-by: Guomin Jiang <guomin.jiang@intel.com >
Reviewed-by: Laszlo Ersek <lersek@redhat.com >
Tested-by: Laszlo Ersek <lersek@redhat.com >
Reviewed-by: Jian J Wang <jian.j.wang@intel.com >
2020-07-25 06:27:14 +00:00
Zhichao Gao
0f01cec52f
CryptoPkg/BaseCryptLib: Add MARCO to disable the deprecated SHA1
...
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1682
SHA1 is deprecated but it is required for compatible issue.
So add a MARCO for the platform to disable the usage of SHA1 for
security.
Cc: Jian J Wang <jian.j.wang@intel.com >
Cc: Xiaoyu Lu <xiaoyux.lu@intel.com >
Cc: Jiewen Yao <jiewen.yao@intel.com >
Cc: Siyuan Fu <siyuan.fu@intel.com >
Cc: Michael D Kinney <michael.d.kinney@intel.com >
Signed-off-by: Zhichao Gao <zhichao.gao@intel.com >
Reviewed-by: Jian J Wang <jian.j.wang@intel.com >
2020-06-29 05:25:55 +00:00
Zhichao Gao
acfd555795
CryptoPkg/BaseCryptLib: Add MARCO to disable the deprecated MD5
...
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1682
MD5 is deprecated but it is required for compatible issue.
So add a MARCO for the platform to disable the usage of MD5 for
security.
Cc: Jian J Wang <jian.j.wang@intel.com >
Cc: Xiaoyu Lu <xiaoyux.lu@intel.com >
Cc: Jiewen Yao <jiewen.yao@intel.com >
Cc: Siyuan Fu <siyuan.fu@intel.com >
Cc: Michael D Kinney <michael.d.kinney@intel.com >
Signed-off-by: Zhichao Gao <zhichao.gao@intel.com >
Reviewed-by: Jian J Wang <jian.j.wang@intel.com >
2020-06-29 05:25:55 +00:00
Zhichao Gao
c812d3209c
CryptoPkg/BaseCryptLib: Retire HMAC SHA1 algorithm
...
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1898
HMAC SHA1 is not secure any longer.
Remove the HMAC SHA1 support from edk2.
Change the HMAC SHA1 field name in EDKII_CRYPTO_PROTOCOL to indicate the
function is unsupported any longer.
Cc: Jian J Wang <jian.j.wang@intel.com >
Cc: Xiaoyu Lu <xiaoyux.lu@intel.com >
Cc: Siyuan Fu <siyuan.fu@intel.com >
Cc: Michael D Kinney <michael.d.kinney@intel.com >
Cc: Jiewen Yao <jiewen.yao@intel.com >
Cc: Philippe Mathieu-Daude <philmd@redhat.com >
Reviewed-by: Jian J Wang <jian.j.wang@intel.com >
Signed-off-by: Zhichao Gao <zhichao.gao@intel.com >
2020-05-15 07:22:36 +00:00
Zhichao Gao
b6174e2d09
CryptoPkg/BaseCryptLib: Retire HMAC MD5 algorithm
...
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1898
HMAC MD5 is not secure any longer.
Remove the HMAC MD5 support from edk2.
Change the HMAC MD5 field name in EDKII_CRYPTO_PROTOCOL to indicate the
function is unsupported any longer.
Cc: Jian J Wang <jian.j.wang@intel.com >
Cc: Xiaoyu Lu <xiaoyux.lu@intel.com >
Cc: Siyuan Fu <siyuan.fu@intel.com >
Cc: Michael D Kinney <michael.d.kinney@intel.com >
Cc: Jiewen Yao <jiewen.yao@intel.com >
Cc: Philippe Mathieu-Daude <philmd@redhat.com >
Reviewed-by: Jian J Wang <jian.j.wang@intel.com >
Signed-off-by: Zhichao Gao <zhichao.gao@intel.com >
2020-05-15 07:22:36 +00:00
Zhichao Gao
80e28dcec8
CryptoPkg/BaseCryptLib: Retire Aes Ecb mode algorithm
...
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1898
Aes Ecb mode is not secure any longer.
Remove the Aes Ecb mode support from edk2.
Change the Aes Ecb mode field name in EDKII_CRYPTO_PROTOCOL to indicate the
function is unsupported any longer.
Cc: Jian J Wang <jian.j.wang@intel.com >
Cc: Xiaoyu Lu <xiaoyux.lu@intel.com >
Cc: Siyuan Fu <siyuan.fu@intel.com >
Cc: Michael D Kinney <michael.d.kinney@intel.com >
Cc: Jiewen Yao <jiewen.yao@intel.com >
Cc: Philippe Mathieu-Daude <philmd@redhat.com >
Reviewed-by: Jian J Wang <jian.j.wang@intel.com >
Signed-off-by: Zhichao Gao <zhichao.gao@intel.com >
2020-05-15 07:22:36 +00:00
Zhichao Gao
b8af2c9eda
CryptoPkg/BaseCryptLib: Retire the TDES algorithm
...
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1898
TDES is not secure any longer.
Remove the Tdes support from edk2.
Change the Tdes field name in EDKII_CRYPTO_PROTOCOL to indicate the
function is unsupported any longer.
Cc: Jian J Wang <jian.j.wang@intel.com >
Cc: Xiaoyu Lu <xiaoyux.lu@intel.com >
Cc: Siyuan Fu <siyuan.fu@intel.com >
Cc: Michael D Kinney <michael.d.kinney@intel.com >
Cc: Jiewen Yao <jiewen.yao@intel.com >
Cc: Philippe Mathieu-Daude <philmd@redhat.com >
Reviewed-by: Jian J Wang <jian.j.wang@intel.com >
Signed-off-by: Zhichao Gao <zhichao.gao@intel.com >
2020-05-15 07:22:36 +00:00
Zhichao Gao
c22a32e1ab
CryptoPkg/BaseCryptLib: Retire ARC4 algorithm
...
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1898
ARC4 is not secure any longer.
Remove the ARC4 support from edk2.
Change the ARC4 field name in EDKII_CRYPTO_PROTOCOL to indicate the
function is unsupported any longer.
Cc: Jian J Wang <jian.j.wang@intel.com >
Cc: Xiaoyu Lu <xiaoyux.lu@intel.com >
Cc: Siyuan Fu <siyuan.fu@intel.com >
Cc: Michael D Kinney <michael.d.kinney@intel.com >
Cc: Jiewen Yao <jiewen.yao@intel.com >
Cc: Philippe Mathieu-Daude <philmd@redhat.com >
Reviewed-by: Jian J Wang <jian.j.wang@intel.com >
Signed-off-by: Zhichao Gao <zhichao.gao@intel.com >
2020-05-15 07:22:36 +00:00
Zhichao Gao
0a6fc3d067
CryptoPkg/BaseCrpytLib: Retire MD4 algorithm
...
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1898
MD4 is not secure any longer.
Remove the MD4 support from edk2.
Change the MD4 field name in EDKII_CRYPTO_PROTOCOL to indicate the
function is unsupported any longer.
Cc: Jian J Wang <jian.j.wang@intel.com >
Cc: Xiaoyu Lu <xiaoyux.lu@intel.com >
Cc: Siyuan Fu <siyuan.fu@intel.com >
Cc: Michael D Kinney <michael.d.kinney@intel.com >
Cc: Jiewen Yao <jiewen.yao@intel.com >
Cc: Philippe Mathieu-Daude <philmd@redhat.com >
Reviewed-by: Jian J Wang <jian.j.wang@intel.com >
Signed-off-by: Zhichao Gao <zhichao.gao@intel.com >
2020-05-15 07:22:36 +00:00
Guomin Jiang
469eb46169
CryptoPkg/Pkcs7: Extend support for other OID types
...
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2539
Microsoft signtool supports creation of attached P7's with any OID payload
via the "/p7co" parameter. It is necessary to check the data before get
the string.
Cc: Jian J Wang <jian.j.wang@intel.com >
Cc: Xiaoyu Lu <xiaoyux.lu@intel.com >
Signed-off-by: Guomin Jiang <guomin.jiang@intel.com >
Reviewed-by: Jian J Wang <jian.j.wang@intel.com >
2020-05-06 03:37:39 +00:00
Abner Chang
9025a014f9
CryptoPkg: Add RISC-V architecture for EDK2 CI.
...
Add RISC-V architecture for EDK2 CI testing.
BZ:2562:
https://bugzilla.tianocore.org/show_bug.cgi?id=2562
Signed-off-by: Abner Chang <abner.chang@hpe.com >
Co-authored-by: Daniel Schaefer <daniel.schaefer@hpe.com >
Reviewed-by: Xiaoyu Lu <xiaoyux.lu@intel.com >
Cc: Jian J Wang <jian.j.wang@intel.com >
Cc: Xiaoyu Lu <xiaoyux.lu@intel.com >
Cc: Leif Lindholm <leif@nuviainc.com >
Cc: Gilbert Chen <gilbert.chen@hpe.com >
2020-04-03 17:09:12 +00:00
Michael D Kinney
668621362f
CryptoPkg/BaseCryptLib: Add X509ConstructCertificateStackV().
...
https://bugzilla.tianocore.org/show_bug.cgi?id=2420
Add X509ConstructCertificateStackV() to BaseCryptLib that is
identical in behavior to X509ConstructCertificateStack(), but
it takes a VA_LIST parameter for the variable argument list.
The VA_LIST form of this function is required for BaseCryptLib
functions to be wrapped in a Protocol/PPI.
Cc: Jian J Wang <jian.j.wang@intel.com >
Cc: Xiaoyu Lu <xiaoyux.lu@intel.com >
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com >
Reviewed-by: Jian J Wang <jian.j.wang@intel.com >
2020-02-07 16:32:13 +00:00
Jian J Wang
9a1f14ad72
CryptoPkg/BaseCryptLib: remove HmacXxxGetContextSize interface
...
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1792
Hmac(Md5|Sha1|Sha256)GetContextSize() use a deprecated macro
HMAC_MAX_MD_CBLOCK defined in openssl. They should be dropped to
avoid misuses in the future. For context allocation and release,
use HmacXxxNew() and HmacXxxFree() instead.
Cc: Xiaoyu Lu <xiaoyux.lu@intel.com >
Cc: Laszlo Ersek <lersek@redhat.com >
Signed-off-by: Jian J Wang <jian.j.wang@intel.com >
Reviewed-by: Laszlo Ersek <lersek@redhat.com >
Reviewed-by: Xiaoyu Lu <xiaoyux.lu@intel.com >
2020-01-20 16:41:23 +00:00
Jian J Wang
a23fdff6fb
CryptoPkg/BaseCryptLib: replace HmacXxxInit API with HmacXxxSetKey
...
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1792
HmacXxxInit() is supposed to be initialize user supplied buffer as HMAC
context, as well as user supplied key. Currently it has no real use cases.
Due to BZ1792, the user has no way to get correct size of context buffer
after it's fixed, and then cannot make use of HmacXxxInit to initialize
it.
So it's decided to replace it with HmacXxxSetKey to keep the functionality
of supplying a key to HMAC, but drop all other initialization works. The
user can still get HMAC context via HmacXxxNew interface, which hides the
details about the context.
Cc: Xiaoyu Lu <xiaoyux.lu@intel.com >
Cc: Laszlo Ersek <lersek@redhat.com >
Signed-off-by: Jian J Wang <jian.j.wang@intel.com >
Reviewed-by: Laszlo Ersek <lersek@redhat.com >
Reviewed-by: Xiaoyu Lu <xiaoyux.lu@intel.com >
2020-01-20 16:41:23 +00:00
Pavana.K
c9d7262843
CryptoPkg: Support for SHA384 & SHA512 RSA signing schemes
...
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=2389
Currently RSA signing scheme support is available for MD5, SHA-1 or
SHA-256 algorithms.The fix is to extend this support for SHA384 and
SHA512.
Cc: Liming Gao <liming.gao@intel.com >
Cc: Jian J Wang <jian.j.wang@intel.com >
Cc: Bob Feng <bob.c.feng@intel.com >
Signed-off-by: Pavana.K <pavana.k@intel.com >
Reviewed-by: Jian J Wang <jian.j.wang@intel.com >
2020-01-08 06:57:44 +00:00
Liming Gao
8ecd8c49e4
CryptoPkg CryptoLib: Update tool chain name to CLANGPDB
...
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=2341
Signed-off-by: Liming Gao <liming.gao@intel.com >
Cc: Jian J Wang <jian.j.wang@intel.com >
Reviewed-by: Jian J Wang <jian.j.wang@intel.com >
2019-11-15 06:04:21 +00:00
Laszlo Ersek
8d16ef8269
CryptoPkg/Crt: import "inet_pton.c" (CVE-2019-14553)
...
For TianoCore BZ#1734, StdLib has been moved from the edk2 project to the
edk2-libc project, in commit 964f432b9b
("edk2: Remove AppPkg, StdLib,
StdLibPrivateInternalFiles", 2019-04-29).
We'd like to use the inet_pton() function in CryptoPkg. Resurrect the
"inet_pton.c" file from just before the StdLib removal, as follows:
$ git show \
964f432b9b0a^:StdLib/BsdSocketLib/inet_pton.c \
> CryptoPkg/Library/BaseCryptLib/SysCall/inet_pton.c
The inet_pton() function is only intended for the DXE phase at this time,
therefore only the "BaseCryptLib" instance INF file receives the new file.
Cc: David Woodhouse <dwmw2@infradead.org >
Cc: Jian J Wang <jian.j.wang@intel.com >
Cc: Jiaxin Wu <jiaxin.wu@intel.com >
Cc: Sivaraman Nainar <sivaramann@amiindia.co.in >
Cc: Xiaoyu Lu <xiaoyux.lu@intel.com >
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=960
CVE: CVE-2019-14553
Signed-off-by: Laszlo Ersek <lersek@redhat.com >
Reviewed-by: Jian J Wang <jian.j.wang@intel.com >
Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com >
2019-11-02 12:07:59 +01:00
Laszlo Ersek
eb520d94db
CryptoPkg/Crt: turn strchr() into a function (CVE-2019-14553)
...
According to the ISO C standard, strchr() is a function. We #define it as
a macro. Unfortunately, our macro evaluates the first argument ("str")
twice. If the expression passed for "str" has side effects, the behavior
may be undefined.
In a later patch in this series, we're going to resurrect "inet_pton.c"
(originally from the StdLib package), which calls strchr() just like that:
strchr((xdigits = xdigits_l), ch)
strchr((xdigits = xdigits_u), ch)
To enable this kind of function call, turn strchr() into a function.
Cc: David Woodhouse <dwmw2@infradead.org >
Cc: Jian J Wang <jian.j.wang@intel.com >
Cc: Jiaxin Wu <jiaxin.wu@intel.com >
Cc: Sivaraman Nainar <sivaramann@amiindia.co.in >
Cc: Xiaoyu Lu <xiaoyux.lu@intel.com >
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=960
CVE: CVE-2019-14553
Signed-off-by: Laszlo Ersek <lersek@redhat.com >
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com >
Reviewed-by: Jian J Wang <jian.j.wang@intel.com >
Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com >
2019-11-02 12:07:25 +01:00
Liming Gao
3d61650f95
CryptoPkg: Append options to make CLANG9 tool chain pass build
...
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1603
Disable warning reported from CLANG9.
Signed-off-by: Liming Gao <liming.gao@intel.com >
Reviewed-by: Jian J Wang <jian.j.wang@intel.com >
2019-10-24 09:41:33 +08:00
Shenglei Zhang
944bd5cf1d
CryptoPkg: Fix coding style
...
Update attribute "Out" to "out".
The original "Out" can not pass ECC check.
Cc: Jian Wang <jian.j.wang@intel.com >
Cc: Ting Ye <ting.ye@intel.com >
Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com >
Reviewed-by: Jian J Wang <jian.j.wang@intel.com >
2019-08-19 08:45:29 +08:00