tree checksum vpatch file split hunks

all signers: phf

antecedents: vtools_genesis keccak vdiff_fixes_newline_gcc

press order:

vtools_genesisphf
vdiff_fixes_newline_gccphf
keccakphf
vdiff_keccakphf

patch:

- 30959920906CDF36872B949334B762F96F0349ECE83B040D67C1D551E4DEB436AEC54AFE6767B1EF1E721D99550C72E3D2A5CC83537DC622D50CA93D9261E19D
+ 257066F00B2AF8569E4B24CDF06FA376A6312D8F0568EECC83E6F4624D7C5109A51906FD5B2BC4F55840577939D86AA4173C0DD70160916998D528CFF0F6A67B
vtools/Makefile
(1 . 37)(1 . 7)
5
6 CC:=gcc
7 LDFLAGS:=-static
8
9 SOURCES=lib/cmpbuf.c \
10 lib/dirname.c \
11 lib/error.c \
12 lib/filenamecat.c \
13 lib/filetype.c \
14 lib/hash.c \
15 lib/progname.c \
16 lib/xalloc.c \
17 src/analyze.c \
18 src/context.c \
19 src/diff.c \
20 src/dir.c \
21 src/io.c \
22 src/util.c
23 HEADERS=lib/cmpbuf.h \
24 lib/diffseq.h \
25 lib/dirname.h \
26 lib/error.h \
27 lib/filenamecat.h \
28 lib/filetype.h \
29 lib/hash.h \
30 lib/progname.h \
31 lib/xalloc.h \
32 src/diff.h \
33 src/system.h
34 OBJECTS=$(SRCS:.c=.o)
35
36 vdiff: $(SOURCES) $(HEADERS)
37 $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -std=c99 -pedantic -Ilib/ -Isrc/ -o $@ $(SOURCES)
38 vdiff:
39 gprbuild -Pvdiff.gpr
40
41 clean:
42 @rm -f vdiff
43 gprclean -Pvdiff.gpr
44
- 43DA758A157603A39688C97D06334E49F948FEAB5856D837687030FCA779C9E00A3D54CBDAF1B72561D72BC92DEA5A15B0D28B2AAB9D6E4F854F83D825CDBB48
+ 7896D8CC732AEF7CBAAE1C872DD824F51C5F6D1D23E42BB57CE03CF7B84664CC2140D4DBB9C70B72E14A1F82A59ACDDA3B7432E90423F0A8E93CF4FE5ABF2E7F
vtools/manifest
(1 . 3)(1 . 4)
49 510300 phf vtools_genesis Initial release of vtools. Genesis contains stripped down version of diffutils 3.6, with most of functionality not relevant to vpatch removed.
50 511300 phf vdiff_fixes_newline_gcc Fixes for C99 compatability, support for "No newline at end of file" directive.
51 511300 phf keccak Included diana_coman's keccak implementation.
52 511300 phf vdiff_keccak Vdiff hashing and output using Keccak instead of SHA512.
-
+ A3E4D3D9AFDBDF6C9B1D506A430B34E087290C3136BA1B459224BE8A21AE926B4513A1E0EB44262908C3E5E93FC86FF8E80859D8632861D4B2367D68D21C76E1
vtools/obj/readme
(0 . 0)(1 . 1)
57 objs
- 0626CFF1E1871B60EBE1843368954151AA16905F5A26A3BC9A0E9DF97EAB432042377A5E85928AE3144F88800C8691FA7D6AA362529FA37EA789252C540FD520
+ 6111A6463C2500D9715FD7AFFD174D0EC942844CA2741C411573490B6D765B1F7FA90A7593CC98BB0A259DA694DBC652979FC1F7A10D188838A0F2B473B18797
vtools/src/analyze.c
(428 . 6)(428 . 8)
62 struct change *script;
63 int changes;
64
65 cmp->file[0].hash_context = keccak_begin();
66 cmp->file[1].hash_context = keccak_begin();
67
68 /* If we have detected that either file is binary, compare the two
69 files as binary. This can happen only when the first chunk is
- F5B3E5C736BE0C6C4E4FDCC50E2A436C17D3E84FE47E6125DD0FA775C9CFFCC625A98FE7091A036593E21CDAFA1E533FD8A04640649CD6ED89DA499C94333668
+ 6ED67D33234B4CC45910FC9D69C40C8DD7D205AEB7A5532EB83F5E889EA81556147B0D6689D46DF52B9C58F82C56A1A4B255BF7D09095BCFA170A27AE8203A93
vtools/src/context.c
(5 . 6)(5 . 18)
74 /* Print a label for a context diff, with a file name and date or a
75 label. */
76
77 const char bb_hexdigits_upcase[] = "0123456789ABCDEF";
78 char *bin2hex(char *p, const char *cp, int count) {
79 while (count) {
80 unsigned char c = *cp++;
81 /* put lowercase hex digits */
82 *p++ = 0x20 | bb_hexdigits_upcase[c >> 4];
83 *p++ = 0x20 | bb_hexdigits_upcase[c & 0xf];
84 count--;
85 }
86 return p;
87 }
88
89 static void
90 print_context_label(char const *mark,
91 struct file_data *inf,
(13 . 7)(25 . 13)
93 if (label)
94 fprintf(outfile, "%s %s\n", mark, label);
95 else {
96 fprintf(outfile, "%s %s false\n", mark, name);
97 if (inf->desc >= 0) {
98 char buf[(64 * 2) + 1] = {0};
99 bin2hex(buf, (char*) inf->hash, 64);
100 fprintf(outfile, "%s %s %s\n", mark, name, buf);
101 } else {
102 fprintf(outfile, "%s %s false\n", mark, name);
103 }
104 }
105 }
106
- 908272F9A1C8A15CAC809A9C6DBF96F7CD60B40BC3EBAD0F1DF368F6D5DFA10DA38E7E6F8CD09DC994E2291B95334C7768D885633536302E3C47181452A2B839
+ CCE12BCFAF2C0C0B5140FC73BFD82C84EDAB99EE848B7166D26FB22E564013AF74F3A9638949B176767B3FF50C0149C9992337610D6A03DC826F083B2EC1EF31
vtools/src/diff.c
(69 . 6)(69 . 7)
111 uintmax_t numval;
112 char *numend;
113 set_program_name(argv[0]);
114 adainit();
115
116 /* Decode the options. */
117
(195 . 6)(196 . 7)
119 }
120 }
121
122 adafinal();
123 check_stdout();
124 exit(exit_status);
125 return exit_status;
- 8389679F305C168B019ADB6AE495F60C1B71EFC35052D94B6672829B437E0607E77D66D457C81128110B6ECEFCFC41ADB55EFAB8AF91E9B7C76DAF5597EF08F6
+ 44C9FE46BBB893B8D2A808922AC56C999D6F61D79F0831293894D17EA9B26332FCC525D41A42A1273EE336BB5FC6BFFCFF9DBF339195D75999DE019B799D891A
vtools/src/diff.h
(2 . 6)(2 . 7)
130 #include <stdio.h>
131 #include <string.h>
132 #include <sys/stat.h>
133 #include "keccak.h"
134
135 /* What kind of changes a hunk contains. */
136 enum changes {
(158 . 6)(159 . 10)
138 /* 1 more than the maximum equivalence value used for this or its
139 sibling file. */
140 lin equiv_max;
141
142 /* keccak context */
143 void *hash_context;
144 uint64_t hash[8];
145 };
146
147 /* The file buffer, considered as an array of bytes rather than as an
- 7106411C84C6BC2D4EA1027D66B6B1A6278106C5FC2D9C4F990D8D4D762EDDEDA8EAC3441BF3B40129167750B56D210228C2A0E437A707E89FE32DE1A4237E99
+ 2FC0AB62CE34C963D194931A5F1F9D769D494C29597EA003A768BC0BE4A1D511536A6BDECF4E6A87CF73D73F9287AF617B016212D0F034089A5745CD1DD6FE72
vtools/src/io.c
(57 . 8)(57 . 16)
152 if (s == SIZE_MAX)
153 pfatal_with_name(current->name);
154
155 if (s)
156 keccak_hash(current->hash_context,
157 FILE_BUFFER(current) + current->buffered, s);
158
159 current->buffered += s;
160 current->eof = s < size;
161 if(current->eof) {
162 keccak_end(current->hash_context, (char*)current->hash, 64);
163 keccak_free(¤t->hash_context);
164 }
165 }
166 }
167
-
+ 4FC3F63BA6556D1076287E210BD3A9943D9D0A1A3B17E59F4832517845414B153D05204C4235CFE73560D07B785BE69FF496FCAD35F742E2E8A49798C065F5B5
vtools/src/keccak.h
(0 . 0)(1 . 16)
172 #ifndef KECCAK_H_
173 #define KECCAK_H_
174
175 #include<stdio.h>
176 #include<string.h>
177 #include<stdlib.h>
178
179 extern void *keccak_begin();
180 extern void keccak_get_ctx_byte_size(size_t *size);
181 extern void keccak_hash(void *ctx, char *array, size_t size);
182 extern void keccak_end(void *ctx, char *out, size_t size);
183 extern void keccak_free(void **ctx);
184 extern void adainit();
185 extern void adafinal();
186
187 #endif
-
+ 680EFB9458A976F700A689A6B0678510172945E94D35207F07BEA280BB87B30EDC889968FBF6C922C8CC5C79B9193986AB66037CC36F47D52B49E91826C22FE4
vtools/src/keccak_c.adb
(0 . 0)(1 . 89)
192 package body Keccak_C is
193 -- helper functions
194 procedure ToBitstream(S: in String; B: out Bitstream ) is
195 V : Unsigned_8;
196 Pos : Natural;
197 begin
198 Pos := B'First;
199 for C of S loop
200 V := Character'Pos( C );
201 B( Pos ) := Bit( V and 1 );
202 B( Pos + 1 ) := Bit( Shift_Right( V, 1 ) and 1 );
203 B( Pos + 2 ) := Bit( Shift_Right( V, 2 ) and 1 );
204 B( Pos + 3 ) := Bit( Shift_Right( V, 3 ) and 1 );
205 B( Pos + 4 ) := Bit( Shift_Right( V, 4 ) and 1 );
206 B( Pos + 5 ) := Bit( Shift_Right( V, 5 ) and 1 );
207 B( Pos + 6 ) := Bit( Shift_Right( V, 6 ) and 1 );
208 B( Pos + 7 ) := Bit( Shift_Right( V, 7 ) and 1 );
209 Pos := Pos + 8;
210 end loop;
211 end ToBitstream;
212
213 procedure ToString(B: in Bitstream; S: out String ) is
214 N : Natural;
215 Pos : Natural;
216 begin
217 Pos := B'First;
218 for I in S'Range loop
219 N := Natural( B( Pos ) ) +
220 Natural( B( Pos + 1 ) ) * 2 +
221 Natural( B( Pos + 2 ) ) * 4 +
222 Natural( B( Pos + 3 ) ) * 8 +
223 Natural( B( Pos + 4 ) ) * 16 +
224 Natural( B( Pos + 5 ) ) * 32 +
225 Natural( B( Pos + 6 ) ) * 64 +
226 Natural( B( Pos + 7 ) ) * 128;
227 Pos := Pos + 8;
228 S( I ) := Character'Val( N );
229 end loop;
230 end ToString;
231
232 -- C interface
233
234 procedure C_Get_Size(Size: out Interfaces.C.size_t) is
235 begin
236 Size := C_Context'Size / 8;
237 end C_Get_Size;
238
239 function C_Begin return C_Context_Access is
240 Result : C_Context_Access;
241 begin
242 Result := new C_Context;
243 KeccakBegin(Result.all);
244 return Result;
245 end C_Begin;
246
247 procedure C_Hash(Ctx: in C_Context_Access;
248 Input: Interfaces.C.Char_Array;
249 Len: Interfaces.C.Size_T) is
250 L: Natural := Natural(Len);
251 S: String(1..L);
252 B: Bitstream(1..S'Length*8);
253 begin
254 Interfaces.C.To_Ada(Input, S, L, Trim_Nul => False);
255 ToBitstream(S, B);
256 KeccakHash(Ctx.all, B);
257 end C_Hash;
258
259 procedure C_End(Ctx: C_Context_Access;
260 Output: out Interfaces.C.Char_Array;
261 Len: Interfaces.C.Size_T) is
262 L: Natural := Natural(Len);
263 S: String(1..L);
264 B: Bitstream(1..S'Length*8);
265 Count: Interfaces.C.Size_T;
266 begin
267 KeccakEnd(Ctx.all, B);
268 ToString(B, S);
269 Interfaces.C.To_C(S, Output(0..Len), Count, Append_Nul => False);
270 -- Len = Count
271 end C_End;
272
273 procedure C_Context_Deallocate is new Ada.Unchecked_Deallocation
274 (C_Context, C_Context_Access);
275
276 procedure C_Deallocate(Ctx: in out C_Context_Access) is
277 begin
278 C_Context_Deallocate(Ctx);
279 end C_Deallocate;
280 end Keccak_C;
-
+ 33D0A8BFAC503D941796252636419DFBC9917D9D67C2E15E13E85083AFB8ED46CDE57452B61EF275CCFDE07B7891D510467B49868882248A5836BCE52EF7A7D0
vtools/src/keccak_c.ads
(0 . 0)(1 . 22)
285 with Interfaces; use Interfaces;
286 with Interfaces.C; use Interfaces.C;
287 with Ada.Unchecked_Deallocation;
288 with SMG_Keccak; use SMG_Keccak;
289 package Keccak_C is
290 subtype C_Context is Keccak_Context(Block_Len=>Default_Bitrate);
291 type C_Context_Access is access C_Context;
292 procedure C_Get_Size(Size: out Interfaces.C.size_t);
293 pragma Export (C, C_Get_Size, "keccak_get_ctx_byte_size");
294 function C_Begin return C_Context_Access;
295 pragma Export (C, C_Begin, "keccak_begin");
296 procedure C_Hash(Ctx: C_Context_Access;
297 Input: Interfaces.C.Char_Array;
298 Len: Interfaces.C.Size_T);
299 pragma Export (C, C_Hash, "keccak_hash");
300 procedure C_End(Ctx: C_Context_Access;
301 Output: out Interfaces.C.Char_Array;
302 Len: Interfaces.C.Size_T);
303 pragma Export (C, C_End, "keccak_end");
304 procedure C_Deallocate(Ctx: in out C_Context_Access);
305 pragma Export (C, C_Deallocate, "keccak_free");
306 end Keccak_C;
- 88E40423C88BA2AC7D44225B388794D61719746B02412E2DAE4684BCFA72399978D599F9301B4A2BE101B41769D3C5B20DE6FF94E76A01FF767EDC00746B8B96
+ 8F038C226BD823B585A5081ADBDBBF6A394C552875346AB9474C3A7679A8F7636704EB3230F0588FB250FB3A45D584E68A1DE7FE92EE209C91D2CDAA0FE3E217
vtools/src/smg_keccak.adb
(64 . 6)(64 . 75)
311 end; -- end squeeze stage
312 end Sponge;
313
314 -- public interface, state based Sponge
315 procedure KeccakBegin(Ctx : in out Keccak_Context) is
316 begin
317 Ctx.Internal := (others => (others => 0));
318 Ctx.Block := (others => 0);
319 Ctx.Pos := Ctx.Block'First;
320 end;
321
322 procedure KeccakHash(Ctx : in out Keccak_Context;
323 Input : Bitstream) is
324 I0 : Natural;
325 I1 : Natural;
326 B0 : Natural;
327 B1 : Natural;
328 begin
329 I0 := Input'First;
330 <<Block_Process_Loop>>
331 I1 := Input'Last;
332 B0 := Ctx.Pos;
333 B1 := B0 + (I1-I0);
334
335 if B1>Ctx.Block'Last then
336 B1 := Ctx.Block'Last;
337 I1 := I0 + (B1-B0);
338 end if;
339 Ctx.Block(B0..B1) := Input(I0..I1);
340 Ctx.Pos := B1 + 1;
341 -- we've filled up the buffer
342 if Ctx.Pos > Ctx.Block'Last then
343 AbsorbBlock(Ctx.Block, Ctx.Internal);
344 Ctx.Internal := Keccak_Function(Ctx.Internal);
345 Ctx.Pos := Ctx.Block'First;
346 end if;
347 -- we haven't processed entire input block, loop
348 if I1 < Input'Last then
349 I0 := I1 + 1;
350 goto Block_Process_Loop;
351 end if;
352 end;
353
354 procedure KeccakEnd(Ctx : in out Keccak_Context;
355 Output : out Bitstream) is
356 BlocksPerOutput : constant Natural := Output'Length / Ctx.Block_Len;
357 StrayPerOutput : constant Natural := Output'Length mod Ctx.Block_Len;
358 Block : Bitstream(1 .. Ctx.Block_Len);
359 Need : Natural;
360 begin
361 if Ctx.Pos /= 0 then -- needs padding
362 Block := (others => 0);
363 Need := Ctx.Block'Last - Ctx.Pos;
364 Block(Block'First) := 1;
365 Block(Block'First+Need) := 1;
366 KeccakHash(Ctx, Block(1..Need+1));
367 end if;
368
369 -- squeez bits
370 for I in 0 .. BlocksPerOutput - 1 loop
371 SqueezeBlock(Block, Ctx.Internal);
372 Output(Output'First + I * Ctx.Block_Len ..
373 Output'First + (I + 1) * Ctx.Block_Len -1) := Block;
374 Ctx.Internal := Keccak_Function(Ctx.Internal);
375 end loop;
376 if StrayPerOutput > 0 then
377 SqueezeBlock(Block, Ctx.Internal);
378 Output(Output'Last - StrayPerOutput + 1 .. Output'Last) :=
379 Block(Block'First .. Block'First + StrayPerOutput - 1);
380 end if;
381 end;
382
383 -- convert from a bitstream of ZWord size to an actual ZWord number
384 function BitsToWord( BWord: in Bitword ) return ZWord is
385 W : ZWord;
- 7503D06B8F87F1CD8A4246A7BAF27BA9431646E65F07FEA64173F24852BE71DC493C3E866D5C16F6723F80C6E6ED1479A46FAC9DEA5FDF02B0387724BDB99E08
+ 71BCA4B94AE6EA691D3A1FAF6C84AE5D17B803D11607E786C34E2711CABEB6921789AAE27A3A14B9B5CF5216A133EC2E8BD3B06EB1F2B88923F7E65297C2F5F4
vtools/src/smg_keccak.ads
(59 . 6)(59 . 20)
390 Output : out Bitstream;
391 Block_Len : in Keccak_Rate := Default_Bitrate );
392
393 -- state based Sponge
394 type Keccak_Context (Block_Len: Keccak_Rate := Default_Bitrate) is
395 record
396 Internal: State := (others => (others => 0));
397 Block: Bitstream(1..Block_Len) := (others => 0);
398 Pos: Natural;
399 end record;
400
401 procedure KeccakBegin(Ctx: in out Keccak_Context);
402 procedure KeccakHash(Ctx: in out Keccak_Context;
403 Input: Bitstream);
404 procedure KeccakEnd(Ctx: in out Keccak_Context;
405 Output: out Bitstream);
406
407 private
408 -- these are internals of the keccak implementation, not meant to be directly
409 -- accessed/used
-
+ 145A4C9BDC6DA1FAE51C1C4F8DA23F73DB1D7BADDD59B5E4D630E1DF2C8AC6E7FC00A37529A1F679FF68F57E60E495AC4360A7CB90C02A35093ED8A3D66FE696
vtools/vdiff.gpr
(0 . 0)(1 . 10)
414 project Vdiff is
415 for Languages use ("Ada", "C");
416 for Source_Dirs use ("src", "lib");
417 for Object_Dir use "obj";
418 for Exec_Dir use ".";
419 for Main use ("diff.c");
420 package Builder is
421 for Executable ("diff.c") use "vdiff";
422 end Builder;
423 end Vdiff;