ENHANCED: Use crrl for Ed25519 signing and signature verification.
The main motivation for this change is the introduction of the newly available predicate ed25519_seed_keypair/2, allowing to generate a key pair from a given seed. In this way, a key pair can be dynamically generated from (for example) a password, using crypto_password_hash/3 in combination with crypto_data_hkdf/4 to generate the seed. The advantage of this method is that the private key need not be stored at all anywhere. It is not possible to add a corresponding feature to ring, since it is closed as "not planned": https://github.com/briansmith/ring/issues/1003 I also used this opportunity to move more of the logic to Prolog. We now have total control of the key pair representation, and I also changed the representation to conform to the PKCS#8 v2 standard, something that only later ring versions do, while still being backwards compatible with tools that produce a wrong representation including earlier ring versions. Another great advantage we get from this change is that the Ed25519 predicates now also run on the 32-bit and WASM versions of Scryer.
This commit is contained in:
@@ -4491,44 +4491,28 @@ impl Machine {
|
||||
self.crypto_curve_scalar_mult();
|
||||
step_or_fail!(self, self.machine_st.p = self.machine_st.cp);
|
||||
}
|
||||
#[cfg(feature = "crypto-full")]
|
||||
&Instruction::CallEd25519Sign => {
|
||||
self.ed25519_sign();
|
||||
&Instruction::CallEd25519SignRaw => {
|
||||
self.ed25519_sign_raw();
|
||||
step_or_fail!(self, self.machine_st.p += 1);
|
||||
}
|
||||
#[cfg(feature = "crypto-full")]
|
||||
&Instruction::ExecuteEd25519Sign => {
|
||||
self.ed25519_sign();
|
||||
&Instruction::ExecuteEd25519SignRaw => {
|
||||
self.ed25519_sign_raw();
|
||||
step_or_fail!(self, self.machine_st.p = self.machine_st.cp);
|
||||
}
|
||||
#[cfg(feature = "crypto-full")]
|
||||
&Instruction::CallEd25519Verify => {
|
||||
self.ed25519_verify();
|
||||
&Instruction::CallEd25519VerifyRaw => {
|
||||
self.ed25519_verify_raw();
|
||||
step_or_fail!(self, self.machine_st.p += 1);
|
||||
}
|
||||
#[cfg(feature = "crypto-full")]
|
||||
&Instruction::ExecuteEd25519Verify => {
|
||||
self.ed25519_verify();
|
||||
&Instruction::ExecuteEd25519VerifyRaw => {
|
||||
self.ed25519_verify_raw();
|
||||
step_or_fail!(self, self.machine_st.p = self.machine_st.cp);
|
||||
}
|
||||
#[cfg(feature = "crypto-full")]
|
||||
&Instruction::CallEd25519NewKeyPair => {
|
||||
self.ed25519_new_key_pair();
|
||||
&Instruction::CallEd25519SeedToPublicKey => {
|
||||
self.ed25519_seed_to_public_key();
|
||||
step_or_fail!(self, self.machine_st.p += 1);
|
||||
}
|
||||
#[cfg(feature = "crypto-full")]
|
||||
&Instruction::ExecuteEd25519NewKeyPair => {
|
||||
self.ed25519_new_key_pair();
|
||||
step_or_fail!(self, self.machine_st.p = self.machine_st.cp);
|
||||
}
|
||||
#[cfg(feature = "crypto-full")]
|
||||
&Instruction::CallEd25519KeyPairPublicKey => {
|
||||
self.ed25519_key_pair_public_key();
|
||||
step_or_fail!(self, self.machine_st.p += 1);
|
||||
}
|
||||
#[cfg(feature = "crypto-full")]
|
||||
&Instruction::ExecuteEd25519KeyPairPublicKey => {
|
||||
self.ed25519_key_pair_public_key();
|
||||
&Instruction::ExecuteEd25519SeedToPublicKey => {
|
||||
self.ed25519_seed_to_public_key();
|
||||
step_or_fail!(self, self.machine_st.p = self.machine_st.cp);
|
||||
}
|
||||
&Instruction::CallCurve25519ScalarMult => {
|
||||
|
||||
Reference in New Issue
Block a user