Line 6:
Line 6:
Many operations are done in terms of 64-byte blocks, which means you will often see padding out to the nearest 64-byte boundary at the end of a field.
Many operations are done in terms of 64-byte blocks, which means you will often see padding out to the nearest 64-byte boundary at the end of a field.
−
+
<source lang="c">
typedef unsigned char u8;
typedef unsigned char u8;
typedef unsigned short u16;
typedef unsigned short u16;
typedef unsigned int u32;
typedef unsigned int u32;
typedef unsigned long u64;
typedef unsigned long u64;
−
+
</source>
+
<source lang="c">
typedef struct {
typedef struct {
u32 cid; // content id
u32 cid; // content id
Line 19:
Line 20:
u8 hash [20]; // SHA1 hash content
u8 hash [20]; // SHA1 hash content
} content_record; // size: 0x24 bytes
} content_record; // size: 0x24 bytes
−
+
</source>
+
<source lang="c">
enum sig_type {
enum sig_type {
RSA_2048 = 0x00010001,
RSA_2048 = 0x00010001,
RSA_4096 = 0x00010000
RSA_4096 = 0x00010000
};
};
−
+
</source>
+
<source lang="c">
typedef struct {
typedef struct {
u32 sig_type;
u32 sig_type;
Line 46:
Line 49:
content_record contents[num_contents];
content_record contents[num_contents];
} tmd;
} tmd;
−
+
</source>
The tmd is then followed by a chain of certificates, where each certificate is of the general form
The tmd is then followed by a chain of certificates, where each certificate is of the general form
−
+
<source lang="c">
u32 sig_type; //
u32 sig_type; //
u8 sig[256]; // 256 for RSA_2048, 512 for RSA_4096
u8 sig[256]; // 256 for RSA_2048, 512 for RSA_4096
Line 55:
Line 58:
u8 name[64]; // name of thing being signed
u8 name[64]; // name of thing being signed
u8 key[...];
u8 key[...];
+
</source>