diff --git a/CryptoPkg/Driver/Crypto.c b/CryptoPkg/Driver/Crypto.c index d11de00bce..201ed8cbbf 100644 --- a/CryptoPkg/Driver/Crypto.c +++ b/CryptoPkg/Driver/Crypto.c @@ -3220,11 +3220,11 @@ CryptoServiceX509GetSignatureAlgorithm ( @param[in, out] ExtensionDataSize Extension bytes size. @retval TRUE The certificate Extension data retrieved successfully. + @retval TRUE The Certificate Extension is found, but the oid extension is not found. @retval FALSE If Cert is NULL. If ExtensionDataSize is NULL. If ExtensionData is not NULL and *ExtensionDataSize is 0. If Certificate is invalid. - @retval FALSE If no Extension entry match Oid. @retval FALSE If the ExtensionData is NULL. The required buffer size is returned in the ExtensionDataSize parameter. @retval FALSE The operation is not supported. diff --git a/CryptoPkg/Include/Library/BaseCryptLib.h b/CryptoPkg/Include/Library/BaseCryptLib.h index 84ed87e05a..919ee70924 100644 --- a/CryptoPkg/Include/Library/BaseCryptLib.h +++ b/CryptoPkg/Include/Library/BaseCryptLib.h @@ -2713,11 +2713,11 @@ X509GetSignatureAlgorithm ( @param[in, out] ExtensionDataSize Extension bytes size. @retval TRUE The certificate Extension data retrieved successfully. + @retval TRUE The Certificate Extension is found, but the oid extension is not found. @retval FALSE If Cert is NULL. If ExtensionDataSize is NULL. If ExtensionData is not NULL and *ExtensionDataSize is 0. If Certificate is invalid. - @retval FALSE If no Extension entry match Oid. @retval FALSE If the ExtensionData is NULL. The required buffer size is returned in the ExtensionDataSize parameter. @retval FALSE The operation is not supported. diff --git a/CryptoPkg/Library/BaseCryptLib/Pk/CryptX509.c b/CryptoPkg/Library/BaseCryptLib/Pk/CryptX509.c index 022e81d64e..25b7882a4b 100644 --- a/CryptoPkg/Library/BaseCryptLib/Pk/CryptX509.c +++ b/CryptoPkg/Library/BaseCryptLib/Pk/CryptX509.c @@ -1270,11 +1270,11 @@ _Exit: @param[in, out] ExtensionDataSize Extension bytes size. @retval TRUE The certificate Extension data retrieved successfully. + @retval TRUE The Certificate Extension is found, but the oid extension is not found. @retval FALSE If Cert is NULL. If ExtensionDataSize is NULL. If ExtensionData is not NULL and *ExtensionDataSize is 0. If Certificate is invalid. - @retval FALSE If no Extension entry match Oid. @retval FALSE If the ExtensionData is NULL. The required buffer size is returned in the ExtensionDataSize parameter. @retval FALSE The operation is not supported. @@ -1380,6 +1380,8 @@ X509GetExtensionData ( *ExtensionDataSize = OctLength; } else { + /* the cert extension is found, but the oid extension is not found; */ + Status = TRUE; *ExtensionDataSize = 0; } diff --git a/CryptoPkg/Library/BaseCryptLib/Pk/CryptX509Null.c b/CryptoPkg/Library/BaseCryptLib/Pk/CryptX509Null.c index 7217501948..ae878aad22 100644 --- a/CryptoPkg/Library/BaseCryptLib/Pk/CryptX509Null.c +++ b/CryptoPkg/Library/BaseCryptLib/Pk/CryptX509Null.c @@ -459,11 +459,11 @@ X509GetSignatureAlgorithm ( @param[in, out] ExtensionDataSize Extension bytes size. @retval TRUE The certificate Extension data retrieved successfully. + @retval TRUE The Certificate Extension is found, but the oid extension is not found. @retval FALSE If Cert is NULL. If ExtensionDataSize is NULL. If ExtensionData is not NULL and *ExtensionDataSize is 0. If Certificate is invalid. - @retval FALSE If no Extension entry match Oid. @retval FALSE If the ExtensionData is NULL. The required buffer size is returned in the ExtensionDataSize parameter. @retval FALSE The operation is not supported. diff --git a/CryptoPkg/Library/BaseCryptLibMbedTls/Pk/CryptX509.c b/CryptoPkg/Library/BaseCryptLibMbedTls/Pk/CryptX509.c index f0727135ad..5a9c87d448 100644 --- a/CryptoPkg/Library/BaseCryptLibMbedTls/Pk/CryptX509.c +++ b/CryptoPkg/Library/BaseCryptLibMbedTls/Pk/CryptX509.c @@ -1388,11 +1388,11 @@ InternalX509FindExtensionData ( @param[in, out] ExtensionDataSize Extension bytes size. @retval TRUE The certificate Extension data retrieved successfully. + @retval TRUE The Certificate Extension is found, but the oid extension is not found. @retval FALSE If Cert is NULL. If ExtensionDataSize is NULL. If ExtensionData is not NULL and *ExtensionDataSize is 0. If Certificate is invalid. - @retval FALSE If no Extension entry match Oid. @retval FALSE If the ExtensionData is NULL. The required buffer size is returned in the ExtensionDataSize parameter. @retval FALSE The operation is not supported. @@ -1422,6 +1422,10 @@ X509GetExtensionData ( (OidSize == 0) || (ExtensionDataSize == NULL)) { + if (ExtensionDataSize != NULL) { + *ExtensionDataSize = 0; + } + return FALSE; } @@ -1440,6 +1444,11 @@ X509GetExtensionData ( if (Ret == 0) { ReturnStatus = InternalX509FindExtensionData (Ptr, End, Oid, OidSize, &Ptr, &ObjLen); + if (!Status) { + Status = TRUE; + *ExtensionDataSize = 0; + goto Cleanup; + } } if (ReturnStatus == RETURN_SUCCESS) { diff --git a/CryptoPkg/Library/BaseCryptLibMbedTls/Pk/CryptX509Null.c b/CryptoPkg/Library/BaseCryptLibMbedTls/Pk/CryptX509Null.c index b927a6a755..3cf9816854 100644 --- a/CryptoPkg/Library/BaseCryptLibMbedTls/Pk/CryptX509Null.c +++ b/CryptoPkg/Library/BaseCryptLibMbedTls/Pk/CryptX509Null.c @@ -459,11 +459,11 @@ X509GetSignatureAlgorithm ( @param[in, out] ExtensionDataSize Extension bytes size. @retval TRUE The certificate Extension data retrieved successfully. + @retval TRUE The Certificate Extension is found, but the oid extension is not found. @retval FALSE If Cert is NULL. If ExtensionDataSize is NULL. If ExtensionData is not NULL and *ExtensionDataSize is 0. If Certificate is invalid. - @retval FALSE If no Extension entry match Oid. @retval FALSE If the ExtensionData is NULL. The required buffer size is returned in the ExtensionDataSize parameter. @retval FALSE The operation is not supported. diff --git a/CryptoPkg/Library/BaseCryptLibNull/Pk/CryptX509Null.c b/CryptoPkg/Library/BaseCryptLibNull/Pk/CryptX509Null.c index 5fb564ca67..128fcf1241 100644 --- a/CryptoPkg/Library/BaseCryptLibNull/Pk/CryptX509Null.c +++ b/CryptoPkg/Library/BaseCryptLibNull/Pk/CryptX509Null.c @@ -459,11 +459,11 @@ X509GetSignatureAlgorithm ( @param[in, out] ExtensionDataSize Extension bytes size. @retval TRUE The certificate Extension data retrieved successfully. + @retval TRUE The Certificate Extension is found, but the oid extension is not found. @retval FALSE If Cert is NULL. If ExtensionDataSize is NULL. If ExtensionData is not NULL and *ExtensionDataSize is 0. If Certificate is invalid. - @retval FALSE If no Extension entry match Oid. @retval FALSE If the ExtensionData is NULL. The required buffer size is returned in the ExtensionDataSize parameter. @retval FALSE The operation is not supported. diff --git a/CryptoPkg/Library/BaseCryptLibOnProtocolPpi/CryptLib.c b/CryptoPkg/Library/BaseCryptLibOnProtocolPpi/CryptLib.c index c48291b972..e51f178d9f 100644 --- a/CryptoPkg/Library/BaseCryptLibOnProtocolPpi/CryptLib.c +++ b/CryptoPkg/Library/BaseCryptLibOnProtocolPpi/CryptLib.c @@ -2456,11 +2456,11 @@ X509GetSignatureAlgorithm ( @param[in, out] ExtensionDataSize Extension bytes size. @retval TRUE The certificate Extension data retrieved successfully. + @retval TRUE The Certificate Extension is found, but the oid extension is not found. @retval FALSE If Cert is NULL. If ExtensionDataSize is NULL. If ExtensionData is not NULL and *ExtensionDataSize is 0. If Certificate is invalid. - @retval FALSE If no Extension entry match Oid. @retval FALSE If the ExtensionData is NULL. The required buffer size is returned in the ExtensionDataSize parameter. @retval FALSE The operation is not supported. diff --git a/CryptoPkg/Private/Protocol/Crypto.h b/CryptoPkg/Private/Protocol/Crypto.h index 5a471631f1..4d91fb795e 100644 --- a/CryptoPkg/Private/Protocol/Crypto.h +++ b/CryptoPkg/Private/Protocol/Crypto.h @@ -2577,11 +2577,11 @@ BOOLEAN @param[in, out] ExtensionDataSize Extension bytes size. @retval TRUE The certificate Extension data retrieved successfully. + @retval TRUE The Certificate Extension is found, but the oid extension is not found. @retval FALSE If Cert is NULL. If ExtensionDataSize is NULL. If ExtensionData is not NULL and *ExtensionDataSize is 0. If Certificate is invalid. - @retval FALSE If no Extension entry match Oid. @retval FALSE If the ExtensionData is NULL. The required buffer size is returned in the ExtensionDataSize parameter. @retval FALSE The operation is not supported. diff --git a/Maintainers.txt b/Maintainers.txt index 8e6a1636a4..4430ec48d2 100644 --- a/Maintainers.txt +++ b/Maintainers.txt @@ -175,7 +175,6 @@ W: https://github.com/tianocore/tianocore.github.io/wiki/BaseTools M: Rebecca Cran [bexcran] M: Liming Gao [lgao4] M: Guillermo Antonio Palomino Sosa [gapalomi] -R: Bob Feng [BobCF] R: Yuwei Chen [YuweiChen1110] BaseTools: Plugins diff --git a/NetworkPkg/Ip6Dxe/Ip6Icmp.c b/NetworkPkg/Ip6Dxe/Ip6Icmp.c index a0e4d25db7..18a24e30da 100644 --- a/NetworkPkg/Ip6Dxe/Ip6Icmp.c +++ b/NetworkPkg/Ip6Dxe/Ip6Icmp.c @@ -467,14 +467,14 @@ Ip6GetPrefix ( UINT8 Mask; UINT8 Value; - ASSERT ((Prefix != NULL) && (PrefixLength < IP6_PREFIX_MAX)); + ASSERT ((Prefix != NULL) && (PrefixLength <= IP6_PREFIX_MAX)); if (PrefixLength == 0) { ZeroMem (Prefix, sizeof (EFI_IPv6_ADDRESS)); return; } - if (PrefixLength >= IP6_PREFIX_MAX) { + if (PrefixLength > IP6_PREFIX_MAX) { return; } diff --git a/NetworkPkg/Library/DxeNetLib/DxeNetLib.c b/NetworkPkg/Library/DxeNetLib/DxeNetLib.c index eef3386ebb..3495b42db8 100644 --- a/NetworkPkg/Library/DxeNetLib/DxeNetLib.c +++ b/NetworkPkg/Library/DxeNetLib/DxeNetLib.c @@ -844,7 +844,7 @@ NetIp6IsNetEqual ( UINT8 Bit; UINT8 Mask; - ASSERT ((Ip1 != NULL) && (Ip2 != NULL) && (PrefixLength < IP6_PREFIX_MAX)); + ASSERT ((Ip1 != NULL) && (Ip2 != NULL) && (PrefixLength <= IP6_PREFIX_MAX)); if (PrefixLength == 0) { return TRUE;