bbtoolsapi.h
4.48 KB
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
120
121
122
123
124
125
#include <stdio.h>
#include <stdlib.h>
#ifndef WIN32
#include <netinet/in.h>
#else
#include <winsock2.h>
#endif
#include <PR/bbtypes.h>
#include <PR/bcp.h>
#include <PR/bbvirage.h>
#include <PR/bbmetadata.h>
#include <PR/bbticket.h>
#include <PR/bbcert.h>
#include <PR/bbnand.h>
#define SIZE_RSA_CERTBLOB_WORDS 228
#define SIZE_BB_CERTBLOB_WORDS 179
/* location of boot app key in virage constants blob */
#define BB_VIRAGE2_BOOTAPPKEY_LOC (21)
/*
* to generate virage2 data blob
*/
int generateVirage2Data(u32 *constantsFile,
u32 constantsFileLen,
u32 bbID,
BbEccPrivateKey privateKey,
BbEccPublicKey publicKey,
u32 *rand,
void *viragePtr);
/*
* get Certificate for BB : create data in file format required
*/
int generateUnsignedBbCert(u32 certificateType,
u32 sigType,
u32 timestamp,
u8 * subjectname,
u8 * issuername,
BbEccPrivateKey privatekey,
u32 *ecccert,
int sizeofblob);
/*
* get RSA certs : create data in file format required.
*/
int generateUnsignedRSACert(u32 certificateType,
u32 sigType,
u32 timestamp,
u8 * subjectname,
u8 * issuername,
u32 *publicKey,
u32 exponent,
u32 *rsacert,
int sizeofblob);
/*
* create content meta data blob
*/
/*
* create unsigned meta data blob: called by content publishing
*/
/*
* create unsigned meta data blob: called by content publishing
*/
int generateUnsignedContentMetaDataHead(
u32 caCrlVersion,
u32 cpCrlVersion,
BbContentId contentId,
u32 contentSize,
u32 descFlags, /* is it common encryption
use BB_CMD_DESC_COMMON_KEY*/
u8 * commonIv, /* if we want
common encryption */
u32 *constantsFile, /* this is to get
the virage
constants file
and get common key
*/
u8 * contentKey,
u8 * contentHash,
u8 * contentIv,
/* make this opaque to the server:7 words */
u32 * contentProperties,
/*
u32 loadAddress,
u32 romOffset,
u32 bootLength,
u32 execFlags,
u32 hwAccessRights,
u32 secureKernelRights,
u32 sizeState,
*/
u32 bbid, /* optional to attach to one BB*/
BbContentMetaDataHead *metadata);
int generateUnsignedEncryptedTicket( BbContentMetaData *metadata,
BbId bbid,
BbTicketId tid,
u16 limitCode,
u16 limit,
u32 tsCrlVersion,
BbAesIv cmdIv,
BbEccPrivateKey serverprivateKey,
BbEccPublicKey serverpublicKey,
BbEccPublicKey bbpublicKey,
BbTicket *ticket);
int generateCrlHeader(u32 versionNumber,
u32 type,
u32 unusedArg,
u32 date,
BbServerName issuer,
u32 numberRevoked,
u32 sigType,
u32 *crlHeaderBlob,
u32 *lengthBlob);