Branch: refs/heads/security-advisory/cve-2024-38797/advisory
  Home:   https://github.com/tianocore/edk2
  Commit: 76a51eb7617fead1f99980234d566edeb2a2f309
      
https://github.com/tianocore/edk2/commit/76a51eb7617fead1f99980234d566edeb2a2f309
  Author: Doug Flick <dougfl...@microsoft.com>
  Date:   2025-04-07 (Mon, 07 Apr 2025)

  Changed paths:
    M SecurityPkg/Library/DxeImageVerificationLib/DxeImageVerificationLib.c

  Log Message:
  -----------
  SecurityPkg: Improving HashPeImageByType () logic

Namely:

(1) The TWO_BYTE_ENCODE check is independent of Index. If it evalutes
    to TRUE for Index==0, then it will evaluate to TRUE for all other
    Index values as well. As a result, the (Index == HASHALG_MAX)
    condition will fire after the loop, and we'll return
    EFI_UNSUPPORTED.

    While this is correct, functionally speaking, it is wasteful to
    keep re-checking TWO_BYTE_ENCODE in the loop body. The check
    should be made at the top of the function, and EFI_UNSUPPORTED
    should be returned at once, if appropriate.

(2) If the hash algorithm selected by Index has such a large OID that
    the OID comparison cannot even be performed (because AuthDataSize
    is not large enough for containing the OID in question, starting
    at offset 32), then the function returns EFI_UNSUPPORTED at once.

    This is bogus; this case should simply be treated as an OID
    mismatch, and the loop should advance to the next Index value /
    hash algorithm candidate. A remaining hash algo may have a shorter
    OID and yield an OID match.

Signed-off-by: Doug Flick <dougfl...@microsoft.com>


  Commit: d796ba548f8b22db44e1fa7a6d1908324e265e14
      
https://github.com/tianocore/edk2/commit/d796ba548f8b22db44e1fa7a6d1908324e265e14
  Author: Doug Flick <dougfl...@microsoft.com>
  Date:   2025-04-07 (Mon, 07 Apr 2025)

  Changed paths:
    M 
SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigImpl.c

  Log Message:
  -----------
  SecurityPkg: Improving SecureBootConfigImpl:HashPeImageByType () logic

Namely:

(1) The TWO_BYTE_ENCODE check is independent of Index. If it evalutes
    to TRUE for Index==0, then it will evaluate to TRUE for all other
    Index values as well. As a result, the (Index == HASHALG_MAX)
    condition will fire after the loop, and we'll return
    EFI_UNSUPPORTED.

    While this is correct, functionally speaking, it is wasteful to
    keep re-checking TWO_BYTE_ENCODE in the loop body. The check
    should be made at the top of the function, and EFI_UNSUPPORTED
    should be returned at once, if appropriate.

(2) If the hash algorithm selected by Index has such a large OID that
    the OID comparison cannot even be performed (because AuthDataSize
    is not large enough for containing the OID in question, starting
    at offset 32), then the function returns EFI_UNSUPPORTED at once.

    This is bogus; this case should simply be treated as an OID
    mismatch, and the loop should advance to the next Index value /
    hash algorithm candidate. A remaining hash algo may have a shorter
    OID and yield an OID match.

Signed-off-by: Doug Flick <dougfl...@microsoft.com>


Compare: https://github.com/tianocore/edk2/compare/3bac0b1c9167...d796ba548f8b

To unsubscribe from these emails, change your notification settings at 
https://github.com/tianocore/edk2/settings/notifications


_______________________________________________
edk2-commits mailing list
edk2-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to