79 IN OUT VOID *HashContext,
109 IN OUT VOID *HashContext,
270 for (Index = 0; Index <
sizeof (mHashInfo)/
sizeof (mHashInfo[0]); Index++) {
271 if (
CompareGuid (HashAlgorithm, mHashInfo[Index].Guid)) {
272 return &mHashInfo[Index];
302 if ((This ==
NULL) || (HashSize ==
NULL)) {
303 return EFI_INVALID_PARAMETER;
306 if (HashAlgorithm ==
NULL) {
307 return EFI_UNSUPPORTED;
311 if (HashInfo ==
NULL) {
312 return EFI_UNSUPPORTED;
315 *HashSize = HashInfo->HashSize;
358 if ((This ==
NULL) || (Hash ==
NULL)) {
359 return EFI_INVALID_PARAMETER;
362 if (HashAlgorithm ==
NULL) {
363 return EFI_UNSUPPORTED;
367 if (HashInfo ==
NULL) {
368 return EFI_UNSUPPORTED;
371 Instance = HASH2_INSTANCE_DATA_FROM_THIS (This);
372 if (Instance->HashContext !=
NULL) {
376 Instance->HashInfoContext =
NULL;
377 Instance->HashContext =
NULL;
382 CtxSize = HashInfo->GetContextSize ();
384 return EFI_UNSUPPORTED;
388 if (HashCtx ==
NULL) {
389 return EFI_OUT_OF_RESOURCES;
392 Ret = HashInfo->Init (HashCtx);
394 Status = EFI_OUT_OF_RESOURCES;
401 Instance->HashContext = HashCtx;
402 Instance->HashInfoContext = HashInfo;
404 Ret = HashInfo->Update (HashCtx, Message, MessageSize);
406 Status = EFI_OUT_OF_RESOURCES;
410 Ret = HashInfo->Final (HashCtx, (UINT8 *)Hash->Sha1Hash);
412 Status = EFI_OUT_OF_RESOURCES;
421 Instance->HashInfoContext =
NULL;
422 Instance->HashContext =
NULL;
456 return EFI_INVALID_PARAMETER;
459 if (HashAlgorithm ==
NULL) {
460 return EFI_UNSUPPORTED;
464 if (HashInfo ==
NULL) {
465 return EFI_UNSUPPORTED;
471 Instance = HASH2_INSTANCE_DATA_FROM_THIS (This);
472 if ((Instance->HashContext !=
NULL) || (Instance->HashInfoContext !=
NULL)) {
473 return EFI_ALREADY_STARTED;
479 CtxSize = HashInfo->GetContextSize ();
481 return EFI_UNSUPPORTED;
485 if (HashCtx ==
NULL) {
486 return EFI_OUT_OF_RESOURCES;
489 Ret = HashInfo->Init (HashCtx);
492 return EFI_OUT_OF_RESOURCES;
498 Instance->HashContext = HashCtx;
499 Instance->HashInfoContext = HashInfo;
500 Instance->Updated =
FALSE;
534 return EFI_INVALID_PARAMETER;
540 Instance = HASH2_INSTANCE_DATA_FROM_THIS (This);
541 if ((Instance->HashContext ==
NULL) || (Instance->HashInfoContext ==
NULL)) {
542 return EFI_NOT_READY;
545 HashInfo = Instance->HashInfoContext;
546 HashCtx = Instance->HashContext;
548 Ret = HashInfo->Update (HashCtx, Message, MessageSize);
550 return EFI_OUT_OF_RESOURCES;
553 Instance->Updated =
TRUE;
586 if ((This ==
NULL) || (Hash ==
NULL)) {
587 return EFI_INVALID_PARAMETER;
593 Instance = HASH2_INSTANCE_DATA_FROM_THIS (This);
594 if ((Instance->HashContext ==
NULL) || (Instance->HashInfoContext ==
NULL) ||
595 (!Instance->Updated))
597 return EFI_NOT_READY;
600 HashInfo = Instance->HashInfoContext;
601 HashCtx = Instance->HashContext;
603 Ret = HashInfo->Final (HashCtx, (UINT8 *)Hash->Sha1Hash);
609 Instance->HashInfoContext =
NULL;
610 Instance->HashContext =
NULL;
611 Instance->Updated =
FALSE;
614 return EFI_OUT_OF_RESOURCES;
UINTN EFIAPI Sha256GetContextSize(VOID)
UINTN EFIAPI Sha384GetContextSize(VOID)
BOOLEAN EFIAPI Sha512Final(IN OUT VOID *Sha512Context, OUT UINT8 *HashValue)
UINTN EFIAPI Sha512GetContextSize(VOID)
BOOLEAN EFIAPI Sha512Init(OUT VOID *Sha512Context)
BOOLEAN EFIAPI Sha256Init(OUT VOID *Sha256Context)
BOOLEAN EFIAPI Sha256Final(IN OUT VOID *Sha256Context, OUT UINT8 *HashValue)
BOOLEAN EFIAPI Sha384Update(IN OUT VOID *Sha384Context, IN CONST VOID *Data, IN UINTN DataSize)
BOOLEAN EFIAPI Sha256Update(IN OUT VOID *Sha256Context, IN CONST VOID *Data, IN UINTN DataSize)
BOOLEAN EFIAPI Sha384Final(IN OUT VOID *Sha384Context, OUT UINT8 *HashValue)
BOOLEAN EFIAPI Sha384Init(OUT VOID *Sha384Context)
BOOLEAN EFIAPI Sha512Update(IN OUT VOID *Sha512Context, IN CONST VOID *Data, IN UINTN DataSize)
BOOLEAN EFIAPI CompareGuid(IN CONST GUID *Guid1, IN CONST GUID *Guid2)
VOID EFIAPI FreePool(IN VOID *Buffer)
EFI_STATUS EFIAPI BaseCrypto2HashInit(IN CONST EFI_HASH2_PROTOCOL *This, IN CONST EFI_GUID *HashAlgorithm)
EFI_STATUS EFIAPI BaseCrypto2Hash(IN CONST EFI_HASH2_PROTOCOL *This, IN CONST EFI_GUID *HashAlgorithm, IN CONST UINT8 *Message, IN UINTN MessageSize, IN OUT EFI_HASH2_OUTPUT *Hash)
UINTN(EFIAPI * EFI_HASH_GET_CONTEXT_SIZE)(VOID)
EFI_STATUS EFIAPI BaseCrypto2GetHashSize(IN CONST EFI_HASH2_PROTOCOL *This, IN CONST EFI_GUID *HashAlgorithm, OUT UINTN *HashSize)
BOOLEAN(EFIAPI * EFI_HASH_UPDATE)(IN OUT VOID *HashContext, IN CONST VOID *Data, IN UINTN DataSize)
BOOLEAN(EFIAPI * EFI_HASH_INIT)(OUT VOID *HashContext)
EFI_HASH_INFO * GetHashInfo(IN CONST EFI_GUID *HashAlgorithm)
EFI_STATUS EFIAPI BaseCrypto2HashUpdate(IN CONST EFI_HASH2_PROTOCOL *This, IN CONST UINT8 *Message, IN UINTN MessageSize)
EFI_STATUS EFIAPI BaseCrypto2HashFinal(IN CONST EFI_HASH2_PROTOCOL *This, IN OUT EFI_HASH2_OUTPUT *Hash)
BOOLEAN(EFIAPI * EFI_HASH_FINAL)(IN OUT VOID *HashContext, OUT UINT8 *HashValue)
VOID *EFIAPI AllocatePool(IN UINTN AllocationSize)