1818
1919with Ada.Text_IO ;
2020with Crypto.Phelix.Test_Vectors ;
21- with Interfaces ;
2221
2322procedure Test_Phelix with
2423 SPARK_Mode => Off
6564 declare
6665 use type Crypto.Ciphertext_Stream;
6766 use type Crypto.Plaintext_Stream;
68- use type Interfaces.Unsigned_32 ;
67+ use type Crypto.Phelix.MAC_Size_32 ;
6968
7069 Mac_Len : constant Crypto.Phelix.MAC_Size_32 := 8 * T.MAC.all 'Length;
7170 This : Crypto.Phelix.Context;
@@ -133,8 +132,6 @@ begin
133132 end loop ;
134133
135134 declare
136- use type Crypto.Nonce_Stream;
137-
138135 KEY_LENGTH : constant := Crypto.Phelix.Max_Key_Size / 8 ;
139136 MAC_LENGTH : constant := Crypto.Phelix.Max_MAC_Size / 8 ;
140137 NONCE_LENGTH : constant := Crypto.Phelix.Max_Nonce_Size / 8 ;
@@ -148,6 +145,7 @@ begin
148145 use type Crypto.Byte;
149146 use type Crypto.Ciphertext_Stream;
150147 use type Crypto.Key_Stream;
148+ use type Crypto.Nonce_Stream;
151149 use type Crypto.Phelix.MAC_Size_32;
152150
153151 procedure Send_Nonce (Key : in Crypto.Key_Stream;
@@ -235,7 +233,7 @@ begin
235233 -- "Randomly" advance Nonce.
236234 for J in 1 .. Key (Key'First) loop
237235 for K in 1 .. Key (Key'First + 1 ) loop
238- Nonce := Nonce + Key (Key'Last );
236+ Nonce := Nonce + Crypto.Nonce_Stream ( Key (Key'First .. Key'First + 13 ) & ( 14 .. NONCE_LENGTH - 1 => 0 ) );
239237 end loop ;
240238 end loop ;
241239 end loop ;
0 commit comments