mirror of
https://github.com/eosswedenorg/libantelope
synced 2026-06-18 12:30:02 +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_recover") {
|
|||
|
||||
struct testcase {
|
||||
const char *name;
|
||||
libeosio::sha256_t dgst;
|
||||
libeosio::ec_signature_t sig;
|
||||
libeosio::ec_pubkey_t expected;
|
||||
libantelope::sha256_t dgst;
|
||||
libantelope::ec_signature_t sig;
|
||||
libantelope::ec_pubkey_t expected;
|
||||
int expectedRet;
|
||||
};
|
||||
|
||||
|
|
@ -85,19 +85,19 @@ TEST_CASE("ec::ecdsa_recover") {
|
|||
},
|
||||
};
|
||||
|
||||
libeosio::ec_init();
|
||||
libantelope::ec_init();
|
||||
|
||||
for(auto it = tests.begin(); it != tests.end(); it++) {
|
||||
SUBCASE(it->name) {
|
||||
libeosio::ec_pubkey_t result;
|
||||
libantelope::ec_pubkey_t result;
|
||||
|
||||
CHECK( libeosio::ecdsa_recover(&it->dgst, it->sig, result) == it->expectedRet );
|
||||
CHECK( libantelope::ecdsa_recover(&it->dgst, it->sig, result) == it->expectedRet );
|
||||
|
||||
if (it->expectedRet == 0) {
|
||||
CHECK( result == it->expected );
|
||||
}
|
||||
}
|
||||
}
|
||||
libeosio::ec_shutdown();
|
||||
libantelope::ec_shutdown();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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_verify") {
|
|||
|
||||
struct testcase {
|
||||
const char *name;
|
||||
libeosio::sha256_t dgst;
|
||||
libeosio::ec_pubkey_t pubkey;
|
||||
libeosio::ec_signature_t sig;
|
||||
libantelope::sha256_t dgst;
|
||||
libantelope::ec_pubkey_t pubkey;
|
||||
libantelope::ec_signature_t sig;
|
||||
int expected;
|
||||
};
|
||||
|
||||
|
|
@ -176,14 +176,14 @@ TEST_CASE("ec::ecdsa_verify") {
|
|||
},
|
||||
};
|
||||
|
||||
libeosio::ec_init();
|
||||
libantelope::ec_init();
|
||||
|
||||
for(auto it = tests.begin(); it != tests.end(); it++) {
|
||||
SUBCASE(it->name) {
|
||||
CHECK( libeosio::ecdsa_verify(&it->dgst, it->sig, it->pubkey) == it->expected );
|
||||
CHECK( libantelope::ecdsa_verify(&it->dgst, it->sig, it->pubkey) == it->expected );
|
||||
}
|
||||
}
|
||||
|
||||
libeosio::ec_shutdown();
|
||||
libantelope::ec_shutdown();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,18 +1,18 @@
|
|||
#include <libeosio/ec.hpp>
|
||||
#include <libantelope/ec.hpp>
|
||||
#include <doctest.h>
|
||||
|
||||
TEST_CASE("ec::generate") {
|
||||
|
||||
libeosio::ec_init();
|
||||
libantelope::ec_init();
|
||||
|
||||
libeosio::ec_pubkey_t result;
|
||||
libeosio::ec_keypair pair;
|
||||
CHECK(libeosio::ec_generate_key(&pair) == 0);
|
||||
libantelope::ec_pubkey_t result;
|
||||
libantelope::ec_keypair pair;
|
||||
CHECK(libantelope::ec_generate_key(&pair) == 0);
|
||||
|
||||
// Can't test much because... well the private key should be random :)
|
||||
// But alteast verify that the public key belongs to the private key.
|
||||
CHECK(libeosio::ec_get_publickey(&pair.secret, &result) == 0);
|
||||
CHECK(libantelope::ec_get_publickey(&pair.secret, &result) == 0);
|
||||
CHECK( result == pair.pub );
|
||||
|
||||
libeosio::ec_shutdown();
|
||||
libantelope::ec_shutdown();
|
||||
}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
#include <libeosio/ec.hpp>
|
||||
#include <libeosio/WIF.hpp>
|
||||
#include <libantelope/ec.hpp>
|
||||
#include <libantelope/WIF.hpp>
|
||||
#include <vector>
|
||||
#include <doctest.h>
|
||||
|
||||
|
|
@ -8,8 +8,8 @@ TEST_CASE("ec::pubkey") {
|
|||
|
||||
struct testcase {
|
||||
std::string name;
|
||||
libeosio::ec_privkey_t priv;
|
||||
libeosio::ec_pubkey_t expected;
|
||||
libantelope::ec_privkey_t priv;
|
||||
libantelope::ec_pubkey_t expected;
|
||||
};
|
||||
|
||||
std::vector<struct testcase> tests {
|
||||
|
|
@ -125,16 +125,16 @@ TEST_CASE("ec::pubkey") {
|
|||
}
|
||||
};
|
||||
|
||||
libeosio::ec_init();
|
||||
libantelope::ec_init();
|
||||
|
||||
for(auto it = tests.begin(); it != tests.end(); it++) {
|
||||
|
||||
SUBCASE(it->name.c_str()) {
|
||||
libeosio::ec_pubkey_t result;
|
||||
CHECK( libeosio::ec_get_publickey(&it->priv, &result) == 0 );
|
||||
libantelope::ec_pubkey_t result;
|
||||
CHECK( libantelope::ec_get_publickey(&it->priv, &result) == 0 );
|
||||
CHECK( result == it->expected );
|
||||
}
|
||||
}
|
||||
|
||||
libeosio::ec_shutdown();
|
||||
libantelope::ec_shutdown();
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue