]> git.lizzy.rs Git - plan9front.git/blob - sys/src/liboventi/venti.txt
libsec: use tsmemcmp() when comparing hashes, use mpfield() for ecc, use mptober...
[plan9front.git] / sys / src / liboventi / venti.txt
1
2 protocol version id
3
4 both client and server send '\n' terminated ascii of the form
5
6 venti-<versions>-<software>
7
8
9 <software> = is a software id which is ignored but may be useful for debugging
10
11 If the server and client have the same version number then this
12 version is used.  Otherwise backup to the greatest common
13 major version number, e.g. 1.00 2.00 etc.  If no version in
14 common then abort.  The idea is both client and server should
15 support a continusous range of major versions.  The minor version
16 numbers are used for development purposes.
17
18 After protocol negotiation switch to binary format
19
20 all numbers sent big endian
21
22 strings are sent with 2 byte length without nulls and in utf-8 max size of 1K
23
24 RPC protocol
25
26 header 
27         op[1]   byte op
28         tid[2]  transation id
29
30 client manages the tid space.  Until session is established tid must equal 0.
31 i.e. only one outstanding op.
32
33 CipherStrength
34         None,
35         Auth,
36         Weak,
37         Strong
38 CipherAlgorithms
39         None
40         SSL3
41         TLS1
42 CompressionAlgorithms
43         None
44         Deflate
45         Thwack?
46
47 BlockTypes
48         Root
49         Pointer
50         Data
51
52 ==============================================
53
54 TPing
55 RPing
56
57 RError
58         error: string
59
60 THello
61         version:string;         know to be supported by both
62         uid: string
63         uhash[20]               use for cipher boot strapping
64         cipherstrength[1]
65         ncipher[1];
66         cipher[ncipher];
67         ncompressor[1];
68         compressor[ncompressor];
69 RHello
70         sid: string
71         shash[20];              use for cipher bott strapping
72         cipher[1];
73         compressor[1];
74
75 use srp style authentication
76         g=2
77         N is safe prime 1024 bits - find a good prime!
78
79         x = H("venti" H(sid) H(uid) H(password))
80         v = g^x
81         a = random
82         b = random
83         B = (v + g^b)
84         A = g^a
85         u = first four bytes of H(B)
86         S = (B - g^x) ^ (a + u*x) = (A * v^u) ^ b
87         K = H(S)
88         M1 = H(H(versions) H(THello) H(RHello) A B K)
89         M2 = H(A M1 K)
90
91 TAuth0
92         A[128]
93 RAuth0
94         B[128]
95 TAuth1
96         M1[20]
97 RAuth1
98         M2[20]
99
100 push cipher
101 push compression
102
103 TWrite
104         length[2] max 56*1024
105         type[1]
106         data[length]
107 RWrite
108         hash[20]
109
110 TRead
111         hash[20]
112         type[1]
113         length[2]
114 RRead
115         length[2]
116         data[length]
117
118 ============================================================
119
120 simplified access when trusting the server
121 reduces network bandwidth since pointer blocks are not
122 sent to the client - can also enable permission checking
123
124 RReadRoot
125         root[20]
126 TReadRoot
127         name: string
128         type: string
129         blocksize[2]
130         nblock[8]
131         time[4]
132         uid: string;
133         gid: string
134
135 RReadData
136         root[20]
137         block[8]
138         length[2]
139 TReadData
140         length[2]
141         collision[1]
142         data[length]
143
144 ==============================================
145
146 maybe some clients should be required to navigate to block via root nodes.
147 This would enable permission checking via access to the root node.
148
149 RTagOpen
150         tag[2]
151         root[20]
152 TTagOpen
153
154 QTagRead
155         tag[2]
156         type[1]
157         length[2]
158 RTagRead
159         length[2]
160         data[length]
161         
162 QTagWalkRead
163         tag[2]
164         ntag[2]         can reuse a tag to do an implict clunk
165         index[2]
166         type[1]
167         length[2]
168 RTagWalkRead
169         length[2]
170         data[length]
171
172 RTagClunk
173         tag[2]
174 TTagClunk
175
176 ============================
177
178 Types of blocks
179
180 Data
181
182 Root
183         name[128]
184         type[128]
185         score[20]       - DirBlock
186
187 Pointer
188         score[20]*      the number of hashes can be less than fanout when the
189                         tree is not full
190 DirBlock
191         DirEntry[32]*
192
193 DirEntry        
194         pointersize[2]  - pointer block size
195         datasize[2]     - data blocks size
196         flag[1]         directory
197         size[7]         in bytes - determines pointer depth - intermidate truncated block count as full
198         score[20]       root of pointer blocks or data block 
199
200 ============================
201
202 mode flags
203         (1<<0)  ModeOtherExec
204         (1<<1)  ModeOtherWrite
205         (1<<2)  ModeOtherRead
206         (1<<3)  ModeGroupExec
207         (1<<4)  ModeGroupWrite
208         (1<<5)  ModeGroupRead
209         (1<<6)  ModeOwnerExec
210         (1<<7)  ModeOwnerWrite
211         (1<<8)  ModeOwnerRead
212         (1<<9)  ModeSticky
213         (1<<10) ModeSetUid
214         (1<<11) ModeSetGid
215         (1<<12) ModeAppend
216         (1<<13) ModeExclusive
217         (1<<14) ModeLink
218         (1<<15) ModeDir - duplicates dir entry
219         (1<<16) ModeHidden
220         (1<<17) ModeSystem
221         (1<<18) ModeArchive
222         (1<<19) ModeTemporary
223         (1<<18) ModeCompressed
224         (1<<19) ModeEncrypted
225
226 extraType
227         2       Plan9
228         version[4]
229         muid: string
230
231         3 NT Time
232         createTime[8];
233         modifyTime[8];
234         accessTime[8]
235         
236
237 MetaEntry
238         name: string    /* must be first */
239         direntry[4]
240
241         id[8]
242
243         uid: string
244         gui: string
245         mtime[4]
246         ctime[4]
247         atime[4]
248         
249         mode[4] 
250         
251         extratype;
252         extrasize[2]
253         extra:[nextra]
254
255 MetaEntry Block
256         magic[4]
257         size[2]
258         free[2] - used to determine if work compacting
259         maxindex[2] - size of index table in bytes
260         nindex[2]
261         index[2*nindex]
262
263 per OS directory entries?
264
265 inode...
266
267