]>
Commit | Line | Data |
---|---|---|
12618416 | 1 | /** @file\r |
2 | Header file for Md5\r | |
6a690e23 | 3 | \r |
9cb8724d | 4 | Copyright (c) 2004 - 2008, Intel Corporation\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 |
13 | Module Name:\r | |
14 | \r | |
15 | Md5.h\r | |
16 | \r | |
17 | Abstract:\r | |
18 | \r | |
19 | Header file for Md5\r | |
20 | \r | |
12618416 | 21 | **/\r |
6a690e23 | 22 | \r |
23 | #ifndef _MD5_H_\r | |
24 | #define _MD5_H_\r | |
25 | \r | |
9cb8724d | 26 | #include <Uefi/UefiBaseType.h>\r |
6a690e23 | 27 | #include <Library/BaseLib.h>\r |
28 | #include <Library/NetLib.h>\r | |
29 | \r | |
30 | #define MD5_HASHSIZE 16\r | |
31 | \r | |
32 | typedef struct _MD5_CTX {\r | |
33 | EFI_STATUS Status;\r | |
34 | UINT64 Length;\r | |
35 | UINT32 States[MD5_HASHSIZE / sizeof (UINT32)];\r | |
36 | UINT8 M[64];\r | |
37 | UINTN Count;\r | |
38 | } MD5_CTX;\r | |
39 | \r | |
12618416 | 40 | /**\r |
41 | Initialize four 32-bits chaining variables and use them to do the Md5 transform.\r | |
42 | \r | |
43 | @param Md5Ctx[in] the data structure of Md5\r | |
44 | \r | |
45 | @retval EFI_SUCCESS initialization is ok\r | |
46 | \r | |
47 | **/\r | |
6a690e23 | 48 | EFI_STATUS\r |
49 | MD5Init (\r | |
50 | IN MD5_CTX *Md5Ctx\r | |
ed66e1bc | 51 | );\r |
6a690e23 | 52 | \r |
12618416 | 53 | /**\r |
54 | the external interface of Md5 algorithm\r | |
6a690e23 | 55 | \r |
12618416 | 56 | @param Md5Ctx[in] the data structure of storing the original data\r |
57 | segment and the final result.\r | |
6a690e23 | 58 | \r |
12618416 | 59 | @param Data[in] the data wanted to be transformed.\r |
6a690e23 | 60 | \r |
12618416 | 61 | @param DataLen[in] the length of data.\r |
6a690e23 | 62 | \r |
12618416 | 63 | @retval EFI_SUCCESS the transform is ok.\r |
6a690e23 | 64 | \r |
12618416 | 65 | **/\r |
6a690e23 | 66 | EFI_STATUS\r |
67 | MD5Update (\r | |
68 | IN MD5_CTX *Md5Ctx,\r | |
69 | IN VOID *Data,\r | |
70 | IN UINTN DataLen\r | |
ed66e1bc | 71 | );\r |
6a690e23 | 72 | \r |
12618416 | 73 | /**\r |
74 | accumulate the MD5 value of every data segment and generate the finial\r | |
75 | result according to MD5 algorithm\r | |
6a690e23 | 76 | \r |
12618416 | 77 | @param Md5Ctx[in] the data structure of storing the original data\r |
78 | segment and the final result.\r | |
6a690e23 | 79 | \r |
12618416 | 80 | @param HashVal[out] the final 128-bits output.\r |
6a690e23 | 81 | \r |
12618416 | 82 | @retval EFI_SUCCESS the transform is ok.\r |
6a690e23 | 83 | \r |
12618416 | 84 | **/\r |
6a690e23 | 85 | EFI_STATUS\r |
86 | MD5Final (\r | |
87 | IN MD5_CTX *Md5Ctx,\r | |
88 | OUT UINT8 *HashVal\r | |
ed66e1bc | 89 | );\r |
6a690e23 | 90 | \r |
91 | #endif // _MD5_H\r |