]>
Commit | Line | Data |
---|---|---|
1 | /** @file\r | |
2 | Header file for Md5\r | |
3 | \r | |
4 | Copyright (c) 2004 - 2008, Intel Corporation\r | |
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 | |
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 | |
21 | **/\r | |
22 | \r | |
23 | #ifndef _MD5_H_\r | |
24 | #define _MD5_H_\r | |
25 | \r | |
26 | #include <Uefi/UefiBaseType.h>\r | |
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 | |
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 | |
48 | EFI_STATUS\r | |
49 | MD5Init (\r | |
50 | IN MD5_CTX *Md5Ctx\r | |
51 | );\r | |
52 | \r | |
53 | /**\r | |
54 | the external interface of Md5 algorithm\r | |
55 | \r | |
56 | @param Md5Ctx[in] the data structure of storing the original data\r | |
57 | segment and the final result.\r | |
58 | \r | |
59 | @param Data[in] the data wanted to be transformed.\r | |
60 | \r | |
61 | @param DataLen[in] the length of data.\r | |
62 | \r | |
63 | @retval EFI_SUCCESS the transform is ok.\r | |
64 | \r | |
65 | **/\r | |
66 | EFI_STATUS\r | |
67 | MD5Update (\r | |
68 | IN MD5_CTX *Md5Ctx,\r | |
69 | IN VOID *Data,\r | |
70 | IN UINTN DataLen\r | |
71 | );\r | |
72 | \r | |
73 | /**\r | |
74 | accumulate the MD5 value of every data segment and generate the finial\r | |
75 | result according to MD5 algorithm\r | |
76 | \r | |
77 | @param Md5Ctx[in] the data structure of storing the original data\r | |
78 | segment and the final result.\r | |
79 | \r | |
80 | @param HashVal[out] the final 128-bits output.\r | |
81 | \r | |
82 | @retval EFI_SUCCESS the transform is ok.\r | |
83 | \r | |
84 | **/\r | |
85 | EFI_STATUS\r | |
86 | MD5Final (\r | |
87 | IN MD5_CTX *Md5Ctx,\r | |
88 | OUT UINT8 *HashVal\r | |
89 | );\r | |
90 | \r | |
91 | #endif // _MD5_H\r |