adare_hqc256_0.2.3_bbba6749/src/adare_hqc256-hqc.ads

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
with Interfaces.C;

package Adare_Hqc256.hqc
  with Pure
is
  hqc_private_key_length  :   constant Interfaces.C.size_t;
  hqc_public_key_length   :   constant Interfaces.C.size_t;
  hqc_shared_key_length   :   constant Interfaces.C.size_t;
  hqc_ciphertext_length   :   constant Interfaces.C.size_t;


  type hqc_private_key is private
      with Preelaborable_Initialization;

  type hqc_public_key  is private
      with Preelaborable_Initialization;

  type hqc_shared_key  is private
      with Preelaborable_Initialization;

  type hqc_ciphertext  is private
      with Preelaborable_Initialization;


  function    get_hqc_private_key (from_key   :   aliased hqc_private_key)    return Interfaces.C.char_array;
  function    get_hqc_public_key  (from_key   :   aliased hqc_public_key) return Interfaces.C.char_array;
  function    get_hqc_shared_key  (from_key   :   aliased hqc_shared_key) return Interfaces.C.char_array;
  function    get_hqc_ciphertext  (from_ciphertext    :   aliased hqc_ciphertext) return Interfaces.C.char_array;

  procedure hqc_256_kem_keypair
      (public_key     :   out hqc_public_key;
        private_key    :   out hqc_private_key);

  procedure hqc_256_kem_encode
      (ciphertext     :   out hqc_ciphertext;
        shared_secret  :   out hqc_shared_key;
        public_key     :   aliased in hqc_public_key);

  procedure hqc_256_kem_decode
      (shared_secret  :   out hqc_shared_key;
        ciphertext     :   aliased in hqc_ciphertext;
        secret_key     :   aliased in hqc_private_key);

private

  hqc_private_key_length  :   constant Interfaces.C.size_t   :=  7317;
  hqc_public_key_length   :   constant Interfaces.C.size_t   :=  7245;
  hqc_shared_key_length   :   constant Interfaces.C.size_t   :=  64;
  hqc_ciphertext_length   :   constant Interfaces.C.size_t   :=  14421;

  type hqc_private_key is
      record
          val :   aliased Interfaces.C.char_array (1 .. hqc_private_key_length)    :=  (others => Interfaces.C.char'Val (0));
      end record;

  type hqc_public_key  is
      record
          val :   aliased Interfaces.C.char_array (1 .. hqc_public_key_length)    :=  (others =>  Interfaces.C.char'Val (0));
      end record;

  type hqc_shared_key  is
      record
          val :   aliased Interfaces.C.char_array (1 .. hqc_shared_key_length)  :=  (others =>  Interfaces.C.char'Val (0));
      end record;

  type hqc_ciphertext  is
      record
          val :   aliased Interfaces.C.char_array (1 .. hqc_ciphertext_length)   :=  (others =>  Interfaces.C.char'Val (0));
      end record;

end Adare_Hqc256.hqc;