Skip to content

Commit

Permalink
Fix Ursa crypto provider crashes on errors
Browse files Browse the repository at this point in the history
Signed-off-by: Andrei Lebedev <lebdron@gmail.com>
  • Loading branch information
lebdron committed Sep 11, 2019
1 parent 435c929 commit 4af3143
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ namespace shared_model {
if (!ursa_ed25519_sign(&kMessage, &kPrivateKey, &signature, &err)) {
// handle error
ursa_ed25519_string_free(err.message);
};
return Signed{""};
}

Signed result(std::string((const std::string::value_type *)signature.data,
signature.len));
Expand Down Expand Up @@ -67,7 +68,8 @@ namespace shared_model {
if (!ursa_ed25519_keypair_new(&public_key, &private_key, &err)) {
// handle error
ursa_ed25519_string_free(err.message);
};
return Keypair{PublicKey{""}, PrivateKey{""}};
}

Keypair result(PublicKey(std::string(
(const std::string::value_type *)public_key.data,
Expand All @@ -94,7 +96,8 @@ namespace shared_model {
&kSeed, &public_key, &private_key, &err)) {
// handle error
ursa_ed25519_string_free(err.message);
};
return Keypair{PublicKey{""}, PrivateKey{""}};
}

Keypair result(PublicKey(std::string(
(const std::string::value_type *)public_key.data,
Expand Down

0 comments on commit 4af3143

Please sign in to comment.