Skip to content

Commit

Permalink
CryptoPkg: Require exact crypto version match (#1157)
Browse files Browse the repository at this point in the history
## Description

Crypto versioning is not currently backwards compatible. This change
updates the check to require an exact match of the crypto version.

- [ ] Impacts functionality?
- [ ] Impacts security?
- [ ] Breaking change?
- [ ] Includes tests?
- [ ] Includes documentation?

## How This Was Tested

N/A

## Integration Instructions

N/A
  • Loading branch information
Javagedes committed Sep 24, 2024
1 parent f254700 commit 63e9999
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions CryptoPkg/Library/BaseCryptLibOnProtocolPpi/DxeCryptLib.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ DxeCryptLibConstructor (
}

Version = mCryptoProtocol->GetVersion ();
if (Version < EDKII_CRYPTO_VERSION) {
if (Version != EDKII_CRYPTO_VERSION) {
DEBUG ((DEBUG_ERROR, "[DxeCryptLib] Crypto Protocol unsupported version %d\n", Version));
ASSERT (Version >= EDKII_CRYPTO_VERSION);
ASSERT (Version == EDKII_CRYPTO_VERSION);
mCryptoProtocol = NULL;
return EFI_NOT_FOUND;
}
Expand Down
4 changes: 2 additions & 2 deletions CryptoPkg/Library/BaseCryptLibOnProtocolPpi/PeiCryptLib.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ GetCryptoServices (
}

Version = CryptoPpi->GetVersion ();
if (Version < EDKII_CRYPTO_VERSION) {
if (Version != EDKII_CRYPTO_VERSION) {
DEBUG ((DEBUG_ERROR, "[PeiCryptLib] Crypto PPI unsupported version %d\n", Version));
ASSERT (Version >= EDKII_CRYPTO_VERSION);
ASSERT (Version == EDKII_CRYPTO_VERSION);
return NULL;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,9 @@ RuntimeDxeCryptLibConstructor (
}

Version = mCryptoProtocol->GetVersion ();
if (Version < EDKII_CRYPTO_VERSION) {
if (Version != EDKII_CRYPTO_VERSION) {
DEBUG ((DEBUG_ERROR, "[%a] Crypto Protocol unsupported version %u.\n", __func__, Version));
ASSERT (Version >= EDKII_CRYPTO_VERSION);
ASSERT (Version == EDKII_CRYPTO_VERSION);
mCryptoProtocol = NULL;
return EFI_NOT_FOUND;
}
Expand Down
4 changes: 2 additions & 2 deletions CryptoPkg/Library/BaseCryptLibOnProtocolPpi/SmmCryptLib.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ SmmCryptLibConstructor (
}

Version = mSmmCryptoProtocol->GetVersion ();
if (Version < EDKII_CRYPTO_VERSION) {
if (Version != EDKII_CRYPTO_VERSION) {
DEBUG ((DEBUG_ERROR, "[SmmCryptLib] Crypto SMM Protocol unsupported version %d\n", Version));
ASSERT (Version >= EDKII_CRYPTO_VERSION);
ASSERT (Version == EDKII_CRYPTO_VERSION);
mSmmCryptoProtocol = NULL;
return EFI_NOT_FOUND;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ StandaloneMmCryptLibConstructor (
}

Version = mSmmCryptoProtocol->GetVersion ();
if (Version < EDKII_CRYPTO_VERSION) {
if (Version != EDKII_CRYPTO_VERSION) {
DEBUG ((DEBUG_ERROR, "[StandaloneMmCryptLib] Crypto SMM Protocol unsupported version %d\n", Version));
ASSERT (Version >= EDKII_CRYPTO_VERSION);
ASSERT (Version == EDKII_CRYPTO_VERSION);
mSmmCryptoProtocol = NULL;
return EFI_NOT_FOUND;
}
Expand Down

0 comments on commit 63e9999

Please sign in to comment.