2008-04-17 10:28:51 +02:00
|
|
|
/** @file
|
2008-12-10 07:21:28 +01:00
|
|
|
Header file for Md5.
|
2007-12-24 03:20:21 +01:00
|
|
|
|
2008-12-10 07:21:28 +01:00
|
|
|
Copyright (c) 2004 - 2008, Intel Corporation.<BR>
|
2008-01-22 09:07:35 +01:00
|
|
|
All rights reserved. This program and the accompanying materials
|
|
|
|
are licensed and made available under the terms and conditions of the BSD License
|
|
|
|
which accompanies this distribution. The full text of the license may be found at
|
|
|
|
http://opensource.org/licenses/bsd-license.php
|
|
|
|
|
|
|
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
2007-12-24 03:20:21 +01:00
|
|
|
|
2008-04-17 10:28:51 +02:00
|
|
|
**/
|
2007-12-24 03:20:21 +01:00
|
|
|
|
|
|
|
#ifndef _MD5_H_
|
|
|
|
#define _MD5_H_
|
|
|
|
|
2008-12-10 07:21:28 +01:00
|
|
|
#include <Uefi.h>
|
2007-12-24 03:20:21 +01:00
|
|
|
#include <Library/BaseLib.h>
|
|
|
|
#include <Library/NetLib.h>
|
2008-12-10 07:21:28 +01:00
|
|
|
|
2007-12-24 03:20:21 +01:00
|
|
|
#define MD5_HASHSIZE 16
|
|
|
|
|
|
|
|
typedef struct _MD5_CTX {
|
|
|
|
EFI_STATUS Status;
|
|
|
|
UINT64 Length;
|
|
|
|
UINT32 States[MD5_HASHSIZE / sizeof (UINT32)];
|
|
|
|
UINT8 M[64];
|
|
|
|
UINTN Count;
|
|
|
|
} MD5_CTX;
|
|
|
|
|
2008-04-17 10:28:51 +02:00
|
|
|
/**
|
|
|
|
Initialize four 32-bits chaining variables and use them to do the Md5 transform.
|
|
|
|
|
2008-12-10 07:21:28 +01:00
|
|
|
@param[in] Md5Ctx The data structure of Md5.
|
2008-04-17 10:28:51 +02:00
|
|
|
|
2008-12-10 07:21:28 +01:00
|
|
|
@retval EFI_SUCCESS Initialization is ok.
|
2008-04-17 10:28:51 +02:00
|
|
|
**/
|
2007-12-24 03:20:21 +01:00
|
|
|
EFI_STATUS
|
|
|
|
MD5Init (
|
|
|
|
IN MD5_CTX *Md5Ctx
|
2008-09-04 11:37:28 +02:00
|
|
|
);
|
2007-12-24 03:20:21 +01:00
|
|
|
|
2008-04-17 10:28:51 +02:00
|
|
|
/**
|
|
|
|
the external interface of Md5 algorithm
|
2007-12-24 03:20:21 +01:00
|
|
|
|
2008-12-10 07:21:28 +01:00
|
|
|
@param[in] Md5Ctx The data structure of storing the original data
|
2008-04-17 10:28:51 +02:00
|
|
|
segment and the final result.
|
2008-12-10 07:21:28 +01:00
|
|
|
@param[in] Data The data wanted to be transformed.
|
|
|
|
@param[in] DataLen The length of data.
|
2007-12-24 03:20:21 +01:00
|
|
|
|
2008-12-10 07:21:28 +01:00
|
|
|
@retval EFI_SUCCESS The transform is ok.
|
|
|
|
@retval Others Some unexpected errors happened.
|
2008-04-17 10:28:51 +02:00
|
|
|
**/
|
2007-12-24 03:20:21 +01:00
|
|
|
EFI_STATUS
|
|
|
|
MD5Update (
|
2008-12-10 07:21:28 +01:00
|
|
|
IN MD5_CTX *Md5Ctx,
|
|
|
|
IN VOID *Data,
|
|
|
|
IN UINTN DataLen
|
2008-09-04 11:37:28 +02:00
|
|
|
);
|
2007-12-24 03:20:21 +01:00
|
|
|
|
2008-04-17 10:28:51 +02:00
|
|
|
/**
|
2008-12-10 07:21:28 +01:00
|
|
|
Accumulate the MD5 value of every data segment and generate the finial
|
|
|
|
result according to MD5 algorithm.
|
2007-12-24 03:20:21 +01:00
|
|
|
|
2008-12-10 07:21:28 +01:00
|
|
|
@param[in] Md5Ctx The data structure of storing the original data
|
2008-04-17 10:28:51 +02:00
|
|
|
segment and the final result.
|
2008-12-10 07:21:28 +01:00
|
|
|
@param[out] HashVal The final 128-bits output.
|
2007-12-24 03:20:21 +01:00
|
|
|
|
2008-12-10 07:21:28 +01:00
|
|
|
@retval EFI_SUCCESS The transform is ok.
|
|
|
|
@retval Others Some unexpected errors happened.
|
2008-04-17 10:28:51 +02:00
|
|
|
**/
|
2007-12-24 03:20:21 +01:00
|
|
|
EFI_STATUS
|
|
|
|
MD5Final (
|
|
|
|
IN MD5_CTX *Md5Ctx,
|
|
|
|
OUT UINT8 *HashVal
|
2008-09-04 11:37:28 +02:00
|
|
|
);
|
2007-12-24 03:20:21 +01:00
|
|
|
|
2008-12-10 07:21:28 +01:00
|
|
|
#endif
|