]>
Commit | Line | Data |
---|---|---|
12618416 | 1 | /** @file\r |
4cf432de | 2 | Header file for Md5.\r |
6a690e23 | 3 | \r |
4cf432de | 4 | Copyright (c) 2004 - 2008, Intel Corporation.<BR>\r |
7a444476 | 5 | All rights reserved. This program and the accompanying materials\r |
6 | are licensed and made available under the terms and conditions of the BSD License\r | |
7 | which accompanies this distribution. The full text of the license may be found at\r | |
8 | http://opensource.org/licenses/bsd-license.php\r | |
9 | \r | |
10 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
11 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
6a690e23 | 12 | \r |
12618416 | 13 | **/\r |
6a690e23 | 14 | \r |
15 | #ifndef _MD5_H_\r | |
16 | #define _MD5_H_\r | |
17 | \r | |
4cf432de | 18 | #include <Uefi.h>\r |
6a690e23 | 19 | #include <Library/BaseLib.h>\r |
20 | #include <Library/NetLib.h>\r | |
4cf432de | 21 | \r |
6a690e23 | 22 | #define MD5_HASHSIZE 16\r |
23 | \r | |
24 | typedef struct _MD5_CTX {\r | |
25 | EFI_STATUS Status;\r | |
26 | UINT64 Length;\r | |
27 | UINT32 States[MD5_HASHSIZE / sizeof (UINT32)];\r | |
28 | UINT8 M[64];\r | |
29 | UINTN Count;\r | |
30 | } MD5_CTX;\r | |
31 | \r | |
12618416 | 32 | /**\r |
33 | Initialize four 32-bits chaining variables and use them to do the Md5 transform.\r | |
34 | \r | |
4cf432de | 35 | @param[in] Md5Ctx The data structure of Md5.\r |
12618416 | 36 | \r |
4cf432de | 37 | @retval EFI_SUCCESS Initialization is ok.\r |
12618416 | 38 | **/\r |
6a690e23 | 39 | EFI_STATUS\r |
40 | MD5Init (\r | |
41 | IN MD5_CTX *Md5Ctx\r | |
ed66e1bc | 42 | );\r |
6a690e23 | 43 | \r |
12618416 | 44 | /**\r |
45 | the external interface of Md5 algorithm\r | |
6a690e23 | 46 | \r |
4cf432de | 47 | @param[in] Md5Ctx The data structure of storing the original data\r |
12618416 | 48 | segment and the final result.\r |
4cf432de | 49 | @param[in] Data The data wanted to be transformed.\r |
50 | @param[in] DataLen The length of data.\r | |
6a690e23 | 51 | \r |
4cf432de | 52 | @retval EFI_SUCCESS The transform is ok.\r |
53 | @retval Others Some unexpected errors happened.\r | |
12618416 | 54 | **/\r |
6a690e23 | 55 | EFI_STATUS\r |
56 | MD5Update (\r | |
4cf432de | 57 | IN MD5_CTX *Md5Ctx,\r |
58 | IN VOID *Data,\r | |
59 | IN UINTN DataLen\r | |
ed66e1bc | 60 | );\r |
6a690e23 | 61 | \r |
12618416 | 62 | /**\r |
4cf432de | 63 | Accumulate the MD5 value of every data segment and generate the finial\r |
64 | result according to MD5 algorithm.\r | |
6a690e23 | 65 | \r |
4cf432de | 66 | @param[in] Md5Ctx The data structure of storing the original data\r |
12618416 | 67 | segment and the final result.\r |
4cf432de | 68 | @param[out] HashVal The final 128-bits output.\r |
6a690e23 | 69 | \r |
4cf432de | 70 | @retval EFI_SUCCESS The transform is ok.\r |
71 | @retval Others Some unexpected errors happened.\r | |
12618416 | 72 | **/\r |
6a690e23 | 73 | EFI_STATUS\r |
74 | MD5Final (\r | |
75 | IN MD5_CTX *Md5Ctx,\r | |
76 | OUT UINT8 *HashVal\r | |
ed66e1bc | 77 | );\r |
6a690e23 | 78 | \r |
4cf432de | 79 | #endif \r |