tree checksum vpatch file split hunks
all signers: phf
antecedents: vdiff_keccak
press order:
vtools_genesis | phf |
vdiff_fixes_newline_gcc | phf |
keccak | phf |
vdiff_keccak | phf |
vtools_fixes_bitrate_char_array | phf |
patch:
(2 . 3)(2 . 4)
5 511300 phf vdiff_fixes_newline_gcc Fixes for C99 compatability, support for "No newline at end of file" directive.
6 511300 phf keccak Included diana_coman's keccak implementation.
7 511300 phf vdiff_keccak Vdiff hashing and output using Keccak instead of SHA512.
8 512600 phf vtools_fixes_bitrate_char_array Fixes for keccak from diana_coman, different approach to C interop.
- 680EFB9458A976F700A689A6B0678510172945E94D35207F07BEA280BB87B30EDC889968FBF6C922C8CC5C79B9193986AB66037CC36F47D52B49E91826C22FE4(54 . 28)(54 . 41)
13 end C_Begin;
14
15 procedure C_Hash(Ctx: in C_Context_Access;
16 Input: Interfaces.C.Char_Array;
17 Len: Interfaces.C.Size_T) is
18 Input: Char_Star;
19 Len: Interfaces.C.size_t) is
20 L: Natural := Natural(Len);
21 S: String(1..L);
22 B: Bitstream(1..S'Length*8);
23 Ptr: Char_Star := Input;
24 begin
25 Interfaces.C.To_Ada(Input, S, L, Trim_Nul => False);
26 if Input = null then
27 raise C.Strings.Dereference_Error;
28 end if;
29 for Chr of S loop
30 Chr := Character(Ptr.all);
31 Char_Ptrs.Increment(Ptr);
32 end loop;
33 ToBitstream(S, B);
34 KeccakHash(Ctx.all, B);
35 end C_Hash;
36
37 procedure C_End(Ctx: C_Context_Access;
38 Output: out Interfaces.C.Char_Array;
39 Output: Char_Star;
40 Len: Interfaces.C.Size_T) is
41 L: Natural := Natural(Len);
42 S: String(1..L);
43 B: Bitstream(1..S'Length*8);
44 Count: Interfaces.C.Size_T;
45 Ptr: Char_Star := Output;
46 begin
47 if Output = null then
48 raise C.Strings.Dereference_Error;
49 end if;
50 KeccakEnd(Ctx.all, B);
51 ToString(B, S);
52 Interfaces.C.To_C(S, Output(0..Len), Count, Append_Nul => False);
53 for Chr of S loop
54 Ptr.all := Interfaces.C.char(Chr);
55 Char_Ptrs.Increment(Ptr);
56 end loop;
57 -- Len = Count
58 end C_End;
59
- 33D0A8BFAC503D941796252636419DFBC9917D9D67C2E15E13E85083AFB8ED46CDE57452B61EF275CCFDE07B7891D510467B49868882248A5836BCE52EF7A7D0(1 . 8)(1 . 17)- 8F038C226BD823B585A5081ADBDBBF6A394C552875346AB9474C3A7679A8F7636704EB3230F0588FB250FB3A45D584E68A1DE7FE92EE209C91D2CDAA0FE3E217
64 with Interfaces; use Interfaces;
65 with Interfaces.C; use Interfaces.C;
66 with Interfaces.C.Strings;
67 with Interfaces.C.Pointers;
68 with Ada.Unchecked_Deallocation;
69 with SMG_Keccak; use SMG_Keccak;
70 package Keccak_C is
71 package Char_Ptrs is
72 new Interfaces.C.Pointers (Index => size_t,
73 Element => char,
74 Element_Array => char_array,
75 Default_Terminator => nul);
76 use type Char_Ptrs.Pointer;
77 subtype Char_Star is Char_Ptrs.Pointer;
78 subtype C_Context is Keccak_Context(Block_Len=>Default_Bitrate);
79 type C_Context_Access is access C_Context;
80 procedure C_Get_Size(Size: out Interfaces.C.size_t);
(10 . 11)(19 . 11)
82 function C_Begin return C_Context_Access;
83 pragma Export (C, C_Begin, "keccak_begin");
84 procedure C_Hash(Ctx: C_Context_Access;
85 Input: Interfaces.C.Char_Array;
86 Input: Char_Star;
87 Len: Interfaces.C.Size_T);
88 pragma Export (C, C_Hash, "keccak_hash");
89 procedure C_End(Ctx: C_Context_Access;
90 Output: out Interfaces.C.Char_Array;
91 Output: Char_Star;
92 Len: Interfaces.C.Size_T);
93 pragma Export (C, C_End, "keccak_end");
94 procedure C_Deallocate(Ctx: in out C_Context_Access);
(217 . 7)(217 . 7)
99 ToPos := Block'Last;
100 FromPos := ToPos - SBB + 1;
101 BWord := (others => 0);
102 BWord(Bitword'First .. Bitword'First + SBB - 1) := Block(ToPos..FromPos);
103 BWord(Bitword'First .. Bitword'First + SBB - 1) := Block(FromPos..ToPos);
104 Word := BitsToWord( BWord );
105 S( X, Y ) := S( X, Y ) xor Word;
106 end if;