]>
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 | |
51 | )\r | |
12618416 | 52 | ;\r |
6a690e23 | 53 | \r |
12618416 | 54 | /**\r |
55 | the external interface of Md5 algorithm\r | |
6a690e23 | 56 | \r |
12618416 | 57 | @param Md5Ctx[in] the data structure of storing the original data\r |
58 | segment and the final result.\r | |
6a690e23 | 59 | \r |
12618416 | 60 | @param Data[in] the data wanted to be transformed.\r |
6a690e23 | 61 | \r |
12618416 | 62 | @param DataLen[in] the length of data.\r |
6a690e23 | 63 | \r |
12618416 | 64 | @retval EFI_SUCCESS the transform is ok.\r |
6a690e23 | 65 | \r |
12618416 | 66 | **/\r |
6a690e23 | 67 | EFI_STATUS\r |
68 | MD5Update (\r | |
69 | IN MD5_CTX *Md5Ctx,\r | |
70 | IN VOID *Data,\r | |
71 | IN UINTN DataLen\r | |
72 | )\r | |
12618416 | 73 | ;\r |
6a690e23 | 74 | \r |
12618416 | 75 | /**\r |
76 | accumulate the MD5 value of every data segment and generate the finial\r | |
77 | result according to MD5 algorithm\r | |
6a690e23 | 78 | \r |
12618416 | 79 | @param Md5Ctx[in] the data structure of storing the original data\r |
80 | segment and the final result.\r | |
6a690e23 | 81 | \r |
12618416 | 82 | @param HashVal[out] the final 128-bits output.\r |
6a690e23 | 83 | \r |
12618416 | 84 | @retval EFI_SUCCESS the transform is ok.\r |
6a690e23 | 85 | \r |
12618416 | 86 | **/\r |
6a690e23 | 87 | EFI_STATUS\r |
88 | MD5Final (\r | |
89 | IN MD5_CTX *Md5Ctx,\r | |
90 | OUT UINT8 *HashVal\r | |
91 | )\r | |
6a690e23 | 92 | ;\r |
93 | \r | |
94 | #endif // _MD5_H\r |