mirror of
https://github.com/eosswedenorg/libantelope
synced 2026-06-18 04:20:03 +02:00
Change namespace and header guards from libeosio to libantelope
This commit is contained in:
parent
0cfd459c71
commit
6824a2f49e
32 changed files with 176 additions and 176 deletions
|
|
@ -1,4 +1,4 @@
|
|||
#include <libeosio/ec.hpp>
|
||||
#include <libantelope/ec.hpp>
|
||||
#include <vector>
|
||||
#include <doctest.h>
|
||||
|
||||
|
|
@ -6,9 +6,9 @@ TEST_CASE("ec::ecdsa_sign") {
|
|||
|
||||
struct testcase {
|
||||
const char *name;
|
||||
libeosio::ec_privkey_t key;
|
||||
libeosio::ec_pubkey_t pub;
|
||||
libeosio::sha256_t dgst;
|
||||
libantelope::ec_privkey_t key;
|
||||
libantelope::ec_pubkey_t pub;
|
||||
libantelope::sha256_t dgst;
|
||||
};
|
||||
|
||||
std::vector<testcase> tests = {
|
||||
|
|
@ -92,24 +92,24 @@ TEST_CASE("ec::ecdsa_sign") {
|
|||
},
|
||||
};
|
||||
|
||||
libeosio::ec_init();
|
||||
libantelope::ec_init();
|
||||
|
||||
for(auto it = tests.begin(); it != tests.end(); it++) {
|
||||
SUBCASE(it->name) {
|
||||
libeosio::ec_signature_t result;
|
||||
libantelope::ec_signature_t result;
|
||||
|
||||
CHECK( libeosio::ecdsa_sign(it->key, &it->dgst, result) == 0 );
|
||||
CHECK( libantelope::ecdsa_sign(it->key, &it->dgst, result) == 0 );
|
||||
|
||||
// Need to use verify here as different implemententations produces different signatures.
|
||||
// (i have tested eosjs, eos-go and ofc libeosio)
|
||||
// (i have tested eosjs, eos-go and ofc libantelope)
|
||||
// However, the signatures are correct and can be validated by all implementations.
|
||||
//
|
||||
// Now, how do we know that ecdsa_verify is correct?
|
||||
// well, in escdsa_verify.cpp there are tests that checks hardcoded signatures generated by different implementations and should be fine.
|
||||
|
||||
CHECK( libeosio::ecdsa_verify(&it->dgst, result, it->pub) == 0);
|
||||
CHECK( libantelope::ecdsa_verify(&it->dgst, result, it->pub) == 0);
|
||||
}
|
||||
}
|
||||
libeosio::ec_shutdown();
|
||||
libantelope::ec_shutdown();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue