with Interfaces; use Interfaces; with Interfaces.C; use Interfaces.C; with Ada.Unchecked_Deallocation; with SMG_Keccak; use SMG_Keccak; package Keccak_C is subtype C_Context is Keccak_Context(Block_Len=>Default_Bitrate); type C_Context_Access is access C_Context; procedure C_Get_Size(Size: out Interfaces.C.size_t); pragma Export (C, C_Get_Size, "keccak_get_ctx_byte_size"); function C_Begin return C_Context_Access; pragma Export (C, C_Begin, "keccak_begin"); procedure C_Hash(Ctx: C_Context_Access; Input: Interfaces.C.Char_Array; Len: Interfaces.C.Size_T); pragma Export (C, C_Hash, "keccak_hash"); procedure C_End(Ctx: C_Context_Access; Output: out Interfaces.C.Char_Array; Len: Interfaces.C.Size_T); pragma Export (C, C_End, "keccak_end"); procedure C_Deallocate(Ctx: in out C_Context_Access); pragma Export (C, C_Deallocate, "keccak_free"); end Keccak_C;