]>
Commit | Line | Data |
---|---|---|
12618416 | 1 | /** @file\r |
4cf432de | 2 | Header file for Md5.\r |
6a690e23 | 3 | \r |
e5eed7d3 HT |
4 | Copyright (c) 2004 - 2008, Intel Corporation. All rights reserved.<BR>\r |
5 | This program and the accompanying materials\r | |
7a444476 | 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 |
cfb1461b | 20 | #include <Library/BaseMemoryLib.h>\r |
6a690e23 | 21 | #include <Library/NetLib.h>\r |
4cf432de | 22 | \r |
6a690e23 | 23 | #define MD5_HASHSIZE 16\r |
24 | \r | |
25 | typedef struct _MD5_CTX {\r | |
26 | EFI_STATUS Status;\r | |
27 | UINT64 Length;\r | |
28 | UINT32 States[MD5_HASHSIZE / sizeof (UINT32)];\r | |
29 | UINT8 M[64];\r | |
30 | UINTN Count;\r | |
31 | } MD5_CTX;\r | |
32 | \r | |
12618416 | 33 | /**\r |
34 | Initialize four 32-bits chaining variables and use them to do the Md5 transform.\r | |
35 | \r | |
c5de0d55 | 36 | @param[out] Md5Ctx The data structure of Md5.\r |
12618416 | 37 | \r |
4cf432de | 38 | @retval EFI_SUCCESS Initialization is ok.\r |
12618416 | 39 | **/\r |
6a690e23 | 40 | EFI_STATUS\r |
41 | MD5Init (\r | |
c5de0d55 | 42 | OUT MD5_CTX *Md5Ctx\r |
ed66e1bc | 43 | );\r |
6a690e23 | 44 | \r |
12618416 | 45 | /**\r |
46 | the external interface of Md5 algorithm\r | |
6a690e23 | 47 | \r |
c5de0d55 | 48 | @param[in, out] Md5Ctx The data structure of storing the original data\r |
49 | segment and the final result.\r | |
50 | @param[in] Data The data wanted to be transformed.\r | |
51 | @param[in] DataLen The length of data.\r | |
6a690e23 | 52 | \r |
4cf432de | 53 | @retval EFI_SUCCESS The transform is ok.\r |
963dbb30 | 54 | @retval Others Other errors as indicated.\r |
12618416 | 55 | **/\r |
6a690e23 | 56 | EFI_STATUS\r |
57 | MD5Update (\r | |
c5de0d55 | 58 | IN OUT MD5_CTX *Md5Ctx,\r |
59 | IN VOID *Data,\r | |
60 | IN UINTN DataLen\r | |
ed66e1bc | 61 | );\r |
6a690e23 | 62 | \r |
12618416 | 63 | /**\r |
4cf432de | 64 | Accumulate the MD5 value of every data segment and generate the finial\r |
65 | result according to MD5 algorithm.\r | |
6a690e23 | 66 | \r |
c5de0d55 | 67 | @param[in, out] Md5Ctx The data structure of storing the original data\r |
68 | segment and the final result.\r | |
69 | @param[out] HashVal The final 128-bits output.\r | |
6a690e23 | 70 | \r |
4cf432de | 71 | @retval EFI_SUCCESS The transform is ok.\r |
963dbb30 | 72 | @retval Others Other errors as indicated.\r |
12618416 | 73 | **/\r |
6a690e23 | 74 | EFI_STATUS\r |
75 | MD5Final (\r | |
c5de0d55 | 76 | IN OUT MD5_CTX *Md5Ctx,\r |
77 | OUT UINT8 *HashVal\r | |
ed66e1bc | 78 | );\r |
6a690e23 | 79 | \r |
4cf432de | 80 | #endif \r |