Skip to content

Commit 724b2a6

Browse files
committed
mirage-crypto-ec: ECDSA and curves P-224, P-256, P-384, P-521
This includes: - ECDSA implementation with blinding - tests from RFC 6979 (deterministic k) - wycheproof tests for ECDH and ECDSA (commit 2196000605e45d91097147c9c71f26b72af58003) - ec/native contains a Makefile which runs the extraction (using fiat-crypto's word-by-word-montgomery)
1 parent a85f4fc commit 724b2a6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+151810
-4443
lines changed

Diff for: .github/workflows/test.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ jobs:
3030
opam pin add -n mirage-crypto-rng-mirage.dev .
3131
opam pin add -n mirage-crypto-rng-async.dev .
3232
opam pin add -n mirage-crypto-pk.dev .
33-
opam depext -y mirage-crypto mirage-crypto-rng mirage-crypto-rng-mirage mirage-crypto-pk
33+
opam pin add -n mirage-crypto-ec.dev .
34+
opam depext -y mirage-crypto mirage-crypto-rng mirage-crypto-rng-mirage mirage-crypto-pk mirage-crypto-ec
3435
opam install -t --deps-only .
3536
3637
- name: Build

Diff for: .github/workflows/windows.yml

+5-4
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,12 @@ jobs:
2929
opam pin add -n mirage-crypto-rng.dev .
3030
opam pin add -n mirage-crypto-rng-mirage.dev .
3131
opam pin add -n mirage-crypto-pk.dev .
32-
opam depext -y mirage-crypto mirage-crypto-rng mirage-crypto-rng-mirage mirage-crypto-pk
33-
opam install -t --deps-only mirage-crypto mirage-crypto-rng mirage-crypto-rng-mirage mirage-crypto-pk
32+
opam pin add -n mirage-crypto-ec.dev .
33+
opam depext -y mirage-crypto mirage-crypto-rng mirage-crypto-rng-mirage mirage-crypto-pk mirage-crypto-ec
34+
opam install -t --deps-only mirage-crypto mirage-crypto-rng mirage-crypto-rng-mirage mirage-crypto-pk mirage-crypto-ec
3435
3536
- name: Build
36-
run: opam exec -- dune build -p mirage-crypto,mirage-crypto-rng,mirage-crypto-rng-mirage,mirage-crypto-pk
37+
run: opam exec -- dune build -p mirage-crypto,mirage-crypto-rng,mirage-crypto-rng-mirage,mirage-crypto-pk,mirage-crypto-ec
3738

3839
- name: Test
39-
run: opam exec -- dune runtest -p mirage-crypto,mirage-crypto-rng,mirage-crypto-rng-mirage,mirage-crypto-pk
40+
run: opam exec -- dune runtest -p mirage-crypto,mirage-crypto-rng,mirage-crypto-rng-mirage,mirage-crypto-pk,mirage-crypto-ec

Diff for: .travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ services:
66
os: linux
77
env:
88
global:
9-
- PINS="mirage-crypto:. mirage-crypto-rng:. mirage-crypto-rng-mirage:. mirage-crypto-pk:. mirage-crypto-rng-async:."
9+
- PINS="mirage-crypto:. mirage-crypto-rng:. mirage-crypto-rng-mirage:. mirage-crypto-pk:. mirage-crypto-rng-async:. mirage-crypto-ec:."
1010
- PACKAGE="mirage-crypto-pk"
1111
- TESTS=true
1212
- DISTRO=alpine

Diff for: ec-freestanding/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ FREESTANDING_CFLAGS := $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) pkg-config --c
1414
DISCOVER_CFLAGS := $(shell sed 's/^(\(.*\))$$/\1/' ../ec/cflags_optimized.sexp | tr -d '"')
1515
CFLAGS := -O3 -I../ec/native -I../src/native $(DISCOVER_CFLAGS) $(FREESTANDING_CFLAGS)
1616

17-
OBJS=p256_stubs.o
17+
OBJS=p224_stubs.o np224_stubs.o p256_stubs.o np256_stubs.o p384_stubs.o np384_stubs.o p521_stubs.o np521_stubs.o
1818

1919
libmirage_crypto_ec_freestanding_stubs.a: $(OBJS)
2020
$(AR) r $@ $^

Diff for: ec-freestanding/dune

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
(rule
44
(deps ../ec/cflags_optimized.sexp ../src/native/mirage_crypto.h
5-
../src/native/bitfn.h Makefile p256_stubs.c)
5+
../src/native/bitfn.h Makefile p224_stubs.c np224_stubs.c p256_stubs.c
6+
np256_stubs.c p384_stubs.c np384_stubs.c p521_stubs.c np521_stubs.c)
67
(targets libmirage_crypto_ec_freestanding_stubs.a)
78
(action
89
(no-infer

Diff for: ec/dune

+7-24
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,22 @@
11
(library
22
(name mirage_crypto_ec)
33
(public_name mirage-crypto-ec)
4-
(libraries cstruct eqaf.cstruct hex)
4+
(libraries cstruct eqaf.cstruct hex mirage-crypto mirage-crypto-rng)
55
(foreign_stubs
66
(language c)
7-
(names p256_stubs)
7+
(names p224_stubs np224_stubs p256_stubs np256_stubs p384_stubs np384_stubs
8+
p521_stubs np521_stubs)
89
(flags
910
(:standard -I../src/native)
1011
(:include cflags_optimized.sexp))))
1112

13+
(env
14+
(dev
15+
(c_flags (-Werror))))
16+
1217
(include_subdirs unqualified)
1318

1419
(rule
1520
(targets cflags_optimized.sexp)
1621
(action
1722
(run ../config/cfg.exe)))
18-
19-
(rule
20-
(targets upstream_p256_32)
21-
(action
22-
(bash
23-
"wget https://raw.githubusercontent.com/mit-plv/fiat-crypto/ecdfd03c636ab63e167fbe4fc4d7ab0ed5d9db74/p256_32.c -O %{targets}")))
24-
25-
(rule
26-
(targets upstream_p256_64)
27-
(action
28-
(bash
29-
"wget https://raw.githubusercontent.com/mit-plv/fiat-crypto/ecdfd03c636ab63e167fbe4fc4d7ab0ed5d9db74/p256_64.c -O %{targets}")))
30-
31-
(rule
32-
(alias check_vendors)
33-
(action
34-
(diff native/p256_32.h upstream_p256_32)))
35-
36-
(rule
37-
(alias check_vendors)
38-
(action
39-
(diff native/p256_64.h upstream_p256_64)))

Diff for: ec/error.ml

-21
This file was deleted.

Diff for: ec/error.mli

-12
This file was deleted.

Diff for: ec/field_element.ml

-65
This file was deleted.

Diff for: ec/field_element.mli

-63
This file was deleted.

0 commit comments

Comments
 (0)