Browse Source

Sign media test fixtures with the derived Ed25519 seeds

master
evgeny 2 days ago
parent
commit
3d6f9c1be4
  1. 9
      tests/test_dm_media.c

9
tests/test_dm_media.c

@ -100,7 +100,7 @@ static int setup(struct media_test* t) {
uint8_t msg[512], join[64], adm_sig[64];
uint64_t ts = ntp_time_get_seconds(inst);
int n = member_sync_build_join_msg(t->ch_x, t->ch_ed, t->ids[j], t->keys[j].public_key, ts, msg, sizeof(msg));
if (n < 0 || sc_ed25519_sign(t->keys[j].private_key, msg, (size_t)n, join) != SC_OK) return -1;
if (n < 0 || sc_ed25519_sign(t->nodes[j]->my_ed25519_privkey, msg, (size_t)n, join) != SC_OK) return -1;
const char* tags = j == S ? "{\"supernode\":\"yes\",\"ver\":\"1\"}" :
j == M ? "{\"storage\":\"yes\",\"ver\":\"1\"}" : "{\"ver\":\"1\"}";
size_t off = strlen(tags);
@ -273,8 +273,11 @@ int main(void) {
}
struct SC_MYKEYS channel;
if (sc_generate_keypair(&channel)) return 1;
memcpy(t.ch_x, channel.public_key, 32); memcpy(t.ch_priv, channel.private_key, 32);
if (sc_derive_ed25519_pubkey(t.ch_priv, t.ch_ed)) return 1;
memcpy(t.ch_x, channel.public_key, 32);
if (sc_derive_ed25519_pubkey(channel.private_key, t.ch_ed)) return 1;
uint8_t channel_seed[SHA512_DIGEST_LENGTH];
SHA512(channel.private_key, 32, channel_seed);
memcpy(t.ch_priv, channel_seed, 32);
uint8_t signed_channel[256];
size_t off = sizeof(CHANNEL);
memcpy(signed_channel, CHANNEL, off);

Loading…
Cancel
Save