package_name string | version string | license string | homepage string | dev_repo string | file_type string | file_path string | file_content string |
|---|---|---|---|---|---|---|---|
mirage-crypto | 2.1.0 | ISC | https://github.com/mirage/mirage-crypto | git+https://github.com/mirage/mirage-crypto.git | dune | mirage-crypto-2.1.0/bench/dune | (executables
(names speed)
(modules speed)
(libraries mirage-crypto mirage-crypto-rng mirage-crypto-rng.unix
mirage-crypto-pk mirage-crypto-ec))
; marking as "(optional)" leads to OCaml-CI failures
; marking with "(package mirage-crypto-rng-miou-unix)" only has an effect with a "public_name"
;(executables
; (nam... |
mirage-crypto | 2.1.0 | ISC | https://github.com/mirage/mirage-crypto | git+https://github.com/mirage/mirage-crypto.git | ml | mirage-crypto-2.1.0/bench/miou.ml | open Mirage_crypto
module Time = struct
let time ~n f a =
let t1 = Sys.time () in
for _ = 1 to n do ignore (f a) done ;
let t2 = Sys.time () in
(t2 -. t1)
let warmup () =
let x = ref 0 in
let rec go start =
if Sys.time () -. start < 1. then begin
for i = 0 to 10000 do x := !... |
mirage-crypto | 2.1.0 | ISC | https://github.com/mirage/mirage-crypto | git+https://github.com/mirage/mirage-crypto.git | ml | mirage-crypto-2.1.0/bench/speed.ml | open Mirage_crypto
module Time = struct
let time ~n f a =
let t1 = Sys.time () in
for _ = 1 to n do ignore (f a) done ;
let t2 = Sys.time () in
(t2 -. t1)
let warmup () =
let x = ref 0 in
let rec go start =
if Sys.time () -. start < 1. then begin
for i = 0 to 10000 do x := !... |
mirage-crypto | 2.1.0 | ISC | https://github.com/mirage/mirage-crypto | git+https://github.com/mirage/mirage-crypto.git | ml | mirage-crypto-2.1.0/config/cfg.ml | let () =
let c = Configurator.V1.create "mirage-crypto" in
let ccomp_type_opt = Configurator.V1.ocaml_config_var c "ccomp_type" in
let arch =
let defines =
Configurator.V1.C_define.import
c
~includes:[]
[("__x86_64__", Switch); ("__i386__", Switch); ("__powerpc64__", Switch);
... |
mirage-crypto | 2.1.0 | ISC | https://github.com/mirage/mirage-crypto | git+https://github.com/mirage/mirage-crypto.git | dune | mirage-crypto-2.1.0/config/dune | (executables
(names cfg)
(libraries dune-configurator))
|
mirage-crypto | 2.1.0 | ISC | https://github.com/mirage/mirage-crypto | git+https://github.com/mirage/mirage-crypto.git | dune | mirage-crypto-2.1.0/ec/dune | (library
(name mirage_crypto_ec)
(public_name mirage-crypto-ec)
(libraries eqaf mirage-crypto-rng digestif)
(foreign_stubs
(language c)
(names p256_stubs np256_stubs p384_stubs np384_stubs p521_stubs np521_stubs
curve25519_stubs)
(include_dirs ../src/native)
(flags
(:standard -DNDEBUG)
(:include c... |
mirage-crypto | 2.1.0 | ISC | https://github.com/mirage/mirage-crypto | git+https://github.com/mirage/mirage-crypto.git | dune | mirage-crypto-2.1.0/ec/gen_tables/dune | (include_subdirs no)
(executable
(name gen_tables)
(libraries mirage_crypto_ec))
|
mirage-crypto | 2.1.0 | ISC | https://github.com/mirage/mirage-crypto | git+https://github.com/mirage/mirage-crypto.git | ml | mirage-crypto-2.1.0/ec/gen_tables/gen_tables.ml | open Format
let print_header name =
printf
{|
/*
Pre-computed %d-bit multiples of the generator point G for the curve %s,
used for speeding up its scalar multiplication in point_operations.h.
Generated by %s
*/|}
Sys.word_size name Sys.argv.(0)
let pp_array elem_fmt fmt arr =
let fout =... |
mirage-crypto | 2.1.0 | ISC | https://github.com/mirage/mirage-crypto | git+https://github.com/mirage/mirage-crypto.git | ml | mirage-crypto-2.1.0/ec/mirage_crypto_ec.ml | type error = [
| `Invalid_format
| `Invalid_length
| `Invalid_range
| `Not_on_curve
| `At_infinity
| `Low_order
]
let error_to_string = function
| `Invalid_format -> "invalid format"
| `Not_on_curve -> "point is not on curve"
| `At_infinity -> "point is at infinity"
| `Invalid_length -> "invalid le... |
mirage-crypto | 2.1.0 | ISC | https://github.com/mirage/mirage-crypto | git+https://github.com/mirage/mirage-crypto.git | mli | mirage-crypto-2.1.0/ec/mirage_crypto_ec.mli | (** {1 Elliptic curve cryptography} *)
(** Mirage-crypto-ec implements public key cryptography with named elliptic
curves. Ephemeral key exchanges with {{!Dh}Diffie-Hellman} and
{{!Dsa}digital signatures (ECDSA)} are implemented.
The arithmetic operations uses code generated by
{{:https://github.com/m... |
mirage-crypto | 2.1.0 | ISC | https://github.com/mirage/mirage-crypto | git+https://github.com/mirage/mirage-crypto.git | h | mirage-crypto-2.1.0/ec/native/curve25519_32.h | /* Autogenerated: '../fiat-crypto/src/ExtractionOCaml/unsaturated_solinas' --static --use-value-barrier --inline-internal 25519 32 '(auto)' '2^255 - 19' carry_mul carry_square carry add sub opp selectznz to_bytes from_bytes carry_scmul121666 */
/* curve description: 25519 */
/* machine_wordsize = 32 (from "32") */
/* r... |
mirage-crypto | 2.1.0 | ISC | https://github.com/mirage/mirage-crypto | git+https://github.com/mirage/mirage-crypto.git | h | mirage-crypto-2.1.0/ec/native/curve25519_64.h | /* Autogenerated: '../fiat-crypto/src/ExtractionOCaml/unsaturated_solinas' --static --use-value-barrier --inline-internal 25519 64 '(auto)' '2^255 - 19' carry_mul carry_square carry add sub opp selectznz to_bytes from_bytes carry_scmul121666 */
/* curve description: 25519 */
/* machine_wordsize = 64 (from "64") */
/* r... |
mirage-crypto | 2.1.0 | ISC | https://github.com/mirage/mirage-crypto | git+https://github.com/mirage/mirage-crypto.git | c | mirage-crypto-2.1.0/ec/native/curve25519_stubs.c | #include "mirage_crypto.h"
/* Microsoft compiler does not support 128-bit integers. Drop down to
* 32-bit for MSVC.
*/
#if defined(ARCH_64BIT) && !defined(_MSC_VER)
#include "curve25519_64.h"
#define WORD uint64_t
#define LIMBS 5
#else
#include "curve25519_32.h"
#define WORD uint32_t
#define LIMBS 10
#endif
#includ... |
mirage-crypto | 2.1.0 | ISC | https://github.com/mirage/mirage-crypto | git+https://github.com/mirage/mirage-crypto.git | h | mirage-crypto-2.1.0/ec/native/curve25519_tables.h | /* following code is from c47bfce06 of boringssl: crypto/curve25519 */
/* Copyright (c) 2020, Google Inc.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all... |
mirage-crypto | 2.1.0 | ISC | https://github.com/mirage/mirage-crypto | git+https://github.com/mirage/mirage-crypto.git | h | mirage-crypto-2.1.0/ec/native/inversion_template.h | #define MAKE_FN_NAME1(x,y) x ## y
#define MAKE_FN_NAME(x,y) MAKE_FN_NAME1(x,y)
#define PRECOMP MAKE_FN_NAME(CURVE_DESCRIPTION,_divstep_precomp)
#define MSAT MAKE_FN_NAME(CURVE_DESCRIPTION,_msat)
#define MONE MAKE_FN_NAME(CURVE_DESCRIPTION,_set_one)
#define DIVSTEP MAKE_FN_NAME(CURVE_DESCRIPTION,_divstep)
#define OPP M... |
mirage-crypto | 2.1.0 | ISC | https://github.com/mirage/mirage-crypto | git+https://github.com/mirage/mirage-crypto.git | h | mirage-crypto-2.1.0/ec/native/np256_32.h | /* Autogenerated: '../fiat-crypto/src/ExtractionOCaml/word_by_word_montgomery' --static --use-value-barrier --inline-internal np256 32 0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551 mul add opp from_montgomery to_montgomery one msat divstep_precomp divstep to_bytes from_bytes selectznz */
/* curve d... |
mirage-crypto | 2.1.0 | ISC | https://github.com/mirage/mirage-crypto | git+https://github.com/mirage/mirage-crypto.git | h | mirage-crypto-2.1.0/ec/native/np256_64.h | /* Autogenerated: '../fiat-crypto/src/ExtractionOCaml/word_by_word_montgomery' --static --use-value-barrier --inline-internal np256 64 0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551 mul add opp from_montgomery to_montgomery one msat divstep_precomp divstep to_bytes from_bytes selectznz */
/* curve d... |
mirage-crypto | 2.1.0 | ISC | https://github.com/mirage/mirage-crypto | git+https://github.com/mirage/mirage-crypto.git | c | mirage-crypto-2.1.0/ec/native/np256_stubs.c | #include "mirage_crypto.h"
/* Microsoft compiler does not support 128-bit integers. Drop down to
* 32-bit for MSVC.
*/
#if defined(ARCH_64BIT) && !defined(_MSC_VER)
#include "np256_64.h"
#define LIMBS 4
#define WORD uint64_t
#define WORDSIZE 64
#else
#include "np256_32.h"
#define LIMBS 8
#define WORD uint32_t
#defin... |
mirage-crypto | 2.1.0 | ISC | https://github.com/mirage/mirage-crypto | git+https://github.com/mirage/mirage-crypto.git | h | mirage-crypto-2.1.0/ec/native/np384_32.h | /* Autogenerated: '../fiat-crypto/src/ExtractionOCaml/word_by_word_montgomery' --static --use-value-barrier --inline-internal np384 32 0xffffffffffffffffffffffffffffffffffffffffffffffffc7634d81f4372ddf581a0db248b0a77aecec196accc52973 mul add opp from_montgomery to_montgomery one msat divstep_precomp divstep to_bytes fr... |
mirage-crypto | 2.1.0 | ISC | https://github.com/mirage/mirage-crypto | git+https://github.com/mirage/mirage-crypto.git | h | mirage-crypto-2.1.0/ec/native/np384_64.h | /* Autogenerated: '../fiat-crypto/src/ExtractionOCaml/word_by_word_montgomery' --static --use-value-barrier --inline-internal np384 64 0xffffffffffffffffffffffffffffffffffffffffffffffffc7634d81f4372ddf581a0db248b0a77aecec196accc52973 mul add opp from_montgomery to_montgomery one msat divstep_precomp divstep to_bytes fr... |
mirage-crypto | 2.1.0 | ISC | https://github.com/mirage/mirage-crypto | git+https://github.com/mirage/mirage-crypto.git | c | mirage-crypto-2.1.0/ec/native/np384_stubs.c | #include "mirage_crypto.h"
/* Microsoft compiler does not support 128-bit integers. Drop down to
* 32-bit for MSVC.
*/
#if defined(ARCH_64BIT) && !defined(_MSC_VER)
#include "np384_64.h"
#define LIMBS 6
#define WORD uint64_t
#define WORDSIZE 64
#else
#include "np384_32.h"
#define LIMBS 12
#define WORD uint32_t
#defi... |
mirage-crypto | 2.1.0 | ISC | https://github.com/mirage/mirage-crypto | git+https://github.com/mirage/mirage-crypto.git | h | mirage-crypto-2.1.0/ec/native/np521_32.h | /* Autogenerated: '../fiat-crypto/src/ExtractionOCaml/word_by_word_montgomery' --static --use-value-barrier --inline-internal np521 32 0x01FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFA51868783BF2F966B7FCC0148F709A5D03BB5C9B8899C47AEBB6FB71E91386409 mul add opp from_montgomery to_montgomery one msat... |
mirage-crypto | 2.1.0 | ISC | https://github.com/mirage/mirage-crypto | git+https://github.com/mirage/mirage-crypto.git | h | mirage-crypto-2.1.0/ec/native/np521_64.h | /* Autogenerated: '../fiat-crypto/src/ExtractionOCaml/word_by_word_montgomery' --static --use-value-barrier --inline-internal np521 64 0x01FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFA51868783BF2F966B7FCC0148F709A5D03BB5C9B8899C47AEBB6FB71E91386409 mul add opp from_montgomery to_montgomery one msat... |
mirage-crypto | 2.1.0 | ISC | https://github.com/mirage/mirage-crypto | git+https://github.com/mirage/mirage-crypto.git | c | mirage-crypto-2.1.0/ec/native/np521_stubs.c | #include "mirage_crypto.h"
/* Microsoft compiler does not support 128-bit integers. Drop down to
* 32-bit for MSVC.
*/
#if defined(ARCH_64BIT) && !defined(_MSC_VER)
#include "np521_64.h"
#define LIMBS 9
#define WORD uint64_t
#define WORDSIZE 64
#else
#include "np521_32.h"
#define LIMBS 17
#define WORD uint32_t
#defi... |
mirage-crypto | 2.1.0 | ISC | https://github.com/mirage/mirage-crypto | git+https://github.com/mirage/mirage-crypto.git | h | mirage-crypto-2.1.0/ec/native/p256_32.h | /* Autogenerated: '../fiat-crypto/src/ExtractionOCaml/word_by_word_montgomery' --static --use-value-barrier --inline-internal p256 32 '2^256 - 2^224 + 2^192 + 2^96 - 1' */
/* curve description: p256 */
/* machine_wordsize = 32 (from "32") */
/* requested operations: (all) */
/* m = 0xffffffff000000010000000000000000000... |
mirage-crypto | 2.1.0 | ISC | https://github.com/mirage/mirage-crypto | git+https://github.com/mirage/mirage-crypto.git | h | mirage-crypto-2.1.0/ec/native/p256_64.h | /* Autogenerated: '../fiat-crypto/src/ExtractionOCaml/word_by_word_montgomery' --static --use-value-barrier --inline-internal p256 64 '2^256 - 2^224 + 2^192 + 2^96 - 1' */
/* curve description: p256 */
/* machine_wordsize = 64 (from "64") */
/* requested operations: (all) */
/* m = 0xffffffff000000010000000000000000000... |
mirage-crypto | 2.1.0 | ISC | https://github.com/mirage/mirage-crypto | git+https://github.com/mirage/mirage-crypto.git | c | mirage-crypto-2.1.0/ec/native/p256_stubs.c | #include "mirage_crypto.h"
/* Microsoft compiler does not support 128-bit integers. Drop down to
* 32-bit for MSVC.
*/
#if defined(ARCH_64BIT) && !defined(_MSC_VER)
#include "p256_64.h"
#define LIMBS 4
#define WORD uint64_t
#define WORDSIZE 64
#include "p256_tables_64.h"
#else
#include "p256_32.h"
#define LIMBS 8
#d... |
mirage-crypto | 2.1.0 | ISC | https://github.com/mirage/mirage-crypto | git+https://github.com/mirage/mirage-crypto.git | h | mirage-crypto-2.1.0/ec/native/p256_tables_32.h |
/*
Pre-computed 32-bit multiples of the generator point G for the curve p256,
used for speeding up its scalar multiplication in point_operations.h.
Generated by ../../_build/default/ec/gen_tables/gen_tables.exe
*/
#ifdef ARCH_64BIT
#error "Cannot use 32-bit tables on a 64-bit architecture"
#endif
st... |
mirage-crypto | 2.1.0 | ISC | https://github.com/mirage/mirage-crypto | git+https://github.com/mirage/mirage-crypto.git | h | mirage-crypto-2.1.0/ec/native/p256_tables_64.h |
/*
Pre-computed 64-bit multiples of the generator point G for the curve p256,
used for speeding up its scalar multiplication in point_operations.h.
Generated by ../../_build/default/ec/gen_tables/gen_tables.exe
*/
#ifndef ARCH_64BIT
#error "Cannot use 64-bit tables on a 32-bit architecture"
#endif
s... |
mirage-crypto | 2.1.0 | ISC | https://github.com/mirage/mirage-crypto | git+https://github.com/mirage/mirage-crypto.git | h | mirage-crypto-2.1.0/ec/native/p384_32.h | /* Autogenerated: '../fiat-crypto/src/ExtractionOCaml/word_by_word_montgomery' --static --use-value-barrier --inline-internal p384 32 '2^384 - 2^128 - 2^96 + 2^32 - 1' */
/* curve description: p384 */
/* machine_wordsize = 32 (from "32") */
/* requested operations: (all) */
/* m = 0xffffffffffffffffffffffffffffffffffff... |
mirage-crypto | 2.1.0 | ISC | https://github.com/mirage/mirage-crypto | git+https://github.com/mirage/mirage-crypto.git | h | mirage-crypto-2.1.0/ec/native/p384_64.h | /* Autogenerated: '../fiat-crypto/src/ExtractionOCaml/word_by_word_montgomery' --static --use-value-barrier --inline-internal p384 64 '2^384 - 2^128 - 2^96 + 2^32 - 1' */
/* curve description: p384 */
/* machine_wordsize = 64 (from "64") */
/* requested operations: (all) */
/* m = 0xffffffffffffffffffffffffffffffffffff... |
mirage-crypto | 2.1.0 | ISC | https://github.com/mirage/mirage-crypto | git+https://github.com/mirage/mirage-crypto.git | c | mirage-crypto-2.1.0/ec/native/p384_stubs.c | #include "mirage_crypto.h"
/* Microsoft compiler does not support 128-bit integers. Drop down to
* 32-bit for MSVC.
*/
#if defined(ARCH_64BIT) && !defined(_MSC_VER)
#include "p384_64.h"
#define LIMBS 6
#define WORD uint64_t
#define WORDSIZE 64
#include "p384_tables_64.h"
#else
#include "p384_32.h"
#define LIMBS 12
#... |
mirage-crypto | 2.1.0 | ISC | https://github.com/mirage/mirage-crypto | git+https://github.com/mirage/mirage-crypto.git | h | mirage-crypto-2.1.0/ec/native/p384_tables_32.h |
/*
Pre-computed 32-bit multiples of the generator point G for the curve p384,
used for speeding up its scalar multiplication in point_operations.h.
Generated by ../../_build/default/ec/gen_tables/gen_tables.exe
*/
#ifdef ARCH_64BIT
#error "Cannot use 32-bit tables on a 64-bit architecture"
#endif
st... |
mirage-crypto | 2.1.0 | ISC | https://github.com/mirage/mirage-crypto | git+https://github.com/mirage/mirage-crypto.git | h | mirage-crypto-2.1.0/ec/native/p384_tables_64.h |
/*
Pre-computed 64-bit multiples of the generator point G for the curve p384,
used for speeding up its scalar multiplication in point_operations.h.
Generated by ../../_build/default/ec/gen_tables/gen_tables.exe
*/
#ifndef ARCH_64BIT
#error "Cannot use 64-bit tables on a 32-bit architecture"
#endif
s... |
mirage-crypto | 2.1.0 | ISC | https://github.com/mirage/mirage-crypto | git+https://github.com/mirage/mirage-crypto.git | h | mirage-crypto-2.1.0/ec/native/p521_32.h | /* Autogenerated: '../fiat-crypto/src/ExtractionOCaml/word_by_word_montgomery' --static --use-value-barrier --inline-internal p521 32 '2^521 - 1' */
/* curve description: p521 */
/* machine_wordsize = 32 (from "32") */
/* requested operations: (all) */
/* m = 0x1fffffffffffffffffffffffffffffffffffffffffffffffffffffffff... |
mirage-crypto | 2.1.0 | ISC | https://github.com/mirage/mirage-crypto | git+https://github.com/mirage/mirage-crypto.git | h | mirage-crypto-2.1.0/ec/native/p521_64.h | /* Autogenerated: '../fiat-crypto/src/ExtractionOCaml/word_by_word_montgomery' --static --use-value-barrier --inline-internal p521 64 '2^521 - 1' */
/* curve description: p521 */
/* machine_wordsize = 64 (from "64") */
/* requested operations: (all) */
/* m = 0x1fffffffffffffffffffffffffffffffffffffffffffffffffffffffff... |
mirage-crypto | 2.1.0 | ISC | https://github.com/mirage/mirage-crypto | git+https://github.com/mirage/mirage-crypto.git | c | mirage-crypto-2.1.0/ec/native/p521_stubs.c | #include "mirage_crypto.h"
/* Microsoft compiler does not support 128-bit integers. Drop down to
* 32-bit for MSVC.
*/
#if defined(ARCH_64BIT) && !defined(_MSC_VER)
#include "p521_64.h"
#define LIMBS 9
#define WORD uint64_t
#define WORDSIZE 64
#include "p521_tables_64.h"
#else
#include "p521_32.h"
#define LIMBS 17
#... |
mirage-crypto | 2.1.0 | ISC | https://github.com/mirage/mirage-crypto | git+https://github.com/mirage/mirage-crypto.git | h | mirage-crypto-2.1.0/ec/native/p521_tables_32.h |
/*
Pre-computed 32-bit multiples of the generator point G for the curve p521,
used for speeding up its scalar multiplication in point_operations.h.
Generated by ../../_build/default/ec/gen_tables/gen_tables.exe
*/
#ifdef ARCH_64BIT
#error "Cannot use 32-bit tables on a 64-bit architecture"
#endif
st... |
mirage-crypto | 2.1.0 | ISC | https://github.com/mirage/mirage-crypto | git+https://github.com/mirage/mirage-crypto.git | h | mirage-crypto-2.1.0/ec/native/p521_tables_64.h |
/*
Pre-computed 64-bit multiples of the generator point G for the curve p521,
used for speeding up its scalar multiplication in point_operations.h.
Generated by ../../_build/default/ec/gen_tables/gen_tables.exe
*/
#ifndef ARCH_64BIT
#error "Cannot use 64-bit tables on a 32-bit architecture"
#endif
s... |
mirage-crypto | 2.1.0 | ISC | https://github.com/mirage/mirage-crypto | git+https://github.com/mirage/mirage-crypto.git | h | mirage-crypto-2.1.0/ec/native/point_operations.h | #define MAKE_FN_NAME1(x,y) x ## y
#define MAKE_FN_NAME(x,y) MAKE_FN_NAME1(x,y)
#define fe_one MAKE_FN_NAME(CURVE_DESCRIPTION,_set_one)
#define fe_add MAKE_FN_NAME(CURVE_DESCRIPTION,_add)
#define fe_sub MAKE_FN_NAME(CURVE_DESCRIPTION,_sub)
#define fe_mul MAKE_FN_NAME(CURVE_DESCRIPTION,_mul)
#define fe_sqr MAKE_FN_NAM... |
mirage-crypto | 2.1.0 | ISC | https://github.com/mirage/mirage-crypto | git+https://github.com/mirage/mirage-crypto.git | opam | mirage-crypto-2.1.0/mirage-crypto-ec.opam | version: "2.1.0"
opam-version: "2.0"
synopsis: "Elliptic Curve Cryptography with primitives taken from Fiat"
description: """
An implementation of key exchange (ECDH) and digital signature (ECDSA/EdDSA)
algorithms using code from Fiat (<https://github.com/mit-plv/fiat-crypto>).
The curves P256 (SECP256R1), P384 (SECP3... |
mirage-crypto | 2.1.0 | ISC | https://github.com/mirage/mirage-crypto | git+https://github.com/mirage/mirage-crypto.git | opam | mirage-crypto-2.1.0/mirage-crypto-pk.opam | version: "2.1.0"
opam-version: "2.0"
homepage: "https://github.com/mirage/mirage-crypto"
dev-repo: "git+https://github.com/mirage/mirage-crypto.git"
bug-reports: "https://github.com/mirage/mirage-crypto/issues"
doc: "https://mirage.github.io/mirage-crypto/doc"
authors: ["David Kaloper <dk505@cam.... |
mirage-crypto | 2.1.0 | ISC | https://github.com/mirage/mirage-crypto | git+https://github.com/mirage/mirage-crypto.git | opam | mirage-crypto-2.1.0/mirage-crypto-rng-miou-unix.opam | version: "2.1.0"
opam-version: "2.0"
homepage: "https://github.com/mirage/mirage-crypto"
dev-repo: "git+https://github.com/mirage/mirage-crypto.git"
bug-reports: "https://github.com/mirage/mirage-crypto/issues"
doc: "https://mirage.github.io/mirage-crypto/doc"
authors: ["Romain Calascibetta <roma... |
mirage-crypto | 2.1.0 | ISC | https://github.com/mirage/mirage-crypto | git+https://github.com/mirage/mirage-crypto.git | opam | mirage-crypto-2.1.0/mirage-crypto-rng-mirage.opam | version: "2.1.0"
opam-version: "2.0"
homepage: "https://github.com/mirage/mirage-crypto"
dev-repo: "git+https://github.com/mirage/mirage-crypto.git"
bug-reports: "https://github.com/mirage/mirage-crypto/issues"
doc: "https://mirage.github.io/mirage-crypto/doc"
authors: ["David Kaloper <dk505@cam.... |
mirage-crypto | 2.1.0 | ISC | https://github.com/mirage/mirage-crypto | git+https://github.com/mirage/mirage-crypto.git | opam | mirage-crypto-2.1.0/mirage-crypto-rng-mkernel.opam | version: "2.1.0"
opam-version: "2.0"
homepage: "https://github.com/mirage/mirage-crypto"
dev-repo: "git+https://github.com/mirage/mirage-crypto.git"
bug-reports: "https://github.com/mirage/mirage-crypto/issues"
doc: "https://mirage.github.io/mirage-crypto/doc"
authors: ["Romain Calascibetta <roma... |
mirage-crypto | 2.1.0 | ISC | https://github.com/mirage/mirage-crypto | git+https://github.com/mirage/mirage-crypto.git | opam | mirage-crypto-2.1.0/mirage-crypto-rng.opam | version: "2.1.0"
opam-version: "2.0"
homepage: "https://github.com/mirage/mirage-crypto"
dev-repo: "git+https://github.com/mirage/mirage-crypto.git"
bug-reports: "https://github.com/mirage/mirage-crypto/issues"
doc: "https://mirage.github.io/mirage-crypto/doc"
authors: ["David Kaloper <dk505@cam.... |
mirage-crypto | 2.1.0 | ISC | https://github.com/mirage/mirage-crypto | git+https://github.com/mirage/mirage-crypto.git | opam | mirage-crypto-2.1.0/mirage-crypto.opam | version: "2.1.0"
opam-version: "2.0"
homepage: "https://github.com/mirage/mirage-crypto"
dev-repo: "git+https://github.com/mirage/mirage-crypto.git"
bug-reports: "https://github.com/mirage/mirage-crypto/issues"
doc: "https://mirage.github.io/mirage-crypto/doc"
authors: ["David Kaloper <dk505@cam.... |
mirage-crypto | 2.1.0 | ISC | https://github.com/mirage/mirage-crypto | git+https://github.com/mirage/mirage-crypto.git | ml | mirage-crypto-2.1.0/mirage/config.ml | open Mirage
let main =
let packages = [
package "mirage-crypto-rng" ;
package "mirage-crypto-pk" ;
package "mirage-crypto" ;
package ~min:"0.8.7" "fmt" ;
package "ohex" ;
]
in
main ~packages "Unikernel" job
let () =
register "crypto-test" [main]
|
mirage-crypto | 2.1.0 | ISC | https://github.com/mirage/mirage-crypto | git+https://github.com/mirage/mirage-crypto.git | ml | mirage-crypto-2.1.0/mirage/unikernel.ml | let start () =
Logs.info (fun m -> m "using Fortuna, entropy sources: %a"
Fmt.(list ~sep:(any ", ") Mirage_crypto_rng.Entropy.pp_source)
(Mirage_crypto_rng.Entropy.sources ())) ;
Logs.info (fun m -> m "64 byte random:@ %a" (Ohex.pp_hexdump ())
(Mirage_crypto_rng.gener... |
mirage-crypto | 2.1.0 | ISC | https://github.com/mirage/mirage-crypto | git+https://github.com/mirage/mirage-crypto.git | ml | mirage-crypto-2.1.0/pk/common.ml | let rec until p f = let r = f () in if p r then r else until p f
let guard p err = if p then Ok () else Error err
let ( let* ) = Result.bind
|
mirage-crypto | 2.1.0 | ISC | https://github.com/mirage/mirage-crypto | git+https://github.com/mirage/mirage-crypto.git | ml | mirage-crypto-2.1.0/pk/dh.ml | open Mirage_crypto.Uncommon
open Common
exception Invalid_key
type group = {
p : Z.t ; (* The prime modulus *)
gg : Z.t ; (* Group generator *)
q : Z.t option ; (* `gg`'s order, maybe *)
}
let group ~p ~gg ?q () =
let* () =
guard (Z.(p > zero && is_odd p) && Z_extra.pseudoprime p)
... |
mirage-crypto | 2.1.0 | ISC | https://github.com/mirage/mirage-crypto | git+https://github.com/mirage/mirage-crypto.git | ml | mirage-crypto-2.1.0/pk/dsa.ml | open Mirage_crypto.Uncommon
open Common
type pub = { p : Z.t ; q : Z.t ; gg : Z.t ; y : Z.t }
let pub ?(fips = false) ~p ~q ~gg ~y () =
let* () = guard Z.(one < gg && gg < p) (`Msg "bad generator") in
let* () = guard (Z_extra.pseudoprime q) (`Msg "q is not prime") in
let* () = guard (Z.is_odd p && Z_extra.pseu... |
mirage-crypto | 2.1.0 | ISC | https://github.com/mirage/mirage-crypto | git+https://github.com/mirage/mirage-crypto.git | dune | mirage-crypto-2.1.0/pk/dune | (library
(name mirage_crypto_pk)
(public_name mirage-crypto-pk)
(libraries zarith mirage-crypto mirage-crypto-rng eqaf)
(private_modules common dh dsa rsa z_extra))
|
mirage-crypto | 2.1.0 | ISC | https://github.com/mirage/mirage-crypto | git+https://github.com/mirage/mirage-crypto.git | ml | mirage-crypto-2.1.0/pk/mirage_crypto_pk.ml | module Dh = Dh
module Dsa = Dsa
module Rsa = Rsa
module Z_extra = Z_extra
|
mirage-crypto | 2.1.0 | ISC | https://github.com/mirage/mirage-crypto | git+https://github.com/mirage/mirage-crypto.git | mli | mirage-crypto-2.1.0/pk/mirage_crypto_pk.mli | (** {1 Public-key cryptography} *)
(** Public and private key types are private, the constructors validate their
well-formedness as much as possible, esp. so that [powm_sec] will not raise
an exception (exponent > 1, or odd modulus). All modular exponentiations
(unless otherwise noted) use the {!Z.powm_sec... |
mirage-crypto | 2.1.0 | ISC | https://github.com/mirage/mirage-crypto | git+https://github.com/mirage/mirage-crypto.git | ml | mirage-crypto-2.1.0/pk/rsa.ml | open Mirage_crypto.Uncommon
open Common
let two = Z.(~$2)
and three = Z.(~$3)
(* A constant-time [find_uint8] with a default value. *)
let ct_find_uint8 ~default ?off ~f cs =
let res = Eqaf.find_uint8 ?off ~f cs in
Eqaf.select_int (res + 1) default res
let (&.) f g = fun h -> f (g h)
type 'a or_digest = [ `Mes... |
mirage-crypto | 2.1.0 | ISC | https://github.com/mirage/mirage-crypto | git+https://github.com/mirage/mirage-crypto.git | ml | mirage-crypto-2.1.0/pk/z_extra.ml | open Mirage_crypto.Uncommon
let bit_bound z = Z.size z * 64
let of_octets_be ?bits buf =
let rec loop acc i = function
| b when b >= 64 ->
let x = String.get_int64_be buf i in
let x = Z.of_int64_unsigned Int64.(shift_right_logical x 8) in
loop Z.(x + acc lsl 56) (i + 7) (b - 56)
| b when b... |
mirage-crypto | 2.1.0 | ISC | https://github.com/mirage/mirage-crypto | git+https://github.com/mirage/mirage-crypto.git | dune | mirage-crypto-2.1.0/rng/dune | (library
(name mirage_crypto_rng)
(public_name mirage-crypto-rng)
(libraries mirage-crypto digestif logs)
(private_modules entropy fortuna hmac_drbg rng))
|
mirage-crypto | 2.1.0 | ISC | https://github.com/mirage/mirage-crypto | git+https://github.com/mirage/mirage-crypto.git | ml | mirage-crypto-2.1.0/rng/entropy.ml | (*
* Copyright (c) 2014 Hannes Mehnert
* Copyright (c) 2014 Anil Madhavapeddy <anil@recoil.org>
* Copyright (c) 2014-2016 David Kaloper Meršinjak
* Copyright (c) 2015 Citrix Systems Inc
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted pr... |
mirage-crypto | 2.1.0 | ISC | https://github.com/mirage/mirage-crypto | git+https://github.com/mirage/mirage-crypto.git | ml | mirage-crypto-2.1.0/rng/fortuna.ml | (* NOTE: when modifying this file, please also check whether
rng/miou/pfortuna.ml needs to be updated. *)
open Mirage_crypto
open Mirage_crypto.Uncommon
module SHAd256 = struct
open Digestif
type t = SHA256.t
type ctx = SHA256.ctx
let empty = SHA256.empty
let get t = SHA256.(get t |> to_raw_strin... |
mirage-crypto | 2.1.0 | ISC | https://github.com/mirage/mirage-crypto | git+https://github.com/mirage/mirage-crypto.git | ml | mirage-crypto-2.1.0/rng/hmac_drbg.ml | module Make (H : Digestif.S) = struct
type g =
{ mutable k : string
; mutable v : string
; mutable seeded : bool
}
let block = H.digest_size
let (bx00, bx01) = "\x00", "\x01"
let k0 = String.make H.digest_size '\x00'
and v0 = String.make H.digest_size '\x01'
let create ?time:_ ... |
mirage-crypto | 2.1.0 | ISC | https://github.com/mirage/mirage-crypto | git+https://github.com/mirage/mirage-crypto.git | dune | mirage-crypto-2.1.0/rng/miou/dune | (library
(name mirage_crypto_rng_miou_unix)
(public_name mirage-crypto-rng-miou-unix)
(libraries miou miou.unix mirage-crypto mirage-crypto-rng mirage-crypto-rng.unix digestif duration mtime.clock.os logs)
(modules mirage_crypto_rng_miou_unix pfortuna))
(library
(name mirage_crypto_rng_mkernel)
(public_name mira... |
mirage-crypto | 2.1.0 | ISC | https://github.com/mirage/mirage-crypto | git+https://github.com/mirage/mirage-crypto.git | ml | mirage-crypto-2.1.0/rng/miou/mirage_crypto_rng_miou_unix.ml | open Mirage_crypto_rng
module Pfortuna = Pfortuna
type _ Effect.t += Spawn : (unit -> unit) -> unit Effect.t
external reraise : exn -> 'a = "%reraise"
let periodic fn delta =
let rec one () =
fn ();
Miou_unix.sleep (Duration.to_f delta);
one () in
Effect.perform (Spawn one)
let getrandom delta sourc... |
mirage-crypto | 2.1.0 | ISC | https://github.com/mirage/mirage-crypto | git+https://github.com/mirage/mirage-crypto.git | mli | mirage-crypto-2.1.0/rng/miou/mirage_crypto_rng_miou_unix.mli | (** {b RNG} seeding on {b Miou_unix}.
This module initializes a RNG with [getrandom()], and CPU RNG. On BSD system
(FreeBSD, OpenBSD, MacOS) [getentropy()] is used instead of [getrandom()].
On Windows 10 or higher, [BCryptGenRandom()] is used with the default RNG.
Windows 8 or lower are not supported b... |
mirage-crypto | 2.1.0 | ISC | https://github.com/mirage/mirage-crypto | git+https://github.com/mirage/mirage-crypto.git | ml | mirage-crypto-2.1.0/rng/miou/mirage_crypto_rng_mkernel.ml | let src = Logs.Src.create "mirage-crypto-rng.miou-solo5"
module Log = (val Logs.src_log src : Logs.LOG)
open Mirage_crypto_rng
let periodic fn delta =
let rec one () =
let () = fn () in
let () = Mkernel.sleep delta in
one () in
Miou.async one
let rdrand delta =
match Entropy.cpu_rng with
| Error... |
mirage-crypto | 2.1.0 | ISC | https://github.com/mirage/mirage-crypto | git+https://github.com/mirage/mirage-crypto.git | mli | mirage-crypto-2.1.0/rng/miou/mirage_crypto_rng_mkernel.mli | (** {b RNG} seeding on {b Mkernel}. *)
type rng
(** Type of tasks seeding the RNG. *)
val initialize : ?g:'a -> ?sleep:int -> 'a Mirage_crypto_rng.generator -> rng
(** [initialize ~g ~sleep generator] sets the default generator to the
[generator] and sets up periodic entropy feeding for that rng. The argument
... |
mirage-crypto | 2.1.0 | ISC | https://github.com/mirage/mirage-crypto | git+https://github.com/mirage/mirage-crypto.git | ml | mirage-crypto-2.1.0/rng/miou/pfortuna.ml | (* Pfortuna is a re-implementation of Fortuna with a mutex. The goal of this
module is to provide a global and domain-safe RNG. The implementation use
[Miou.Mutex] instead of [Mutex] - [Pfortuna] is only available as part of
the [mirage-crypto-rng-miou-unix] package. Thus, in the context of Miou,
[Pfortuna]... |
mirage-crypto | 2.1.0 | ISC | https://github.com/mirage/mirage-crypto | git+https://github.com/mirage/mirage-crypto.git | mli | mirage-crypto-2.1.0/rng/miou/pfortuna.mli | include Mirage_crypto_rng.Generator
|
mirage-crypto | 2.1.0 | ISC | https://github.com/mirage/mirage-crypto | git+https://github.com/mirage/mirage-crypto.git | dune | mirage-crypto-2.1.0/rng/mirage/dune | (library
(name mirage_crypto_rng_mirage)
(public_name mirage-crypto-rng-mirage)
(libraries lwt mirage-runtime mirage-crypto-rng mirage-sleep mirage-mtime
duration logs))
|
mirage-crypto | 2.1.0 | ISC | https://github.com/mirage/mirage-crypto | git+https://github.com/mirage/mirage-crypto.git | ml | mirage-crypto-2.1.0/rng/mirage/mirage_crypto_rng_mirage.ml | (*
* Copyright (c) 2014 Hannes Mehnert
* Copyright (c) 2014 Anil Madhavapeddy <anil@recoil.org>
* Copyright (c) 2014-2016 David Kaloper Meršinjak
* Copyright (c) 2015 Citrix Systems Inc
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted pr... |
mirage-crypto | 2.1.0 | ISC | https://github.com/mirage/mirage-crypto | git+https://github.com/mirage/mirage-crypto.git | mli | mirage-crypto-2.1.0/rng/mirage/mirage_crypto_rng_mirage.mli | (*
* Copyright (c) 2014 Hannes Mehnert
* Copyright (c) 2014 Anil Madhavapeddy <anil@recoil.org>
* Copyright (c) 2014-2016 David Kaloper Meršinjak
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are ... |
mirage-crypto | 2.1.0 | ISC | https://github.com/mirage/mirage-crypto | git+https://github.com/mirage/mirage-crypto.git | ml | mirage-crypto-2.1.0/rng/mirage_crypto_rng.ml | include Rng
module Fortuna = Fortuna
module Hmac_drbg = Hmac_drbg.Make
module Entropy = Entropy
|
mirage-crypto | 2.1.0 | ISC | https://github.com/mirage/mirage-crypto | git+https://github.com/mirage/mirage-crypto.git | mli | mirage-crypto-2.1.0/rng/mirage_crypto_rng.mli | (** {1 Randomness} *)
(** Secure random number generation.
There are several parts of this module:
{ul
{- The {{!Generator}signature} of generator modules, together with a
facility to convert such modules into actual {{!g}generators}, and
functions that operate on this representation.}
... |
mirage-crypto | 2.1.0 | ISC | https://github.com/mirage/mirage-crypto | git+https://github.com/mirage/mirage-crypto.git | ml | mirage-crypto-2.1.0/rng/rng.ml | type source = int * string
exception Unseeded_generator
exception No_default_generator
let setup_rng =
"\nPlease setup your default random number generator. On Unix, the best \
path is to call [Mirage_crypto_rng_unix.use_default ()].\
\nBut you can use Fortuna (or any other RNG) and setup the seeding \
(d... |
mirage-crypto | 2.1.0 | ISC | https://github.com/mirage/mirage-crypto | git+https://github.com/mirage/mirage-crypto.git | ml | mirage-crypto-2.1.0/rng/unix/discover.ml | let () =
let open Configurator.V1 in
main ~name:"rng_flags" (fun _t ->
let c_lib_flags =
match Sys.os_type with
| "Win32" | "Cygwin" -> ["-lbcrypt"]
| _ -> []
in
Flags.write_sexp "rng_c_flags.sexp" c_lib_flags
)
|
mirage-crypto | 2.1.0 | ISC | https://github.com/mirage/mirage-crypto | git+https://github.com/mirage/mirage-crypto.git | dune | mirage-crypto-2.1.0/rng/unix/dune | (executable
(name discover)
(modules discover)
(libraries dune-configurator))
(rule
(targets rng_c_flags.sexp)
(action
(run ./discover.exe)))
(rule
(targets cflags_warn.sexp)
(action
(run ../../config/cfg.exe)))
(library
(name mirage_crypto_rng_unix)
(public_name mirage-crypto-rng.unix)
(modules mirage... |
mirage-crypto | 2.1.0 | ISC | https://github.com/mirage/mirage-crypto | git+https://github.com/mirage/mirage-crypto.git | ml | mirage-crypto-2.1.0/rng/unix/getentropy.ml |
external getrandom_buf : bytes -> int -> int -> unit = "mc_getrandom" [@@noalloc]
type g = unit
(* The maximum value for length is GETENTROPY_MAX for `getentropy`: https://pubs.opengroup.org/onlinepubs/9799919799/functions/getentropy.html
The minimum acceptable value for GETENTROPY_MAX is 256 https://pubs.opengr... |
mirage-crypto | 2.1.0 | ISC | https://github.com/mirage/mirage-crypto | git+https://github.com/mirage/mirage-crypto.git | c | mirage-crypto-2.1.0/rng/unix/mc_getrandom_stubs.c | #ifndef _MSC_VER
# include <unistd.h>
#endif
#include "mirage_crypto.h"
#include <caml/mlvalues.h>
#include <caml/memory.h>
#include <caml/unixsupport.h>
#include <caml/bigarray.h>
#if defined(__ANDROID_API__) && __ANDROID_API__ < 28
// on Android 27 and earlier, we use Google's <sys/random.h> recommended arc4random... |
mirage-crypto | 2.1.0 | ISC | https://github.com/mirage/mirage-crypto | git+https://github.com/mirage/mirage-crypto.git | ml | mirage-crypto-2.1.0/rng/unix/mirage_crypto_rng_unix.ml | open Mirage_crypto_rng
module Urandom = Urandom
module Getentropy = Getentropy
let use_dev_urandom () =
let g = create (module Urandom) in
set_default_generator g
let use_getentropy () =
let g = create (module Getentropy) in
set_default_generator g
let use_default () = use_getentropy ()
let src = Logs.Src... |
mirage-crypto | 2.1.0 | ISC | https://github.com/mirage/mirage-crypto | git+https://github.com/mirage/mirage-crypto.git | mli | mirage-crypto-2.1.0/rng/unix/mirage_crypto_rng_unix.mli | (** {b RNG} seeding on {b Unix}.
This module initializes a Fortuna RNG with [getrandom()], and CPU RNG.
On BSD systems (FreeBSD, OpenBSD, macOS) [getentropy ()] is used instead
of [getrandom ()]. On Windows 10 or higher, [BCryptGenRandom()] is used
with the default RNG. Windows 8 or lower are not suppo... |
mirage-crypto | 2.1.0 | ISC | https://github.com/mirage/mirage-crypto | git+https://github.com/mirage/mirage-crypto.git | ml | mirage-crypto-2.1.0/rng/unix/urandom.ml |
type g = In_channel.t * Mutex.t
(* The OCaml runtime always reads at least IO_BUFFER_SIZE from an input channel, which is currently 64 KiB *)
let block = 65536
let create ?time:_ () =
let ic = In_channel.open_bin "/dev/urandom"
and mutex = Mutex.create ()
in
at_exit (fun () -> In_channel.close ic);
(ic, mu... |
mirage-crypto | 2.1.0 | ISC | https://github.com/mirage/mirage-crypto | git+https://github.com/mirage/mirage-crypto.git | ml | mirage-crypto-2.1.0/src/aead.ml | module type AEAD = sig
val tag_size : int
type key
val of_secret : string -> key
val authenticate_encrypt : key:key -> nonce:string -> ?adata:string ->
string -> string
val authenticate_decrypt : key:key -> nonce:string -> ?adata:string ->
string -> string option
val authenticate_encrypt_tag : key:k... |
mirage-crypto | 2.1.0 | ISC | https://github.com/mirage/mirage-crypto | git+https://github.com/mirage/mirage-crypto.git | ml | mirage-crypto-2.1.0/src/ccm.ml | open Uncommon
let block_size = 16
let flags bit6 len1 len2 =
bit6 lsl 6 + len1 lsl 3 + len2
let encode_len buf ~off size value =
let rec ass num = function
| 0 -> Bytes.set_uint8 buf off num
| m ->
Bytes.set_uint8 buf (off + m) (num land 0xff);
(ass [@tailcall]) (num lsr 8) (pred m)
in
as... |
mirage-crypto | 2.1.0 | ISC | https://github.com/mirage/mirage-crypto | git+https://github.com/mirage/mirage-crypto.git | ml | mirage-crypto-2.1.0/src/chacha20.ml | (* Based on https://github.com/abeaumont/ocaml-chacha.git *)
open Uncommon
let block = 64
type key = string
let of_secret a = a
let chacha20_block state idx key_stream =
Native.Chacha.round 10 state key_stream idx
let init ctr ~key ~nonce =
let ctr_off = 48 in
let set_ctr32 b v = Bytes.set_int32_le b ctr_of... |
mirage-crypto | 2.1.0 | ISC | https://github.com/mirage/mirage-crypto | git+https://github.com/mirage/mirage-crypto.git | ml | mirage-crypto-2.1.0/src/cipher_block.ml | open Uncommon
module Block = struct
module type Core = sig
type ekey
type dkey
val of_secret : string -> ekey * dkey
val e_of_secret : string -> ekey
val d_of_secret : string -> dkey
val key : int array
val block : int
(* XXX currently unsafe point *)
val encrypt : key:ek... |
mirage-crypto | 2.1.0 | ISC | https://github.com/mirage/mirage-crypto | git+https://github.com/mirage/mirage-crypto.git | ml | mirage-crypto-2.1.0/src/cipher_stream.ml | open Uncommon
module type Stream = sig
type key
type result = { message : string ; key : key }
val of_secret : string -> key
val encrypt : key:key -> string -> result
val decrypt : key:key -> string -> result
end
module ARC4 = struct
type key = int * int * int array
type result = { message : string ; ... |
mirage-crypto | 2.1.0 | ISC | https://github.com/mirage/mirage-crypto | git+https://github.com/mirage/mirage-crypto.git | dune | mirage-crypto-2.1.0/src/dune | (library
(name mirage_crypto)
(public_name mirage-crypto)
(libraries eqaf)
(private_modules aead chacha20 ccm cipher_block cipher_stream native
poly1305 uncommon)
(foreign_stubs
(language c)
(names detect_cpu_features misc misc_sse aes_generic aes_aesni ghash_generic
ghash_pclmul ghash_ctmul des_generic... |
mirage-crypto | 2.1.0 | ISC | https://github.com/mirage/mirage-crypto | git+https://github.com/mirage/mirage-crypto.git | ml | mirage-crypto-2.1.0/src/mirage_crypto.ml | module Uncommon = Uncommon
module Poly1305 = Poly1305.It
module type AEAD = Aead.AEAD
include Cipher_block
module Chacha20 = Chacha20
include Cipher_stream
|
mirage-crypto | 2.1.0 | ISC | https://github.com/mirage/mirage-crypto | git+https://github.com/mirage/mirage-crypto.git | mli | mirage-crypto-2.1.0/src/mirage_crypto.mli | (** Simpler crypto
Mirage-crypto is a cryptographic library.
The overarching API principle is simply mapping inputs to outputs, wherever
feasible.
Similar algorithms in the same class (like {{!Hash}hashes} or
{{!Cipher_block}block ciphers}) are presented as distinct modules sharing
the same s... |
mirage-crypto | 2.1.0 | ISC | https://github.com/mirage/mirage-crypto | git+https://github.com/mirage/mirage-crypto.git | ml | mirage-crypto-2.1.0/src/native.ml |
module AES = struct
external enc : string -> int -> bytes -> int -> string -> int -> int -> unit = "mc_aes_enc_bc" "mc_aes_enc" [@@noalloc]
external dec : string -> int -> bytes -> int -> string -> int -> int -> unit = "mc_aes_dec_bc" "mc_aes_dec" [@@noalloc]
external derive_e : string -> bytes -> int ... |
mirage-crypto | 2.1.0 | ISC | https://github.com/mirage/mirage-crypto | git+https://github.com/mirage/mirage-crypto.git | c | mirage-crypto-2.1.0/src/native/aes_aesni.c | /* Copyright (c) 2015 David Kaloper Meršinjak. All rights reserved.
See LICENSE.md. */
/* AES using AES-NI and SSE2.
*
* References:
* - Intel Advanced Encryption Standard (AES) New Instructions Set. Shay Gueron.
* https://software.intel.com/sites/default/files/article/165683/aes-wp-2012-09-22-v01.pdf
*/
#i... |
mirage-crypto | 2.1.0 | ISC | https://github.com/mirage/mirage-crypto | git+https://github.com/mirage/mirage-crypto.git | c | mirage-crypto-2.1.0/src/native/aes_generic.c | /*
* public domain
* Philip J. Erdelsky
* http://www.efgh.com/software/rijndael.htm
*/
#include "mirage_crypto.h"
#define KEYLENGTH(keybits) ((keybits)/8)
#define RKLENGTH(keybits) ((keybits)/8+28)
#define NROUNDS(keybits) ((keybits)/32+6)
#define FULL_UNROLL
static const uint32_t Te0[256] =
{
0xc66363a5U,... |
mirage-crypto | 2.1.0 | ISC | https://github.com/mirage/mirage-crypto | git+https://github.com/mirage/mirage-crypto.git | h | mirage-crypto-2.1.0/src/native/bitfn.h | /*
* Copyright (C) 2006-2009 Vincent Hanquez <vincent@snarc.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of con... |
mirage-crypto | 2.1.0 | ISC | https://github.com/mirage/mirage-crypto | git+https://github.com/mirage/mirage-crypto.git | c | mirage-crypto-2.1.0/src/native/chacha.c | /* Based on https://github.com/abeaumont/ocaml-chacha.git */
#include "mirage_crypto.h"
extern void mc_chacha_core_generic(int count, const uint32_t *src, uint32_t *dst);
#ifdef __mc_ACCELERATE__
static inline void mc_chacha_quarterround(uint32_t *x, int a, int b, int c, int d) {
x[a] += x[b]; x[d] = rol32(x[d] ^... |
mirage-crypto | 2.1.0 | ISC | https://github.com/mirage/mirage-crypto | git+https://github.com/mirage/mirage-crypto.git | c | mirage-crypto-2.1.0/src/native/chacha_generic.c | /* Based on https://github.com/abeaumont/ocaml-chacha.git */
#include "mirage_crypto.h"
static inline void mc_chacha_quarterround(uint32_t *x, int a, int b, int c, int d) {
x[a] += x[b]; x[d] = rol32(x[d] ^ x[a], 16);
x[c] += x[d]; x[b] = rol32(x[b] ^ x[c], 12);
x[a] += x[b]; x[d] = rol32(x[d] ^ x[a], 8);
x[c... |
mirage-crypto | 2.1.0 | ISC | https://github.com/mirage/mirage-crypto | git+https://github.com/mirage/mirage-crypto.git | c | mirage-crypto-2.1.0/src/native/des_generic.c | /* D3DES (V5.09) -
*
* A portable, public domain, version of the Data Encryption Standard.
*
* Written with Symantec's THINK (Lightspeed) C by Richard Outerbridge.
* Thanks to: Dan Hoey for his excellent Initial and Inverse permutation
* code; Jim Gillogly & Phil Karn for the DES key schedule code; Dennis
* Fer... |
mirage-crypto | 2.1.0 | ISC | https://github.com/mirage/mirage-crypto | git+https://github.com/mirage/mirage-crypto.git | c | mirage-crypto-2.1.0/src/native/detect_cpu_features.c | #include "mirage_crypto.h"
#ifdef __mc_detect_features__
#ifndef _MSC_VER
# include <cpuid.h>
#endif
struct _mc_cpu_features mc_detected_cpu_features = { 0 };
#ifdef _MSC_VER
#define bit_PCLMUL ((int)1 << 1)
#define bit_SSSE3 ((int)1 << 9)
#define bit_AES ((int)1 << 25)
#define bit_RDRND ((int)1 << 30)
#define bit_... |
mirage-crypto | 2.1.0 | ISC | https://github.com/mirage/mirage-crypto | git+https://github.com/mirage/mirage-crypto.git | c | mirage-crypto-2.1.0/src/native/entropy_cpu_stubs.c | /*
* Copyright (c) 2015-2016 David Kaloper Meršinjak
*/
#define _POSIX_C_SOURCE 199309L
#include <caml/mlvalues.h>
#include "mirage_crypto.h"
#if defined (__i386__) || defined (__x86_64__)
#include <x86intrin.h>
#if defined (__x86_64__)
#define random_t unsigned long long
#define _rdseed_step _rdseed64_step
#def... |
mirage-crypto | 2.1.0 | ISC | https://github.com/mirage/mirage-crypto | git+https://github.com/mirage/mirage-crypto.git | c | mirage-crypto-2.1.0/src/native/ghash_ctmul.c | /*
* Copyright (c) 2016 Thomas Pornin <pornin@bolet.org>
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, m... |
mirage-crypto | 2.1.0 | ISC | https://github.com/mirage/mirage-crypto | git+https://github.com/mirage/mirage-crypto.git | c | mirage-crypto-2.1.0/src/native/ghash_generic.c | /* Copyright (c) 2017 David Kaloper Meršinjak. All rights reserved.
See LICENSE.md. */
#include "mirage_crypto.h"
#include <string.h>
/* Generic table-driven GHASH.
*
* References:
* - The Galois/Counter Mode of Operation. David A. McGrew and John Viega.
* - NIST SP 800-38D. Recommendation for Block Cipher Mod... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.