Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
opendht
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
savoirfairelinux
opendht
Commits
bd9496e2
Commit
bd9496e2
authored
7 years ago
by
Adrien Béraud
Browse files
Options
Downloads
Patches
Plain Diff
crypto: fix build on GnuTLS 3.3
parent
4d4ba2be
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/crypto.cpp
+6
-0
6 additions, 0 deletions
src/crypto.cpp
with
6 additions
and
0 deletions
src/crypto.cpp
+
6
−
0
View file @
bd9496e2
...
@@ -538,7 +538,11 @@ PublicKey::getId() const
...
@@ -538,7 +538,11 @@ PublicKey::getId() const
return
{};
return
{};
InfoHash
id
;
InfoHash
id
;
size_t
sz
=
id
.
size
();
size_t
sz
=
id
.
size
();
#if GNUTLS_VERSION_NUMBER < 0x030401
const
int
flags
=
0
;
#else
const
int
flags
=
(
id
.
size
()
==
32
)
?
GNUTLS_KEYID_USE_SHA256
:
0
;
const
int
flags
=
(
id
.
size
()
==
32
)
?
GNUTLS_KEYID_USE_SHA256
:
0
;
#endif
if
(
auto
err
=
gnutls_pubkey_get_key_id
(
pk
,
flags
,
id
.
data
(),
&
sz
))
if
(
auto
err
=
gnutls_pubkey_get_key_id
(
pk
,
flags
,
id
.
data
(),
&
sz
))
throw
CryptoException
(
std
::
string
(
"Can't get public key ID: "
)
+
gnutls_strerror
(
err
));
throw
CryptoException
(
std
::
string
(
"Can't get public key ID: "
)
+
gnutls_strerror
(
err
));
if
(
sz
!=
id
.
size
())
if
(
sz
!=
id
.
size
())
...
@@ -1287,8 +1291,10 @@ std::ostream& operator<< (std::ostream& o, const TrustList::VerifyResult& h)
...
@@ -1287,8 +1291,10 @@ std::ostream& operator<< (std::ostream& o, const TrustList::VerifyResult& h)
o
<<
"* Certificate has expired"
<<
std
::
endl
;
o
<<
"* Certificate has expired"
<<
std
::
endl
;
if
(
h
.
result
&
GNUTLS_CERT_UNEXPECTED_OWNER
)
if
(
h
.
result
&
GNUTLS_CERT_UNEXPECTED_OWNER
)
o
<<
"* The owner is not the expected one"
<<
std
::
endl
;
o
<<
"* The owner is not the expected one"
<<
std
::
endl
;
#if GNUTLS_VERSION_NUMBER >= 0x030401
if
(
h
.
result
&
GNUTLS_CERT_PURPOSE_MISMATCH
)
if
(
h
.
result
&
GNUTLS_CERT_PURPOSE_MISMATCH
)
o
<<
"* Certificate or an intermediate does not match the intended purpose"
<<
std
::
endl
;
o
<<
"* Certificate or an intermediate does not match the intended purpose"
<<
std
::
endl
;
#endif
if
(
h
.
result
&
GNUTLS_CERT_MISMATCH
)
if
(
h
.
result
&
GNUTLS_CERT_MISMATCH
)
o
<<
"* Certificate presented isn't the expected one"
<<
std
::
endl
;
o
<<
"* Certificate presented isn't the expected one"
<<
std
::
endl
;
}
else
{
}
else
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment