summaryrefslogtreecommitdiff
path: root/ReferenceCode/ME/Library/AtLibrary/Dxe/AtAmHelper.h
blob: 43f2ffec9039ff634d8468e9f31662ffe78a1c4c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
/** @file
  AT authetication module for using AT DXE driver.
  This library is utilized by the AT and related drivers to implement Theft Deterrence Technology AM module.

@copyright
  Copyright (c) 2004-2012 Intel Corporation. All rights reserved
  This software and associated documentation (if any) is furnished
  under a license and may only be used or copied in accordance
  with the terms of the license. Except as permitted by such
  license, no part of this software or documentation may be
  reproduced, stored in a retrieval system, or transmitted in any
  form or by any means without the express written consent of
  Intel Corporation.

  This file contains an 'Intel Peripheral Driver' and is
  licensed for Intel CPUs and chipsets under the terms of your
  license agreement with Intel or your vendor.  This file may
  be modified by the user, subject to additional terms of the
  license agreement
**/

#ifndef _ATAM_HELPER_H_
#define _ATAM_HELPER_H_

#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000)
#include "EdkIIGlueDxe.h"
#endif
#include "Tiano.h"

#define PEM_LINE_SIZE         64
#define PEM_INPUT_LINE_SIZE   48
#define PEM_UNITS_PER_LINE    (PEM_INPUT_LINE_SIZE / 3)
#define PEM_DECODED_LINE_SIZE 48
#define PEM_INVALID_CHAR      255
#define PEM_PAD_CHAR          64

/**
  Convert Hex values into Base32 values

  @param[in] encodedStr           Array of encoded BASE values.
  @param[in] encodedLen           Length of encoded values.
  @param[out] rawData             Array of Hex strings that needs to be encoded into BASE32.
  @param[out] rawDataLen          Length of Hex values.

  @retval EFI_BUFFER_TOO_SMALL   Buffer to store encoded string too small.
  @retval EFI_SUCCESS            Initialization complete.
**/
EFI_STATUS
Base32Encode (
  IN UINT8                        *encodedStr,
  IN UINTN                        *encodedLen,
  OUT UINT8                       *rawData,
  OUT UINTN                       rawDataLen
  )
;

/**
  Convert Base32 values into Hex values.

  @param[in] encodedStr           Array of Decimal numbers.
  @param[out] decodedData         Converted Hex values.

  @retval   Length of the Hex Strings that expected.
**/
INTN
Base32Decode (
  IN UINT8                        *encodedStr,
  IN UINT8                        *decodedData
  )
;

/**
  Decimal large (BASE10) into hex value.

  @param[in][out] decStr          Array of Decimal numbers.
  @param[out] u8Hex               Converted Hex values.
  @param[in] hexIndex             Length of the Hex Strings that expected

  @retval None
**/
VOID
DecimalToHexString (
  IN OUT CHAR8                    *decStr,
  OUT UINT8                       *u8Hex,
  IN UINTN                        hexIndex
  )
;

/**
  Convert the CHAR8 ASCII into CHAR16 Unicode strings.

  @param[in] AsciiString          Ascii String.
  @param[out] UnicodeString Buffer for converted Unicode string.

  @retval None
**/
VOID
Uint8ToUnicode (
  IN  CHAR8                       *AsciiString,
  OUT CHAR16                      *UnicodeString
)
;

/**
  This routine displays the debug message in ASCII

  @param[in] Message              Message to be displayed
  @param[in] Length               Length of the message

  @retval None
**/
VOID
ShowBuffer (
  IN UINT8                        *Message,
  IN UINT32                       Length
  )
;

#endif // _ATAM_HELPER_H_