1-- This program is free software; you can redistribute it and/or 2-- modify it under the terms of the GNU General Public License as 3-- published by the Free Software Foundation; either version 2 of the 4-- License, or (at your option) any later version. 5 6-- This program is distributed in the hope that it will be useful, 7-- but WITHOUT ANY WARRANTY; without even the implied warranty of 8-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 9-- General Public License for more details. 10 11-- You should have received a copy of the GNU General Public License 12-- along with this program; if not, write to the Free Software 13-- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 14-- 02111-1307, USA. 15 16-- As a special exception, if other files instantiate generics from 17-- this unit, or you link this unit with other files to produce an 18-- executable, this unit does not by itself cause the resulting 19-- executable to be covered by the GNU General Public License. This 20-- exception does not however invalidate any other reasons why the 21-- executable file might be covered by the GNU Public License. 22 23with Crypto.Types.Nonces; 24with Crypto.Types; 25 26generic 27 type Key_Type is private; 28 type Block is private; 29 30 with package N is new Crypto.Types.Nonces(Block); 31 32package Crypto.Symmetric.AE is 33 use Crypto.Types; 34 35 type AE_Scheme is limited interface; 36 type Callback_Writer is access procedure (B : in Bytes); 37-- type Callback_Reader is access function (B: out Bytes) return Natural; 38 type Callback_Reader is access procedure (B : out Bytes; Count: out Natural); 39 40 procedure Init_Encrypt(This : out AE_Scheme; 41 Key : in Key_Type; 42 Nonce : in out N.Nonce'Class) is abstract; 43 44 procedure Init_Decrypt(This : out AE_Scheme; 45 Key : in Key_Type; 46 Nonce_Value : in Block) is abstract; 47 48 procedure Encrypt(This : in out AE_Scheme; 49 Read_Plaintext : in Callback_Reader; 50 Write_Ciphertext : in Callback_Writer) is abstract; 51 52 function Decrypt_And_Verify(This : in out AE_Scheme; 53 Read_Ciphertext : in Callback_Reader; 54 Read_Ciphertext_Again : in Callback_Reader := null; 55 Write_Plaintext : in Callback_Writer) 56 return Boolean is abstract; 57 58 -- Invalid_Ciphertext_Error : exception; 59 Invalid_Header_Error : exception; 60 Invalid_Key_Length : exception; 61 62end Crypto.Symmetric.AE; 63