Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unit_tests: use valid key images, pub keys, etc #4186

Merged
merged 1 commit into from
Aug 15, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions tests/unit_tests/ringdb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,25 +39,29 @@
#include "crypto/crypto.h"
#include "crypto/random.h"
#include "crypto/chacha.h"
#include "ringct/rctOps.h"
#include "cryptonote_basic/cryptonote_basic.h"
#include "wallet/ringdb.h"

static crypto::chacha_key generate_chacha_key()
{
uint8_t key[CHACHA_KEY_SIZE];
crypto::rand(CHACHA_KEY_SIZE, key);
crypto::chacha_key chacha_key;
memcpy(&chacha_key, key, CHACHA_KEY_SIZE);
uint64_t password = crypto::rand<uint64_t>();
crypto::generate_chacha_key(std::string((const char*)&password, sizeof(password)), chacha_key);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

appears to be missing the number of KDF rounds which breaks test

return chacha_key;
}

static crypto::key_image generate_key_image()
{
return crypto::rand<crypto::key_image>();
crypto::key_image key_image;
cryptonote::keypair keypair = cryptonote::keypair::generate(hw::get_device("default"));
crypto::generate_key_image(keypair.pub, keypair.sec, key_image);
return key_image;
}

static crypto::public_key generate_output()
{
return crypto::rand<crypto::public_key>();
return rct::rct2pk(rct::scalarmultBase(rct::skGen()));
}


Expand Down