Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 138 lines (119 sloc) 4.052 kB
72f60ce First commit.
Evan Miller authored
1 /* useful byte arrays for rolling a ZIP archive */
2 /* see http://www.pkware.com/documents/casestudies/APPNOTE.TXT */
3 /* also http://www.unix-ag.uni-kl.de/~conrad/krypto/pkcrack/doc/appnote.iz.txt */
4
5 /* byte-align structs to conform to ZIP format */
6 #pragma pack(push, 1)
7
911b447 Update from Google Code SVN
Evan Miller authored
8 #define zip_version_default 10
9 #define zip_version_zip64 45
10
72f60ce First commit.
Evan Miller authored
11 typedef struct {
911b447 Update from Google Code SVN
Evan Miller authored
12 uint16_t tag; //0x5455
72f60ce First commit.
Evan Miller authored
13 uint16_t size;
14 uint8_t info;
15 uint32_t mtime;
16 uint32_t atime;
911b447 Update from Google Code SVN
Evan Miller authored
17 } ngx_zip_extra_field_local_t; // extended timestamp
72f60ce First commit.
Evan Miller authored
18
19 typedef struct {
911b447 Update from Google Code SVN
Evan Miller authored
20 uint16_t tag; //0x5455
72f60ce First commit.
Evan Miller authored
21 uint16_t size;
22 uint8_t info;
23 uint32_t mtime;
24 } ngx_zip_extra_field_central_t;
25
911b447 Update from Google Code SVN
Evan Miller authored
26 typedef struct { // not entirely writen...
27 uint16_t tag; //0x0001
28 uint16_t size; // size of this record (32)
29 uint64_t uncompressed_size; //!! in all other places in spec uncompressed follow compressed!
30 uint64_t compressed_size;
31 //these for CD:
32 uint64_t relative_header_offset; //offset of local header record (cd)
33 uint32_t disc_start; // no of disc where file starts (cd)
34 } ngx_zip_extra_field_zip64_full_t;
35
72f60ce First commit.
Evan Miller authored
36 typedef struct {
911b447 Update from Google Code SVN
Evan Miller authored
37 uint16_t tag; //0x0001
38 uint16_t size; //0x14
39 uint64_t uncompressed_size;
40 uint64_t compressed_size;
41 } ngx_zip_extra_field_zip64_sizes_only_t;
42
43 typedef struct {
44 uint16_t tag; //0x0001
45 uint16_t size; //0x0C
46 uint64_t relative_header_offset;
47 } ngx_zip_extra_field_zip64_offset_only_t;
48
49 typedef struct {
50 uint16_t tag; //0x0001
51 uint16_t size; //0x1C
52 uint64_t uncompressed_size;
53 uint64_t compressed_size;
54 uint64_t relative_header_offset;
55 } ngx_zip_extra_field_zip64_sizes_offset_t;
56
57
58 typedef struct {
59 uint32_t signature; //0x08074b50
72f60ce First commit.
Evan Miller authored
60 uint32_t crc32;
61 uint32_t compressed_size;
62 uint32_t uncompressed_size;
63 } ngx_zip_data_descriptor_t;
64
65 typedef struct {
66 uint32_t signature;
911b447 Update from Google Code SVN
Evan Miller authored
67 uint32_t crc32;
68 uint64_t compressed_size;
69 uint64_t uncompressed_size;
70 } ngx_zip_data_descriptor_zip64_t;
71
72
73 typedef struct {
74 uint32_t signature; //0x04034b50
72f60ce First commit.
Evan Miller authored
75 uint16_t version;
76 uint16_t flags;
77 uint16_t compression_method;
78 uint32_t mtime;
79 uint32_t crc32;
80 uint32_t compressed_size;
81 uint32_t uncompressed_size;
82 uint16_t filename_len;
83 uint16_t extra_field_len;
84 } ngx_zip_local_file_header_t;
85
911b447 Update from Google Code SVN
Evan Miller authored
86
72f60ce First commit.
Evan Miller authored
87 typedef struct {
911b447 Update from Google Code SVN
Evan Miller authored
88 uint32_t signature; //0x02014b50
72f60ce First commit.
Evan Miller authored
89 uint16_t version_made_by;
90 uint16_t version_needed;
91 uint16_t flags;
92 uint16_t compression_method;
93 uint32_t mtime;
94 uint32_t crc32;
95 uint32_t compressed_size;
96 uint32_t uncompressed_size;
97 uint16_t filename_len;
98 uint16_t extra_field_len;
99 uint16_t comment_len;
100 uint16_t disk_n;
101 uint16_t attr_internal;
102 uint32_t attr_external;
103 uint32_t offset;
104 } ngx_zip_central_directory_file_header_t;
105
106 typedef struct {
911b447 Update from Google Code SVN
Evan Miller authored
107 uint32_t signature; //0x06054b50
72f60ce First commit.
Evan Miller authored
108 uint16_t disk_n;
109 uint16_t cd_disk_n;
110 uint16_t disk_entries_n;
111 uint16_t entries_n;
112 uint32_t size;
113 uint32_t offset;
114 uint16_t comment_len;
115 } ngx_zip_end_of_central_directory_record_t;
116
911b447 Update from Google Code SVN
Evan Miller authored
117 typedef struct {
118 uint32_t signature; // 0x06064b50
119 uint64_t size; //of this record (+variable fields, but minus signature and this size field), Size = SizeOfFixedFields + SizeOfVariableData - 12
120 uint16_t version_made_by;
121 uint16_t version_needed;
122 uint32_t disk_n;
123 uint32_t cd_disk_n; // num of disk with start of CD
124 uint64_t cd_n_entries_on_this_disk;
125 uint64_t cd_n_entries_total;
126 uint64_t cd_size;
127 uint64_t cd_offset; // cd offset with respect to starting disk number
128 //variable fields go here
129 } ngx_zip_zip64_end_of_central_directory_record_t;
130
131 typedef struct {
132 uint32_t signature; //0x07064b50
133 uint32_t z64_cd_disk_n; // number of disk with start of zip64 end of central directory
134 uint64_t cd_relative_offset;
135 uint32_t disks_total_n;
136 } ngx_zip_zip64_end_of_central_directory_locator_t;
72f60ce First commit.
Evan Miller authored
137 #pragma pack(pop)
Something went wrong with that request. Please try again.