···11-exception Unsupported of string
22-(** Raised by backend operations that are not available in the current
33- implementation (e.g. DES, ChaCha20, Poly1305 in the pure OCaml backend). *)
44-51(** Simpler crypto
6273 Mirage-crypto is a cryptographic library.
+7-9
src/ocaml/native.ml
···4848 Aes_pure.encrypt_ecb rka rounds src soff dst doff blocks
49495050 let dec _src _soff _dst _doff _rk _rounds _blocks =
5151- raise
5252- (Crypto.Unsupported
5353- "AES decrypt not available in pure OCaml backend (GCM uses encrypt \
5454- only)")
5151+ invalid_arg
5252+ "AES decrypt not available in pure OCaml backend (GCM uses encrypt only)"
55535654 let mode () = 0 (* generic *)
5755end
···6058 let k_s () = 128
61596260 let des3key _key _mode _ks =
6363- raise (Crypto.Unsupported "DES not available in pure OCaml backend")
6161+ invalid_arg "DES not available in pure OCaml backend"
64626563 let ddes _src _soff _dst _doff _blocks _ks =
6666- raise (Crypto.Unsupported "DES not available in pure OCaml backend")
6464+ invalid_arg "DES not available in pure OCaml backend"
6765end
68666967module Chacha = struct
7068 let round _count _state _dst _off =
7171- raise (Crypto.Unsupported "ChaCha20 not available in pure OCaml backend")
6969+ invalid_arg "ChaCha20 not available in pure OCaml backend"
7270end
73717472module Poly1305 = struct
···7775 let init _ctx _key = failwith "Poly1305 not implemented in pure OCaml backend"
78767977 let update _ctx _data _off _len =
8080- raise (Crypto.Unsupported "Poly1305 not available in pure OCaml backend")
7878+ invalid_arg "Poly1305 not available in pure OCaml backend"
81798280 let finalize _ctx _mac _off =
8383- raise (Crypto.Unsupported "Poly1305 not available in pure OCaml backend")
8181+ invalid_arg "Poly1305 not available in pure OCaml backend"
8482end
85838684module GHASH = struct