HMAC-based Extract-and-Expand Key Derivation Function (RFC 5869)
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

hkdf: split runner, lowercase suite name, doc periods (E600/E410)

- Move Alcotest.run from test_hkdf.ml into a new test.ml runner; expose
test_hkdf.ml's cases via [Test_hkdf.suite] (E600).
- Rename the suite from "HKDF-SHA256 vectors" to all-lowercase to match
merlint's suite-name convention.
- Add trailing period to the extract / expand return-value docs (E410).

+16 -16
+2 -2
lib/hkdf.mli
··· 16 16 17 17 @param salt Optional salt (can be empty; defaults to hash-length zeros) 18 18 @param ikm Input keying material (should be high entropy) 19 - @return Pseudorandom key (PRK) of hash output length *) 19 + @return Pseudorandom key (PRK) of hash output length. *) 20 20 21 21 val expand : hash:hash -> prk:bytes -> info:bytes -> len:int -> bytes 22 22 (** [expand ~hash ~prk ~info ~len] expands PRK to [len] bytes. ··· 24 24 @param prk Pseudorandom key from [extract] 25 25 @param info Context/application-specific info (can be empty) 26 26 @param len Desired output length (max 255 * hash_len) 27 - @raise Invalid_argument if [len] exceeds maximum *) 27 + @raise Invalid_argument if [len] exceeds maximum. *) 28 28 29 29 val derive : 30 30 hash:hash -> salt:bytes -> ikm:bytes -> info:bytes -> len:int -> bytes
+1 -1
test/dune
··· 1 1 (test 2 - (name test_hkdf) 2 + (name test) 3 3 (libraries hkdf alcotest))
+1
test/test.ml
··· 1 + let () = Alcotest.run "HKDF" [ Test_hkdf.suite ]
+10 -13
test/test_hkdf.ml
··· 109 109 Alcotest.(check string) 110 110 (v.name ^ " derive") (hex_of_bytes v.okm) (hex_of_bytes okm) 111 111 112 - let () = 113 - Alcotest.run "HKDF" 114 - [ 115 - ( "HKDF-SHA256 vectors", 116 - List.concat_map 117 - (fun v -> 118 - [ 119 - Alcotest.test_case (v.name ^ " extract") `Quick (test_extract v); 120 - Alcotest.test_case (v.name ^ " expand") `Quick (test_expand v); 121 - Alcotest.test_case (v.name ^ " derive") `Quick (test_derive v); 122 - ]) 123 - all_sha256_vectors ); 124 - ] 112 + let suite = 113 + ( "hkdf-sha256 vectors", 114 + List.concat_map 115 + (fun v -> 116 + [ 117 + Alcotest.test_case (v.name ^ " extract") `Quick (test_extract v); 118 + Alcotest.test_case (v.name ^ " expand") `Quick (test_expand v); 119 + Alcotest.test_case (v.name ^ " derive") `Quick (test_derive v); 120 + ]) 121 + all_sha256_vectors )
+2
test/test_hkdf.mli
··· 1 + val suite : string * unit Alcotest.test_case list 2 + (** Test suite. *)