Add the interface logic to support DH with KDF handling support.

The dh_compute code now allows the following options:

- no KDF support / output of raw DH shared secret:
  dh_compute <private> <prime> <base>

- KDF support without "other information" string:
  dh_compute_kdf <private> <prime> <base> <output length> <hash_type>

- KDF support with "other information string:
  dh_compute_kdf_oi <private> <prime> <base> <output length> <hash_type>
  where the OI string is provided on STDIN.

The test to verify the code is based on a test vector used for the CAVS
testing of SP800-56A.

Signed-off-by: Stephan Mueller <>
Signed-off-by: David Howells <>
9 files changed