From 9791f9a6ec2af375623fadcf7f16716fcd64b7b7 Mon Sep 17 00:00:00 2001 From: Stephane Glondu Date: Tue, 20 Aug 2024 08:53:23 +0200 Subject: [PATCH] New upstream version 0.10 --- .cirrus.yml | 8 ++++---- .github/workflows/test.yml | 6 +++--- CHANGES.md | 7 +++++++ clock/select/select.ml | 5 ++++- dune-project | 2 +- eqaf-cstruct.opam | 24 ++++++++++++++++++++++++ eqaf.opam | 6 ++---- lib/dune | 8 +++++++- lib/eqaf_bytes.ml | 32 ++++++++++++++++++++++++++++++++ lib/eqaf_bytes.mli | 7 +++++++ 10 files changed, 91 insertions(+), 14 deletions(-) create mode 100644 eqaf-cstruct.opam create mode 100644 lib/eqaf_bytes.ml create mode 100644 lib/eqaf_bytes.mli diff --git a/.cirrus.yml b/.cirrus.yml index 2813ab6..18b0a8d 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -1,13 +1,13 @@ freebsd_instance: - image_family: freebsd-12-1 + image_family: freebsd-14-1 freebsd_task: env: matrix: - - OCAML_VERSION: 4.11.1 - - OCAML_VERSION: 4.12.0 + - OCAML_VERSION: 4.13.1 + - OCAML_VERSION: 4.14.2 pkg_install_script: pkg install -y ocaml-opam gmake bash ocaml_script: opam init -a --comp=$OCAML_VERSION - dependencies_script: eval `opam env` && opam install -y --deps-only . + dependencies_script: eval `opam env` && opam pin add -yn eqaf.dev . && opam pin add -yn eqaf-cstruct.dev . && opam install -y --deps-only eqaf eqaf-cstruct build_script: eval `opam env` && dune build @install test_script: eval `opam env` && opam install -y -t --deps-only . && dune build @runtest diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c2151fb..68033af 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -9,7 +9,7 @@ jobs: strategy: fail-fast: false matrix: - ocaml-version: ["4.10.0", "4.09.0", "4.08.1"] + ocaml-version: ["4.13.1", "4.14.2"] operating-system: [macos-latest, ubuntu-latest, windows-latest] runs-on: ${{ matrix.operating-system }} @@ -19,9 +19,9 @@ jobs: uses: actions/checkout@v2 - name: Use OCaml ${{ matrix.ocaml-version }} - uses: avsm/setup-ocaml@v2 + uses: ocaml/setup-ocaml@v2 with: - ocaml-version: ${{ matrix.ocaml-version }} + ocaml-compiler: ${{ matrix.ocaml-version }} - name: Install nasm uses: ilammy/setup-nasm@v1 diff --git a/CHANGES.md b/CHANGES.md index f0f9865..aeab442 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,10 @@ +### v0.10 2024-06-14 Kyoto (Japon) + +- Implement functions provided by `eqaf` on bytes (@FantomeBeignet, #41) +- Choose the right clock on MSVC systems (@dra27, #40) +- Fix the lower bounds about base64 (@hannesm, #45) +- Split `eqaf` and `eqaf-cstruct` (@dinosaure, @hannesm, #43) + ### v0.9 2022-07-24 Paris (France) - Add support of OCaml 5.00 (@kit-ty-kate, #37) diff --git a/clock/select/select.ml b/clock/select/select.ml index 78b45cf..aea3237 100644 --- a/clock/select/select.ml +++ b/clock/select/select.ml @@ -23,9 +23,12 @@ let () = let system = match system with | "linux" | "elf" -> `Linux - | "windows" | "mingw64" | "mingw" | "cygwin" -> `Windows + | "win32" | "win64" | "mingw64" | "mingw" | "cygwin" -> `Windows | "freebsd" -> `FreeBSD | "macosx" -> `MacOSX + | "beos" | "dragonfly" | "bsd" | "openbsd" | "netbsd" | "gnu" + | "solaris" | "unknown" -> + invalid_arg "Unsupported system: %s" system | v -> if String.sub system 0 5 = "linux" then `Linux diff --git a/dune-project b/dune-project index aa2d0b3..2a000c6 100644 --- a/dune-project +++ b/dune-project @@ -1,3 +1,3 @@ (lang dune 2.0) (name eqaf) -(version v0.9) +(version dev) diff --git a/eqaf-cstruct.opam b/eqaf-cstruct.opam new file mode 100644 index 0000000..c67dc25 --- /dev/null +++ b/eqaf-cstruct.opam @@ -0,0 +1,24 @@ +opam-version: "2.0" +maintainer: [ "Romain Calascibetta " ] +authors: [ "Romain Calascibetta " ] +homepage: "https://github.com/mirage/eqaf" +bug-reports: "https://github.com/mirage/eqaf/issues" +dev-repo: "git+https://github.com/mirage/eqaf.git" +doc: "https://mirage.github.io/eqaf/" +license: "MIT" +synopsis: "Constant-time equal function on string" +description: """ +This package provides an equal function on string in constant-time to avoid timing-attack with crypto stuff. +""" + +build: [ + [ "dune" "subst" ] {dev} + [ "dune" "build" "-p" name "-j" jobs ] +] + +depends: [ + "ocaml" {>= "4.07.0"} + "dune" {>= "2.0"} + "cstruct" {>= "1.1.0"} + "eqaf" {= version} +] diff --git a/eqaf.opam b/eqaf.opam index 2ea638b..0f32fef 100644 --- a/eqaf.opam +++ b/eqaf.opam @@ -1,4 +1,3 @@ -version: "0.9" opam-version: "2.0" maintainer: [ "Romain Calascibetta " ] authors: [ "Romain Calascibetta " ] @@ -21,10 +20,9 @@ build: [ depends: [ "ocaml" {>= "4.07.0"} "dune" {>= "2.0"} - "cstruct" {>= "1.1.0"} - "base64" {with-test} + "base64" {with-test & >= "3.0.0"} "alcotest" {with-test} "crowbar" {with-test} "fmt" {with-test & >= "0.8.7"} "bechamel" {with-test} -] \ No newline at end of file +] diff --git a/lib/dune b/lib/dune index 23e5572..1eb8de5 100644 --- a/lib/dune +++ b/lib/dune @@ -12,8 +12,14 @@ (modules eqaf_bigstring) (libraries eqaf)) +(library + (name eqaf_bytes) + (public_name eqaf.bytes) + (modules eqaf_bytes) + (libraries eqaf)) + (library (name eqaf_cstruct) - (public_name eqaf.cstruct) + (public_name eqaf-cstruct) (modules eqaf_cstruct) (libraries cstruct eqaf.bigstring)) diff --git a/lib/eqaf_bytes.ml b/lib/eqaf_bytes.ml new file mode 100644 index 0000000..82bd4ce --- /dev/null +++ b/lib/eqaf_bytes.ml @@ -0,0 +1,32 @@ +let equal a b = + let a' = Bytes.unsafe_to_string a in + let b' = Bytes.unsafe_to_string b in + Eqaf.equal a' b' + +let compare_le_with_len ~len a b = + let a' = Bytes.unsafe_to_string a in + let b' = Bytes.unsafe_to_string b in + Eqaf.compare_le_with_len ~len a' b' + +let compare_le a b = + let a' = Bytes.unsafe_to_string a in + let b' = Bytes.unsafe_to_string b in + Eqaf.compare_le a' b' + +let compare_be_with_len ~len a b = + let a' = Bytes.unsafe_to_string a in + let b' = Bytes.unsafe_to_string b in + Eqaf.compare_be_with_len ~len a' b' + +let compare_be a b = + let a' = Bytes.unsafe_to_string a in + let b' = Bytes.unsafe_to_string b in + Eqaf.compare_be a' b' + +let find_uint8 ?off ~f b = + let str = Bytes.unsafe_to_string b in + Eqaf.find_uint8 ?off ~f str + +let exists_uint8 ?off ~f b = + let str = Bytes.unsafe_to_string b in + Eqaf.exists_uint8 ?off ~f str diff --git a/lib/eqaf_bytes.mli b/lib/eqaf_bytes.mli new file mode 100644 index 0000000..9934136 --- /dev/null +++ b/lib/eqaf_bytes.mli @@ -0,0 +1,7 @@ +val equal : bytes -> bytes -> bool +val compare_be : bytes -> bytes -> int +val compare_be_with_len : len:int -> bytes -> bytes -> int +val compare_le : bytes -> bytes -> int +val compare_le_with_len : len:int -> bytes -> bytes -> int +val find_uint8 : ?off:int -> f:(int -> bool) -> bytes -> int +val exists_uint8 : ?off:int -> f:(int -> bool) -> bytes -> bool -- 2.30.2