nRF9160DK Keccak256 ECDSA SAMPLE

Hello!
We are trying to sign our data using ECDSA (https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/samples/crypto/ecdsa/README.html), so we can send our information to an Ethereum Blockchain. The problem is that we don't have the algorithm that we need from the algorithms that Nordics provides to us. Here we are using SHA256 (PSA_ALG_SHA-256) but we need Keccak256.

status = psa_hash_compute(PSA_ALG_SHA_256,
				  keccak,
				  sizeof(keccak),
				  m_hash,
				  sizeof(m_hash),
				  &output_len);
	if (status != PSA_SUCCESS) {
		LOG_INF("psa_hash_compute failed! (Error: %d)", status);
		return APP_ERROR;
	}

	
	
	/* Sign the hash */
	status = psa_sign_hash(keypair_handle,
			       PSA_ALG_DETERMINISTIC_ECDSA(PSA_ALG_SHA_256),
			       m_hash,
			       sizeof(m_hash),
			       m_signature,
			       sizeof(m_signature),
			       &output_len);
	if (status != PSA_SUCCESS) {
		LOG_INF("psa_sign_hash failed! (Error: %d)", status);
		return APP_ERROR;
	}

Parents Reply
  • We understood that the Keccack256 function is not supported we implemented third party library but we noticed that for some values the ECDSA result is wrong related to the "s value".
    We noticed that when we make the Keccak256 of a standard number or a text the "r and s values" are correct, but when we make the keccack256 of RLP only the "r value" is correct.

Children
Related