Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use small Curve25519 for wasm32 & other non-{aarch64,x86_64}. #1746

Merged
merged 1 commit into from
Oct 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions crypto/curve25519/curve25519.c
Original file line number Diff line number Diff line change
Expand Up @@ -240,9 +240,11 @@ static void fe_mul_ltt(fe_loose *h, const fe *f, const fe *g) {
fe_mul_impl(h->v, f->v, g->v);
}

// static void fe_mul_llt(fe_loose *h, const fe_loose *f, const fe *g) was
// removed. This comment is here to make diffs vs. BoringSSL easier to read.

#if defined(OPENSSL_SMALL)
static void fe_mul_llt(fe_loose *h, const fe_loose *f, const fe *g) {
fe_mul_impl(h->v, f->v, g->v);
}
#endif

static void fe_mul_ttt(fe *h, const fe *f, const fe *g) {
fe_mul_impl(h->v, f->v, g->v);
Expand Down
4 changes: 4 additions & 0 deletions include/ring-core/target.h
Original file line number Diff line number Diff line change
Expand Up @@ -152,4 +152,8 @@
#endif
#endif // OPENSSL_ASM_INCOMPATIBLE

#if !defined(OPENSSL_X86_64) && !defined(OPENSSL_AARCH64)
#define OPENSSL_SMALL
#endif

#endif // OPENSSL_HEADER_TARGET_H
1 change: 0 additions & 1 deletion src/ec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ derive_debug_via_id!(Curve);

#[derive(Clone, Copy, Debug, PartialEq)]
pub enum CurveID {
#[cfg(not(target_arch = "wasm32"))]
Curve25519,
P256,
P384,
Expand Down
1 change: 0 additions & 1 deletion src/ec/curve25519.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

pub mod ed25519;

#[cfg(not(target_arch = "wasm32"))]
pub mod x25519;

mod ops;
Expand Down
1 change: 0 additions & 1 deletion src/ec/suite_b.rs
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,6 @@ pub(crate) fn key_pair_from_bytes(

pub mod curve;

#[cfg(not(target_arch = "wasm32"))]
pub mod ecdh;

pub mod ecdsa;
Expand Down
1 change: 0 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ mod polyfill;

pub mod aead;

#[cfg(not(target_arch = "wasm32"))]
pub mod agreement;

mod bits;
Expand Down
6 changes: 5 additions & 1 deletion tests/agreement_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@
// OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
// CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

#![cfg(not(target_arch = "wasm32"))]
#[cfg(all(target_arch = "wasm32", target_os = "unknown"))]
use wasm_bindgen_test::{wasm_bindgen_test as test, wasm_bindgen_test_configure};

#[cfg(all(target_arch = "wasm32", target_os = "unknown"))]
wasm_bindgen_test_configure!(run_in_browser);

extern crate alloc;

Expand Down
Loading