@@ -172,17 +172,18 @@ type Certificate struct {
172172type HostkeyKind uint
173173
174174const (
175- HostkeyMD5 HostkeyKind = C .GIT_CERT_SSH_MD5
176- HostkeySHA1 HostkeyKind = C .GIT_CERT_SSH_SHA1
175+ HostkeyMD5 HostkeyKind = C .GIT_CERT_SSH_MD5
176+ HostkeySHA1 HostkeyKind = C .GIT_CERT_SSH_SHA1
177+ HostkeySHA256 HostkeyKind = C .GIT_CERT_SSH_SHA256
177178)
178179
179- // Server host key information. If Kind is HostkeyMD5 the MD5 field
180- // will be filled. If Kind is HostkeySHA1, then HashSHA1 will be
181- // filled.
180+ // Server host key information. A bitmask containing the available fields.
181+ // Check for combinations of: HostkeyMD5, HostkeySHA1, HostkeySHA256.
182182type HostkeyCertificate struct {
183- Kind HostkeyKind
184- HashMD5 [16 ]byte
185- HashSHA1 [20 ]byte
183+ Kind HostkeyKind
184+ HashMD5 [16 ]byte
185+ HashSHA1 [20 ]byte
186+ HashSHA256 [32 ]byte
186187}
187188
188189type PushOptions struct {
@@ -318,6 +319,7 @@ func certificateCheckCallback(_cert *C.git_cert, _valid C.int, _host *C.char, da
318319 cert .Hostkey .Kind = HostkeyKind (ccert ._type )
319320 C .memcpy (unsafe .Pointer (& cert .Hostkey .HashMD5 [0 ]), unsafe .Pointer (& ccert .hash_md5 [0 ]), C .size_t (len (cert .Hostkey .HashMD5 )))
320321 C .memcpy (unsafe .Pointer (& cert .Hostkey .HashSHA1 [0 ]), unsafe .Pointer (& ccert .hash_sha1 [0 ]), C .size_t (len (cert .Hostkey .HashSHA1 )))
322+ C .memcpy (unsafe .Pointer (& cert .Hostkey .HashSHA256 [0 ]), unsafe .Pointer (& ccert .hash_sha256 [0 ]), C .size_t (len (cert .Hostkey .HashSHA256 )))
321323 } else {
322324 cstr := C .CString ("Unsupported certificate type" )
323325 C .giterr_set_str (C .GITERR_NET , cstr )
0 commit comments