Skip to content

Commit

Permalink
crypto: fix warning
Browse files Browse the repository at this point in the history
  • Loading branch information
aberaud committed Nov 4, 2024
1 parent 950194f commit 1aeb596
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/crypto.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1282,12 +1282,14 @@ Certificate::generate(const PrivateKey& key, const std::string& name, const Iden
if (not ca.second->isCA()) {
throw CryptoException("Signing certificate must be CA");
}
if (err = gnutls_x509_crt_privkey_sign(cert, ca.second->cert, ca.first->key, pk.getPreferredDigest(), 0)) {
err = gnutls_x509_crt_privkey_sign(cert, ca.second->cert, ca.first->key, pk.getPreferredDigest(), 0);
if (err) {
throw CryptoException(std::string("Error when signing certificate ") + gnutls_strerror(err));
}
ret.issuer = ca.second;
} else {
if (err = gnutls_x509_crt_privkey_sign(cert, cert, key.key, pk.getPreferredDigest(), 0)) {
err = gnutls_x509_crt_privkey_sign(cert, cert, key.key, pk.getPreferredDigest(), 0);
if (err) {
throw CryptoException(std::string("Error when signing certificate ") + gnutls_strerror(err));
}
}
Expand Down

0 comments on commit 1aeb596

Please sign in to comment.