Skip to content

Commit

Permalink
Bump curve25519-dalek from 4.1.0 to 4.1.3 in /wasm (#528)
Browse files Browse the repository at this point in the history
Bumps
[curve25519-dalek](https://github.com/dalek-cryptography/curve25519-dalek)
from 4.1.0 to 4.1.3.

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Alex Ostrovski <[email protected]>
  • Loading branch information
dependabot[bot] and slowli authored Jul 6, 2024
1 parent 0509715 commit 900dc0a
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 13 deletions.
11 changes: 2 additions & 9 deletions wasm/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion wasm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ num-bigint = "0.4"
rand_core = { version = "0.6", default-features = false }

[dependencies.curve25519-dalek]
version = "4.1.0"
version = "4.1.3"
default-features = false

[dependencies.ed25519-dalek]
Expand Down
12 changes: 10 additions & 2 deletions wasm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
)]

use curve25519_dalek::{
constants::{BASEPOINT_ORDER, ED25519_BASEPOINT_POINT, EIGHT_TORSION},
constants::{ED25519_BASEPOINT_POINT, EIGHT_TORSION},
digest::Digest,
edwards::{CompressedEdwardsY, EdwardsPoint},
scalar::Scalar,
Expand Down Expand Up @@ -469,8 +469,16 @@ impl Signature {
/// Returns the scalar shifted by the subgroup order `l`, `s' = s + l`.
#[wasm_bindgen(js_name = "modifiedScalar")]
pub fn modified_scalar(&self) -> ModifiedScalar {
// Little-endian representation of the Ed25519 basepoint. Taken from `BASEPOINT_ORDER_PRIVATE`
// constant in `curve25519-dalek`.
const BASEPOINT_ORDER_BYTES: &[u8; 32] = &[
0xed, 0xd3, 0xf5, 0x5c, 0x1a, 0x63, 0x12, 0x58, 0xd6, 0x9c, 0xf7, 0xa2, 0xde, 0xf9,
0xde, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x10,
];

let s = BigUint::from_bytes_le(&self.scalar());
let basepoint_order = BigUint::from_bytes_le(BASEPOINT_ORDER.as_bytes());
let basepoint_order = BigUint::from_bytes_le(BASEPOINT_ORDER_BYTES);
let shifted_s = (s + &basepoint_order).to_bytes_le();
assert_eq!(shifted_s.len(), 32);
ModifiedScalar::new(shifted_s.into_boxed_slice(), &self.random_point())
Expand Down
2 changes: 1 addition & 1 deletion webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ module.exports = {
// This hard-codes the relative path to the `TextDecoder` module from the `wasm/pkg` directory,
// which is the only place using the `TextDecoder` global.
new webpack.ProvidePlugin({
TextDecoder: ['../../src/TextDecoder', 'default'],
TextDecoder: ['../../src/TextDecoder.js', 'default'],
}),

...htmlPlugins,
Expand Down

0 comments on commit 900dc0a

Please sign in to comment.