X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=SecurityPkg%2FHash2DxeCrypto%2FHash2DxeCrypto.c;h=94057ab2e1fc7489ea344fbce509883b8db65352;hb=099bff5def30b277157b2387d5d910e2ad14f84e;hp=dab02992362ed0c66caebfc769af69f89694317e;hpb=13a220a998a9d504cdeb7a858cc083f6879ec26e;p=mirror_edk2.git diff --git a/SecurityPkg/Hash2DxeCrypto/Hash2DxeCrypto.c b/SecurityPkg/Hash2DxeCrypto/Hash2DxeCrypto.c index dab0299236..94057ab2e1 100644 --- a/SecurityPkg/Hash2DxeCrypto/Hash2DxeCrypto.c +++ b/SecurityPkg/Hash2DxeCrypto/Hash2DxeCrypto.c @@ -358,6 +358,7 @@ BaseCrypto2Hash ( UINTN CtxSize; BOOLEAN Ret; EFI_STATUS Status; + HASH2_INSTANCE_DATA *Instance; Status = EFI_SUCCESS; @@ -373,6 +374,13 @@ BaseCrypto2Hash ( if (HashInfo == NULL) { return EFI_UNSUPPORTED; } + + Instance = HASH2_INSTANCE_DATA_FROM_THIS(This); + if (Instance->HashContext != NULL) { + FreePool (Instance->HashContext); + } + Instance->HashInfoContext = NULL; + Instance->HashContext = NULL; // // Start hash sequence @@ -392,6 +400,12 @@ BaseCrypto2Hash ( goto Done; } + // + // Setup the context + // + Instance->HashContext = HashCtx; + Instance->HashInfoContext = HashInfo; + Ret = HashInfo->Update (HashCtx, Message, MessageSize); if (!Ret) { Status = EFI_OUT_OF_RESOURCES; @@ -404,7 +418,12 @@ BaseCrypto2Hash ( goto Done; } Done: + // + // Cleanup the context + // FreePool (HashCtx); + Instance->HashInfoContext = NULL; + Instance->HashContext = NULL; return Status; }