diff options
Diffstat (limited to 'src/Signature.cpp')
-rw-r--r-- | src/Signature.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/Signature.cpp b/src/Signature.cpp index 8d3654d..34f6190 100644 --- a/src/Signature.cpp +++ b/src/Signature.cpp @@ -42,7 +42,7 @@ namespace odhtdb string result; result.resize(signedMessage.size - SIGNED_HASH_SIZE); - if(crypto_sign_ed25519_open((unsigned char*)&result[0], nullptr, (const unsigned char*)signedMessage.data, signedMessage.size, (unsigned char*)data) != 0) + if(crypto_sign_ed25519_open((unsigned char*)&result[0], nullptr, (const unsigned char*)signedMessage.data, signedMessage.size, (unsigned char*)data) < 0) throw UnsignWrongKeyException("Message was not signed with matching private key"); return result; @@ -86,7 +86,7 @@ namespace odhtdb result.resize(crypto_sign_ed25519_BYTES + dataToSign.size); unsigned long long resultSize; - if(crypto_sign_ed25519((unsigned char*)&result[0], &resultSize, (unsigned char*)dataToSign.data, dataToSign.size, (unsigned char*)data) != 0) + if(crypto_sign_ed25519((unsigned char*)&result[0], &resultSize, (unsigned char*)dataToSign.data, dataToSign.size, (unsigned char*)data) < 0) throw DataSignException("Failed to sign data. Is private key invalid?"); if(resultSize != result.size()) @@ -105,7 +105,7 @@ namespace odhtdb KeyPair::KeyPair() { - if(crypto_sign_ed25519_keypair((unsigned char*)publicKey.data, (unsigned char*)privateKey.data) != 0) + if(crypto_sign_ed25519_keypair((unsigned char*)publicKey.data, (unsigned char*)privateKey.data) < 0) throw SignatureGenerationException("Failed to generate signature keypair"); } } |