sshkdf.h

All headers

SSH-specific KDF

This KDF should only be called from SSH client/server code; it's not a general-purpose KDF and is only Approved for FIPS 140-3 use specifically in SSH.

  1. The following defines are the valid type values for SSHKDF()
  2. EVP_KDF_SSHKDF_TYPE_INITIAL_IV_CLI_TO_SRV
  3. EVP_KDF_SSHKDF_TYPE_INITIAL_IV_SRV_TO_CLI
  4. EVP_KDF_SSHKDF_TYPE_ENCRYPTION_KEY_CLI_TO_SRV
  5. EVP_KDF_SSHKDF_TYPE_ENCRYPTION_KEY_SRV_TO_CLI
  6. EVP_KDF_SSHKDF_TYPE_INTEGRITY_KEY_CLI_TO_SRV
  7. EVP_KDF_SSHKDF_TYPE_INTEGRITY_KEY_SRV_TO_CLI
  8. SSHKDF

The following defines are the valid type values for SSHKDF().

#define EVP_KDF_SSHKDF_TYPE_INITIAL_IV_CLI_TO_SRV     65
#define EVP_KDF_SSHKDF_TYPE_INITIAL_IV_SRV_TO_CLI     66
#define EVP_KDF_SSHKDF_TYPE_ENCRYPTION_KEY_CLI_TO_SRV 67
#define EVP_KDF_SSHKDF_TYPE_ENCRYPTION_KEY_SRV_TO_CLI 68
#define EVP_KDF_SSHKDF_TYPE_INTEGRITY_KEY_CLI_TO_SRV  69
#define EVP_KDF_SSHKDF_TYPE_INTEGRITY_KEY_SRV_TO_CLI  70

SSHKDF is a key derivation function used in the SSH Transport Layer Protocol defined in Section 7.2 of RFC 4253. It calculates a derived key out of length out_len bytes using evp_md hash algorithm from the supplied shared secret key, hash value xcghash and session identifier session_id. It returns one on success and zero on error.

xcghash is produced during the SSH Diffie-Hellman exchange.

SSHKDF is only FIPS 140-3 Approved for use in SSH.

OPENSSL_EXPORT int SSHKDF(const EVP_MD *evp_md,
                          const uint8_t *key, size_t key_len,
                          const uint8_t *xcghash, size_t xcghash_len,
                          const uint8_t *session_id, size_t session_id_len,
                          char type,
                          uint8_t *out, size_t out_len);