Exemple #1
0
status_t pairing_init(void)
{
	int err_code = core_init();
	if(err_code != STS_OK) return ELEMENT_PAIRING_INIT_FAILED;

//	conf_print();
	pc_param_set_any(); // see if we can open this up?
	return ELEMENT_OK;
}
int start(int nodeID) {
	snprintf(thisID, 10, "%d", nodeID);

	core_init();
	if (pc_param_set_any() != STS_OK) {
		return 1;
	}

	/* Simulate PKG. The private key should be loaded statically in real deployments. */
	bn_init(&masterKey, BN_DIGS);
	bn_read_str(&masterKey, "123456789ABCDEF123456789ABCDEF123456789ABCDEF123456789ABCDEF", 64, 16);

	cp_sokaka_gen_prv(privateKey, thisID, strlen(thisID), &masterKey);
	printf("TinyPBC \t Private key received.\n");
	return 0;
}