diff options
author | Carlos Martín Nieto <cmn@dwim.me> | 2014-09-16 03:22:09 +0200 |
---|---|---|
committer | Carlos Martín Nieto <cmn@dwim.me> | 2014-09-16 17:02:33 +0200 |
commit | 1e0aa105faff1bd6987665506037f299b8e0e1cb (patch) | |
tree | 0e2597dda7b4b0dfc8bf1050f2abd2479b973fdc /include/git2/transport.h | |
parent | 286369a81fc2e1d77a7a134d5c140f023af1298b (diff) | |
download | libgit2-1e0aa105faff1bd6987665506037f299b8e0e1cb.tar.gz |
ssh: expose both hashes
The user may have the data hashed as MD5 or SHA-1, so we should provide
both types for consumption.
Diffstat (limited to 'include/git2/transport.h')
-rw-r--r-- | include/git2/transport.h | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/include/git2/transport.h b/include/git2/transport.h index 6c568be65..39df479c7 100644 --- a/include/git2/transport.h +++ b/include/git2/transport.h @@ -24,11 +24,11 @@ GIT_BEGIN_DECL * Type of SSH host fingerprint */ typedef enum { - /** MD5, 16 bytes */ - GIT_CERT_SSH_MD5, - /** SHA-1, 20 bytes */ - GIT_CERT_SSH_SHA1, -} git_cert_ssh_type ; + /** MD5 is available */ + GIT_CERT_SSH_MD5 = (1 << 0), + /** SHA-1 is available */ + GIT_CERT_SSH_SHA1 = (1 << 1), +} git_cert_ssh_t; /** * Hostkey information taken from libssh2 @@ -43,12 +43,19 @@ typedef struct { * A hostkey type from libssh2, either * `GIT_CERT_SSH_MD5` or `GIT_CERT_SSH_SHA1` */ - git_cert_ssh_type type; + git_cert_ssh_t type; + + /** + * Hostkey hash. If type has `GIT_CERT_SSH_MD5` set, this will + * have the MD5 hash of the hostkey. + */ + unsigned char hash_md5[16]; + /** - * Hostkey hash. If the type is MD5, only the first 16 bytes - * will be set. + * Hostkey hash. If type has `GIT_CERT_SSH_SHA1` set, this will + * have the SHA-1 hash of the hostkey. */ - unsigned char hash[20]; + unsigned char hash_sha1[20]; } git_cert_hostkey; /** |