aboutsummaryrefslogtreecommitdiff
path: root/Include/Library/UsbSerialNumberLib.h
blob: 3ae594b21f431de4d91dd82c3f56c654d789f01f (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
/** @file

  Copyright (c) 2017, Linaro. All rights reserved.

  This program and the accompanying materials
  are licensed and made available under the terms and conditions of the BSD License
  which accompanies this distribution.  The full text of the license may be found at
  http://opensource.org/licenses/bsd-license.php

  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.

**/

#ifndef __USB_SERIAL_NUMBER_LIB_H__
#define __USB_SERIAL_NUMBER_LIB_H__

#include <Uefi.h>

#define SERIAL_NUMBER_SIZE                      17

typedef struct {
  UINT64        Magic;
  UINT64        Data;
  CHAR16        UnicodeSN[SERIAL_NUMBER_SIZE];
} RANDOM_SERIAL_NUMBER;

EFI_STATUS
GenerateUsbSNBySeed (
  IN  UINT32                  Seed,
  OUT RANDOM_SERIAL_NUMBER   *RandomSN
  );

EFI_STATUS
GenerateUsbSN (
  OUT CHAR16                 *UnicodeSN
  );

EFI_STATUS
LoadSNFromBlock (
  IN  EFI_HANDLE              FlashHandle,
  IN  EFI_LBA                 Lba,
  OUT CHAR16                 *UnicodeSN
  );

EFI_STATUS
StoreSNToBlock (
  IN EFI_HANDLE               FlashHandle,
  IN EFI_LBA                  Lba,
  IN CHAR16                  *UnicodeSN
  );

#endif /* __USB_SERIAL_NUMBER_LIB_H__ */