diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/git2/transport.h | 24 | ||||
-rw-r--r-- | include/git2/types.h | 14 |
2 files changed, 35 insertions, 3 deletions
diff --git a/include/git2/transport.h b/include/git2/transport.h index 06d090f4a..4fa637292 100644 --- a/include/git2/transport.h +++ b/include/git2/transport.h @@ -24,6 +24,11 @@ GIT_BEGIN_DECL * Hostkey information taken from libssh2 */ typedef struct { + /** + * Type of certificate. Here to share the header with + * `git_cert`. + */ + git_cert_t cert_type; /** * A hostkey type from libssh2, either * `LIBSSH2_HOSTKEY_HASH_MD5` or `LIBSSH2_HOSTKEY_HASH_SHA1` @@ -36,6 +41,25 @@ typedef struct { unsigned char hash[20]; } git_cert_hostkey; +/** + * X.509 certificate information + */ +typedef struct { + /** + * Type of certificate. Here to share the header with + * `git_cert`. + */ + git_cert_t cert_type; + /** + * Pointer to the X.509 certificate data + */ + void *data; + /** + * Length of the memory block pointed to by `data`. + */ + size_t len; +} git_cert_x509; + /* *** Begin interface for credentials acquisition *** */ diff --git a/include/git2/types.h b/include/git2/types.h index 3544037a4..7ee7cc344 100644 --- a/include/git2/types.h +++ b/include/git2/types.h @@ -253,8 +253,6 @@ typedef int (*git_transfer_progress_cb)(const git_transfer_progress *stats, void */ typedef int (*git_transport_message_cb)(const char *str, int len, void *payload); - - /** * Type of host certificate structure that is passed to the check callback */ @@ -272,6 +270,16 @@ typedef enum git_cert_t { } git_cert_t; /** + * Parent type for `git_cert_hostkey` and `git_cert_x509`. + */ +typedef struct { + /** + * Type of certificate. A `GIT_CERT_` value. + */ + git_cert_t cert_type; +} git_cert; + +/** * Callback for the user's custom certificate checks. * * @param type The type of certificate or host info, SSH or X.509 @@ -281,7 +289,7 @@ typedef enum git_cert_t { * this certificate is valid * @param payload Payload provided by the caller */ -typedef int (*git_transport_certificate_check_cb)(git_cert_t type, void *data, size_t len, int valid, void *payload); +typedef int (*git_transport_certificate_check_cb)(git_cert *cert, int valid, void *payload); /** * Opaque structure representing a submodule. |