summaryrefslogtreecommitdiff
path: root/CryptoPkg
diff options
context:
space:
mode:
authorWenxing Hou <wenxing.hou@intel.com>2024-06-04 14:52:18 +0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2024-06-06 14:49:44 +0000
commit71606314f80500ff0849f66553fad0da11bf4beb (patch)
tree4d12963ed3ffaa5d2879c127eb20668d62b15bf4 /CryptoPkg
parent90cb1ec33225a070e9fea1d94c72ff590bd38731 (diff)
downloadedk2-71606314f80500ff0849f66553fad0da11bf4beb.zip
edk2-71606314f80500ff0849f66553fad0da11bf4beb.tar.gz
edk2-71606314f80500ff0849f66553fad0da11bf4beb.tar.bz2
CryptoPkg: Fix wrong logic in X509GetTBSCert
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4509 Both return 0x80 value and Asn1Tag != V_ASN1_SEQUENCE are wrong return. Signed-off-by: Wenxing Hou <wenxing.hou@intel.com>
Diffstat (limited to 'CryptoPkg')
-rw-r--r--CryptoPkg/Library/BaseCryptLib/Pk/CryptX509.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/CryptoPkg/Library/BaseCryptLib/Pk/CryptX509.c b/CryptoPkg/Library/BaseCryptLib/Pk/CryptX509.c
index 7ebec9d..021cc32 100644
--- a/CryptoPkg/Library/BaseCryptLib/Pk/CryptX509.c
+++ b/CryptoPkg/Library/BaseCryptLib/Pk/CryptX509.c
@@ -839,7 +839,7 @@ X509GetTBSCert (
Length = 0;
Inf = ASN1_get_object (&Temp, (long *)&Length, (int *)&Asn1Tag, (int *)&ObjClass, (long)CertSize);
- if (((Inf & 0x80) == 0x80) && (Asn1Tag != V_ASN1_SEQUENCE)) {
+ if (((Inf & 0x80) == 0x80) || (Asn1Tag != V_ASN1_SEQUENCE)) {
return FALSE;
}
@@ -849,7 +849,7 @@ X509GetTBSCert (
//
// Verify the parsed TBSCertificate is one correct SEQUENCE data.
//
- if (((Inf & 0x80) == 0x80) && (Asn1Tag != V_ASN1_SEQUENCE)) {
+ if (((Inf & 0x80) == 0x80) || (Asn1Tag != V_ASN1_SEQUENCE)) {
return FALSE;
}