Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
git2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
git2
Commits
0b5540b9
Unverified
Commit
0b5540b9
authored
Nov 28, 2019
by
Patrick Steinhardt
Committed by
GitHub
Nov 28, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #5307 from palmin/hash_sha256
ssh: include sha256 host key hash when supported
parents
dfea0713
48c3f7e1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
0 deletions
+16
-0
include/git2/cert.h
+8
-0
src/transports/ssh.c
+8
-0
No files found.
include/git2/cert.h
View file @
0b5540b9
...
@@ -78,6 +78,8 @@ typedef enum {
...
@@ -78,6 +78,8 @@ typedef enum {
GIT_CERT_SSH_MD5
=
(
1
<<
0
),
GIT_CERT_SSH_MD5
=
(
1
<<
0
),
/** SHA-1 is available */
/** SHA-1 is available */
GIT_CERT_SSH_SHA1
=
(
1
<<
1
),
GIT_CERT_SSH_SHA1
=
(
1
<<
1
),
/** SHA-256 is available */
GIT_CERT_SSH_SHA256
=
(
1
<<
2
),
}
git_cert_ssh_t
;
}
git_cert_ssh_t
;
/**
/**
...
@@ -103,6 +105,12 @@ typedef struct {
...
@@ -103,6 +105,12 @@ typedef struct {
* have the SHA-1 hash of the hostkey.
* have the SHA-1 hash of the hostkey.
*/
*/
unsigned
char
hash_sha1
[
20
];
unsigned
char
hash_sha1
[
20
];
/**
* Hostkey hash. If type has `GIT_CERT_SSH_SHA256` set, this will
* have the SHA-256 hash of the hostkey.
*/
unsigned
char
hash_sha256
[
32
];
}
git_cert_hostkey
;
}
git_cert_hostkey
;
/**
/**
...
...
src/transports/ssh.c
View file @
0b5540b9
...
@@ -566,6 +566,14 @@ post_extract:
...
@@ -566,6 +566,14 @@ post_extract:
cert
.
parent
.
cert_type
=
GIT_CERT_HOSTKEY_LIBSSH2
;
cert
.
parent
.
cert_type
=
GIT_CERT_HOSTKEY_LIBSSH2
;
#ifdef LIBSSH2_HOSTKEY_HASH_SHA256
key
=
libssh2_hostkey_hash
(
session
,
LIBSSH2_HOSTKEY_HASH_SHA256
);
if
(
key
!=
NULL
)
{
cert
.
type
|=
GIT_CERT_SSH_SHA256
;
memcpy
(
&
cert
.
hash_sha256
,
key
,
32
);
}
#endif
key
=
libssh2_hostkey_hash
(
session
,
LIBSSH2_HOSTKEY_HASH_SHA1
);
key
=
libssh2_hostkey_hash
(
session
,
LIBSSH2_HOSTKEY_HASH_SHA1
);
if
(
key
!=
NULL
)
{
if
(
key
!=
NULL
)
{
cert
.
type
|=
GIT_CERT_SSH_SHA1
;
cert
.
type
|=
GIT_CERT_SSH_SHA1
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment