├── dune-project ├── index.mld ├── raw ├── META ├── INFO.txt ├── lib │ ├── Lib_RandomBuffer_System_bindings.ml │ ├── EverCrypt_Poly1305_bindings.ml │ ├── Hacl_HMAC_Blake2b_256_bindings.ml │ ├── Hacl_HMAC_Blake2s_128_bindings.ml │ ├── EverCrypt_Cipher_bindings.ml │ ├── Hacl_Poly1305_128_bindings.ml │ ├── Hacl_Poly1305_256_bindings.ml │ ├── EverCrypt_StaticConfig_bindings.ml │ ├── Hacl_Hash_Blake2b_256_bindings.ml │ ├── Hacl_Hash_Blake2s_128_bindings.ml │ ├── Hacl_Curve25519_51_bindings.ml │ ├── Hacl_Curve25519_64_bindings.ml │ ├── Hacl_IntTypes_Intrinsics_128_bindings.ml │ ├── EverCrypt_Curve25519_bindings.ml │ ├── Hacl_Curve25519_64_Slow_bindings.ml │ ├── Hacl_HKDF_Blake2b_256_bindings.ml │ ├── Hacl_HKDF_Blake2s_128_bindings.ml │ ├── Hacl_Chacha20_Vec32_bindings.ml │ ├── Hacl_Chacha20_Vec128_bindings.ml │ ├── Hacl_Chacha20_Vec256_bindings.ml │ ├── Hacl_SHA2_Scalar32_bindings.ml │ ├── EverCrypt_Vale_bindings.ml │ ├── Hacl_Bignum_Base_bindings.ml │ ├── Hacl_Hash_Base_bindings.ml │ ├── EverCrypt_Error_bindings.ml │ ├── Hacl_Chacha20Poly1305_32_bindings.ml │ ├── Hacl_Chacha20Poly1305_128_bindings.ml │ ├── Hacl_Chacha20Poly1305_256_bindings.ml │ ├── EverCrypt_Chacha20Poly1305_bindings.ml │ ├── EverCrypt_Ed25519_bindings.ml │ ├── Hacl_Salsa20_bindings.ml │ ├── Hacl_SHA2_Vec128_bindings.ml │ ├── Hacl_IntTypes_Intrinsics_bindings.ml │ ├── Hacl_Frodo64_bindings.ml │ ├── Hacl_Bignum25519_51_bindings.ml │ ├── Hacl_Frodo640_bindings.ml │ ├── Hacl_Frodo976_bindings.ml │ ├── Hacl_Poly1305_32_bindings.ml │ ├── Hacl_Frodo1344_bindings.ml │ ├── Hacl_Hash_MD5_bindings.ml │ ├── Hacl_Hash_SHA1_bindings.ml │ ├── Hacl_Chacha20_bindings.ml │ ├── Hacl_Streaming_MD5_bindings.ml │ ├── Hacl_Streaming_SHA1_bindings.ml │ ├── Hacl_HMAC_bindings.ml │ ├── Hacl_FFDHE_bindings.ml │ ├── Hacl_HPKE_P256_CP32_SHA256_bindings.ml │ ├── Hacl_HPKE_P256_CP128_SHA256_bindings.ml │ ├── Hacl_HPKE_P256_CP256_SHA256_bindings.ml │ ├── Hacl_HPKE_Curve51_CP32_SHA256_bindings.ml │ ├── Hacl_HPKE_Curve51_CP32_SHA512_bindings.ml │ ├── Hacl_HPKE_Curve64_CP32_SHA256_bindings.ml │ ├── Hacl_HPKE_Curve64_CP32_SHA512_bindings.ml │ ├── Hacl_HPKE_Curve51_CP128_SHA256_bindings.ml │ ├── Hacl_HPKE_Curve51_CP128_SHA512_bindings.ml │ ├── Hacl_HPKE_Curve51_CP256_SHA256_bindings.ml │ ├── Hacl_HPKE_Curve51_CP256_SHA512_bindings.ml │ ├── Hacl_HPKE_Curve64_CP128_SHA256_bindings.ml │ ├── Hacl_HPKE_Curve64_CP128_SHA512_bindings.ml │ ├── Hacl_HPKE_Curve64_CP256_SHA256_bindings.ml │ ├── Hacl_HPKE_Curve64_CP256_SHA512_bindings.ml │ └── EverCrypt_CTR_bindings.ml ├── lib_gen │ ├── Hacl_HKDF_gen.ml │ ├── Hacl_NaCl_gen.ml │ ├── Hacl_SHA3_gen.ml │ ├── Hacl_FFDHE_gen.ml │ ├── Hacl_HMAC_gen.ml │ ├── Hacl_P256_gen.ml │ ├── Hacl_RSAPSS_gen.ml │ ├── Hacl_Spec_gen.ml │ ├── Hacl_Frodo64_gen.ml │ ├── Hacl_Salsa20_gen.ml │ ├── Hacl_Bignum_gen.ml │ ├── EverCrypt_CTR_gen.ml │ ├── Hacl_Bignum32_gen.ml │ ├── Hacl_Bignum64_gen.ml │ ├── Hacl_Frodo640_gen.ml │ ├── Hacl_Frodo976_gen.ml │ ├── EverCrypt_AEAD_gen.ml │ ├── EverCrypt_DRBG_gen.ml │ ├── EverCrypt_HKDF_gen.ml │ ├── EverCrypt_HMAC_gen.ml │ ├── EverCrypt_Hash_gen.ml │ ├── EverCrypt_Vale_gen.ml │ ├── Hacl_Bignum256_gen.ml │ ├── Hacl_Frodo1344_gen.ml │ ├── Hacl_HMAC_DRBG_gen.ml │ ├── Hacl_Hash_Base_gen.ml │ ├── EverCrypt_Error_gen.ml │ ├── Hacl_Bignum4096_gen.ml │ ├── Hacl_EC_Ed25519_gen.ml │ ├── EverCrypt_Cipher_gen.ml │ ├── Hacl_Bignum_Base_gen.ml │ ├── Hacl_Poly1305_32_gen.ml │ ├── Hacl_SHA2_Vec128_gen.ml │ ├── EverCrypt_Ed25519_gen.ml │ ├── Hacl_Bignum256_32_gen.ml │ ├── EverCrypt_Poly1305_gen.ml │ ├── Hacl_Bignum4096_32_gen.ml │ ├── Hacl_Curve25519_64_gen.ml │ ├── Hacl_SHA2_Scalar32_gen.ml │ ├── Hacl_Streaming_MD5_gen.ml │ ├── Lib_RandomBuffer_System_gen.ml │ ├── Hacl_Bignum25519_51_gen.ml │ ├── Hacl_Chacha20_Vec32_gen.ml │ ├── Hacl_GenericField32_gen.ml │ ├── Hacl_GenericField64_gen.ml │ ├── Hacl_Streaming_SHA1_gen.ml │ ├── Hacl_Streaming_SHA2_gen.ml │ ├── EverCrypt_Curve25519_gen.ml │ ├── Hacl_Chacha20_Vec128_gen.ml │ ├── Hacl_Chacha20_Vec256_gen.ml │ ├── Hacl_Ed25519_gen.ml │ ├── EverCrypt_AutoConfig2_gen.ml │ ├── Hacl_Chacha20_gen.ml │ ├── Hacl_HKDF_Blake2b_256_gen.ml │ ├── Hacl_HKDF_Blake2s_128_gen.ml │ ├── Hacl_HMAC_Blake2b_256_gen.ml │ ├── Hacl_HMAC_Blake2s_128_gen.ml │ ├── Hacl_Hash_MD5_gen.ml │ ├── Hacl_Streaming_Blake2_gen.ml │ ├── EverCrypt_StaticConfig_gen.ml │ ├── Hacl_Frodo_KEM_gen.ml │ ├── Hacl_Hash_SHA1_gen.ml │ ├── Hacl_Hash_SHA2_gen.ml │ ├── Hacl_Curve25519_64_Slow_gen.ml │ ├── Hacl_Chacha20Poly1305_32_gen.ml │ ├── Hacl_IntTypes_Intrinsics_gen.ml │ ├── Hacl_Chacha20Poly1305_128_gen.ml │ ├── Hacl_Chacha20Poly1305_256_gen.ml │ ├── Hacl_Hash_Blake2_gen.ml │ ├── Hacl_SHA2_Vec256_gen.ml │ ├── EverCrypt_Chacha20Poly1305_gen.ml │ ├── Hacl_HPKE_P256_CP32_SHA256_gen.ml │ ├── Hacl_Poly1305_128_gen.ml │ ├── Hacl_Poly1305_256_gen.ml │ ├── Hacl_Streaming_Poly1305_32_gen.ml │ ├── Hacl_Curve25519_51_gen.ml │ ├── Hacl_HPKE_P256_CP128_SHA256_gen.ml │ ├── Hacl_HPKE_P256_CP256_SHA256_gen.ml │ ├── Hacl_IntTypes_Intrinsics_128_gen.ml │ ├── Hacl_HPKE_Curve51_CP32_SHA256_gen.ml │ ├── Hacl_HPKE_Curve51_CP32_SHA512_gen.ml │ ├── Hacl_HPKE_Curve64_CP32_SHA256_gen.ml │ ├── Hacl_HPKE_Curve64_CP32_SHA512_gen.ml │ ├── Hacl_HPKE_Curve51_CP128_SHA256_gen.ml │ ├── Hacl_HPKE_Curve51_CP128_SHA512_gen.ml │ ├── Hacl_HPKE_Curve51_CP256_SHA256_gen.ml │ ├── Hacl_HPKE_Curve51_CP256_SHA512_gen.ml │ ├── Hacl_HPKE_Curve64_CP128_SHA256_gen.ml │ ├── Hacl_HPKE_Curve64_CP128_SHA512_gen.ml │ ├── Hacl_HPKE_Curve64_CP256_SHA256_gen.ml │ ├── Hacl_HPKE_Curve64_CP256_SHA512_gen.ml │ ├── Hacl_Hash_Blake2b_256_gen.ml │ └── Hacl_Hash_Blake2s_128_gen.ml ├── Vale.c ├── Hacl_Frodo_KEM.c ├── EverCrypt_StaticConfig.c ├── Lib_PrintBuffer.c ├── EverCrypt_Cipher.c ├── Hacl_Kremlib.c ├── Makefile.basic ├── Lib_RandomBuffer_System.c ├── Lib_Memzero0.h ├── Lib_Memzero0.c ├── internal │ ├── Hacl_Kremlib.h │ ├── Hacl_Frodo_KEM.h │ ├── Hacl_Hash_MD5.h │ ├── Hacl_Hash_SHA1.h │ ├── Hacl_Poly1305_128.h │ ├── Hacl_Poly1305_256.h │ └── Hacl_Curve25519_51.h ├── EverCrypt_Cipher.h ├── Hacl_AES128.h ├── EverCrypt_StaticConfig.h ├── Hacl_HMAC_Blake2s_128.h ├── EverCrypt_Poly1305.h ├── Hacl_Spec.c ├── Hacl_HMAC_Blake2b_256.h ├── Lib_RandomBuffer_System.h ├── Hacl_Curve25519_51.h ├── Hacl_Curve25519_64.h ├── Hacl_Curve25519_64_Slow.h ├── Hacl_Hash_Base.h ├── Hacl_Hash_MD5.h ├── Hacl_Hash_SHA1.h ├── Hacl_Chacha20.h ├── EverCrypt_Ed25519.c ├── EverCrypt_Curve25519.h └── Lib_PrintBuffer.h ├── kremlin ├── kremlib │ └── dist │ │ └── minimal │ │ ├── Makefile.include │ │ ├── libkremlib.def │ │ ├── LowStar_Endianness.h │ │ ├── Makefile.basic │ │ └── fstar_uint128_struct_endianness.h └── include │ ├── kremlin │ ├── internal │ │ ├── wasmsupport.h │ │ ├── builtin.h │ │ ├── compat.h │ │ └── callconv.h │ └── c_endianness.h │ └── kremlib.h ├── tests ├── dune ├── test_utils.ml ├── config_test.ml └── drbg_test.ml ├── dune ├── AutoConfig2.ml ├── hacl-star.opam ├── CHANGES.md └── hacl-star-raw.opam /dune-project: -------------------------------------------------------------------------------- 1 | (lang dune 2.6) 2 | (name hacl-star) 3 | (formatting disabled) 4 | -------------------------------------------------------------------------------- /index.mld: -------------------------------------------------------------------------------- 1 | {0 OCaml API for HACL* and EverCrypt} 2 | 3 | {{!Hacl_star.EverCrypt}EverCrypt} 4 | 5 | {{!Hacl_star.Hacl}Hacl} 6 | -------------------------------------------------------------------------------- /raw/META: -------------------------------------------------------------------------------- 1 | name="hacl-star-raw" 2 | version="0.4.5" 3 | description="EverCrypt with Ctypes bindings" 4 | requires="ctypes" 5 | archive(native)="ocamlevercrypt.cmxa" 6 | archive(byte)="ocamlevercrypt.cma" 7 | -------------------------------------------------------------------------------- /kremlin/kremlib/dist/minimal/Makefile.include: -------------------------------------------------------------------------------- 1 | USER_TARGET=libkremlib.a 2 | USER_CFLAGS= 3 | USER_C_FILES=fstar_uint128.c 4 | ALL_C_FILES= 5 | ALL_H_FILES=FStar_UInt_8_16_32_64.h FStar_UInt128.h LowStar_Endianness.h 6 | -------------------------------------------------------------------------------- /raw/INFO.txt: -------------------------------------------------------------------------------- 1 | This code was generated with the following toolchain. 2 | F* version: 0601978e78abe9e520ac2af31ad9859ce493942a 3 | KreMLin version: 3e82a6e6e1caf7cb69d73d7e537d9e3fd5a6edd6 4 | Vale version: 0.3.16 5 | -------------------------------------------------------------------------------- /raw/lib/Lib_RandomBuffer_System_bindings.ml: -------------------------------------------------------------------------------- 1 | open Ctypes 2 | module Bindings(F:Cstubs.FOREIGN) = 3 | struct 4 | open F 5 | let randombytes = 6 | foreign "Lib_RandomBuffer_System_randombytes" 7 | (ocaml_bytes @-> uint32_t @-> returning bool) 8 | end 9 | -------------------------------------------------------------------------------- /kremlin/include/kremlin/internal/wasmsupport.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) INRIA and Microsoft Corporation. All rights reserved. 2 | Licensed under the Apache 2.0 License. */ 3 | 4 | /* This file is automatically included when compiling with -wasm -d force-c */ 5 | #define WasmSupport_check_buffer_size(X) 6 | -------------------------------------------------------------------------------- /kremlin/kremlib/dist/minimal/libkremlib.def: -------------------------------------------------------------------------------- 1 | LIBRARY libkremlib 2 | 3 | EXPORTS 4 | FStar_UInt64_eq_mask 5 | FStar_UInt64_gte_mask 6 | FStar_UInt32_eq_mask 7 | FStar_UInt32_gte_mask 8 | FStar_UInt16_eq_mask 9 | FStar_UInt16_gte_mask 10 | FStar_UInt8_eq_mask 11 | FStar_UInt8_gte_mask 12 | -------------------------------------------------------------------------------- /raw/lib/EverCrypt_Poly1305_bindings.ml: -------------------------------------------------------------------------------- 1 | open Ctypes 2 | module Bindings(F:Cstubs.FOREIGN) = 3 | struct 4 | open F 5 | let everCrypt_Poly1305_poly1305 = 6 | foreign "EverCrypt_Poly1305_poly1305" 7 | (ocaml_bytes @-> 8 | (ocaml_bytes @-> (uint32_t @-> (ocaml_bytes @-> (returning void))))) 9 | end -------------------------------------------------------------------------------- /raw/lib/Hacl_HMAC_Blake2b_256_bindings.ml: -------------------------------------------------------------------------------- 1 | open Ctypes 2 | module Bindings(F:Cstubs.FOREIGN) = 3 | struct 4 | open F 5 | let hacl_HMAC_Blake2b_256_compute_blake2b_256 = 6 | foreign "Hacl_HMAC_Blake2b_256_compute_blake2b_256" 7 | (ocaml_bytes @-> 8 | (ocaml_bytes @-> 9 | (uint32_t @-> (ocaml_bytes @-> (uint32_t @-> (returning void)))))) 10 | end -------------------------------------------------------------------------------- /raw/lib/Hacl_HMAC_Blake2s_128_bindings.ml: -------------------------------------------------------------------------------- 1 | open Ctypes 2 | module Bindings(F:Cstubs.FOREIGN) = 3 | struct 4 | open F 5 | let hacl_HMAC_Blake2s_128_compute_blake2s_128 = 6 | foreign "Hacl_HMAC_Blake2s_128_compute_blake2s_128" 7 | (ocaml_bytes @-> 8 | (ocaml_bytes @-> 9 | (uint32_t @-> (ocaml_bytes @-> (uint32_t @-> (returning void)))))) 10 | end -------------------------------------------------------------------------------- /kremlin/include/kremlin/c_endianness.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) INRIA and Microsoft Corporation. All rights reserved. 2 | Licensed under the Apache 2.0 License. */ 3 | 4 | #ifndef __KREMLIN_ENDIAN_H 5 | #define __KREMLIN_ENDIAN_H 6 | 7 | #ifdef __GNUC__ 8 | #warning "c_endianness.h is deprecated, include lowstar_endianness.h instead" 9 | #endif 10 | 11 | #include "lowstar_endianness.h" 12 | 13 | #endif 14 | -------------------------------------------------------------------------------- /raw/lib/EverCrypt_Cipher_bindings.ml: -------------------------------------------------------------------------------- 1 | open Ctypes 2 | module Bindings(F:Cstubs.FOREIGN) = 3 | struct 4 | open F 5 | let everCrypt_Cipher_chacha20 = 6 | foreign "EverCrypt_Cipher_chacha20" 7 | (uint32_t @-> 8 | (ocaml_bytes @-> 9 | (ocaml_bytes @-> 10 | (ocaml_bytes @-> 11 | (ocaml_bytes @-> (uint32_t @-> (returning void))))))) 12 | end -------------------------------------------------------------------------------- /raw/lib/Hacl_Poly1305_128_bindings.ml: -------------------------------------------------------------------------------- 1 | open Ctypes 2 | module Bindings(F:Cstubs.FOREIGN) = 3 | struct 4 | open F 5 | let hacl_Poly1305_128_blocklen = 6 | foreign_value "Hacl_Poly1305_128_blocklen" uint32_t 7 | let hacl_Poly1305_128_poly1305_mac = 8 | foreign "Hacl_Poly1305_128_poly1305_mac" 9 | (ocaml_bytes @-> 10 | (uint32_t @-> (ocaml_bytes @-> (ocaml_bytes @-> (returning void))))) 11 | end -------------------------------------------------------------------------------- /raw/lib/Hacl_Poly1305_256_bindings.ml: -------------------------------------------------------------------------------- 1 | open Ctypes 2 | module Bindings(F:Cstubs.FOREIGN) = 3 | struct 4 | open F 5 | let hacl_Poly1305_256_blocklen = 6 | foreign_value "Hacl_Poly1305_256_blocklen" uint32_t 7 | let hacl_Poly1305_256_poly1305_mac = 8 | foreign "Hacl_Poly1305_256_poly1305_mac" 9 | (ocaml_bytes @-> 10 | (uint32_t @-> (ocaml_bytes @-> (ocaml_bytes @-> (returning void))))) 11 | end -------------------------------------------------------------------------------- /raw/lib_gen/Hacl_HKDF_gen.ml: -------------------------------------------------------------------------------- 1 | let _ = 2 | (((Format.set_formatter_out_channel (open_out_bin "lib/Hacl_HKDF_stubs.ml"); 3 | Cstubs.write_ml Format.std_formatter ~prefix:"" 4 | (module Hacl_HKDF_bindings.Bindings)); 5 | Format.set_formatter_out_channel (open_out_bin "lib/Hacl_HKDF_c_stubs.c")); 6 | Format.printf "#include \"Hacl_HKDF.h\"\n"); 7 | Cstubs.write_c Format.std_formatter ~prefix:"" 8 | (module Hacl_HKDF_bindings.Bindings) -------------------------------------------------------------------------------- /raw/lib_gen/Hacl_NaCl_gen.ml: -------------------------------------------------------------------------------- 1 | let _ = 2 | (((Format.set_formatter_out_channel (open_out_bin "lib/Hacl_NaCl_stubs.ml"); 3 | Cstubs.write_ml Format.std_formatter ~prefix:"" 4 | (module Hacl_NaCl_bindings.Bindings)); 5 | Format.set_formatter_out_channel (open_out_bin "lib/Hacl_NaCl_c_stubs.c")); 6 | Format.printf "#include \"Hacl_NaCl.h\"\n"); 7 | Cstubs.write_c Format.std_formatter ~prefix:"" 8 | (module Hacl_NaCl_bindings.Bindings) -------------------------------------------------------------------------------- /raw/lib_gen/Hacl_SHA3_gen.ml: -------------------------------------------------------------------------------- 1 | let _ = 2 | (((Format.set_formatter_out_channel (open_out_bin "lib/Hacl_SHA3_stubs.ml"); 3 | Cstubs.write_ml Format.std_formatter ~prefix:"" 4 | (module Hacl_SHA3_bindings.Bindings)); 5 | Format.set_formatter_out_channel (open_out_bin "lib/Hacl_SHA3_c_stubs.c")); 6 | Format.printf "#include \"Hacl_SHA3.h\"\n"); 7 | Cstubs.write_c Format.std_formatter ~prefix:"" 8 | (module Hacl_SHA3_bindings.Bindings) -------------------------------------------------------------------------------- /raw/lib_gen/Hacl_FFDHE_gen.ml: -------------------------------------------------------------------------------- 1 | let _ = 2 | (((Format.set_formatter_out_channel 3 | (open_out_bin "lib/Hacl_FFDHE_stubs.ml"); 4 | Cstubs.write_ml Format.std_formatter ~prefix:"" 5 | (module Hacl_FFDHE_bindings.Bindings)); 6 | Format.set_formatter_out_channel 7 | (open_out_bin "lib/Hacl_FFDHE_c_stubs.c")); 8 | Format.printf "#include \"Hacl_FFDHE.h\"\n"); 9 | Cstubs.write_c Format.std_formatter ~prefix:"" 10 | (module Hacl_FFDHE_bindings.Bindings) -------------------------------------------------------------------------------- /raw/lib_gen/Hacl_HMAC_gen.ml: -------------------------------------------------------------------------------- 1 | let _ = 2 | (((Format.set_formatter_out_channel (open_out_bin "lib/Hacl_HMAC_stubs.ml"); 3 | Cstubs.write_ml Format.std_formatter ~prefix:"" 4 | (module Hacl_HMAC_bindings.Bindings)); 5 | Format.set_formatter_out_channel (open_out_bin "lib/Hacl_HMAC_c_stubs.c")); 6 | Format.printf 7 | "#include \"Hacl_HMAC.h\"\n#include \"internal/Hacl_HMAC.h\"\n"); 8 | Cstubs.write_c Format.std_formatter ~prefix:"" 9 | (module Hacl_HMAC_bindings.Bindings) -------------------------------------------------------------------------------- /raw/lib_gen/Hacl_P256_gen.ml: -------------------------------------------------------------------------------- 1 | let _ = 2 | (((Format.set_formatter_out_channel (open_out_bin "lib/Hacl_P256_stubs.ml"); 3 | Cstubs.write_ml Format.std_formatter ~prefix:"" 4 | (module Hacl_P256_bindings.Bindings)); 5 | Format.set_formatter_out_channel (open_out_bin "lib/Hacl_P256_c_stubs.c")); 6 | Format.printf 7 | "#include \"Hacl_P256.h\"\n#include \"internal/Hacl_P256.h\"\n"); 8 | Cstubs.write_c Format.std_formatter ~prefix:"" 9 | (module Hacl_P256_bindings.Bindings) -------------------------------------------------------------------------------- /raw/lib_gen/Hacl_RSAPSS_gen.ml: -------------------------------------------------------------------------------- 1 | let _ = 2 | (((Format.set_formatter_out_channel 3 | (open_out_bin "lib/Hacl_RSAPSS_stubs.ml"); 4 | Cstubs.write_ml Format.std_formatter ~prefix:"" 5 | (module Hacl_RSAPSS_bindings.Bindings)); 6 | Format.set_formatter_out_channel 7 | (open_out_bin "lib/Hacl_RSAPSS_c_stubs.c")); 8 | Format.printf "#include \"Hacl_RSAPSS.h\"\n"); 9 | Cstubs.write_c Format.std_formatter ~prefix:"" 10 | (module Hacl_RSAPSS_bindings.Bindings) -------------------------------------------------------------------------------- /raw/lib_gen/Hacl_Spec_gen.ml: -------------------------------------------------------------------------------- 1 | let _ = 2 | (((Format.set_formatter_out_channel (open_out_bin "lib/Hacl_Spec_stubs.ml"); 3 | Cstubs.write_ml Format.std_formatter ~prefix:"" 4 | (module Hacl_Spec_bindings.Bindings)); 5 | Format.set_formatter_out_channel (open_out_bin "lib/Hacl_Spec_c_stubs.c")); 6 | Format.printf 7 | "#include \"Hacl_Spec.h\"\n#include \"internal/Hacl_Spec.h\"\n"); 8 | Cstubs.write_c Format.std_formatter ~prefix:"" 9 | (module Hacl_Spec_bindings.Bindings) -------------------------------------------------------------------------------- /raw/lib_gen/Hacl_Frodo64_gen.ml: -------------------------------------------------------------------------------- 1 | let _ = 2 | (((Format.set_formatter_out_channel 3 | (open_out_bin "lib/Hacl_Frodo64_stubs.ml"); 4 | Cstubs.write_ml Format.std_formatter ~prefix:"" 5 | (module Hacl_Frodo64_bindings.Bindings)); 6 | Format.set_formatter_out_channel 7 | (open_out_bin "lib/Hacl_Frodo64_c_stubs.c")); 8 | Format.printf "#include \"Hacl_Frodo64.h\"\n"); 9 | Cstubs.write_c Format.std_formatter ~prefix:"" 10 | (module Hacl_Frodo64_bindings.Bindings) -------------------------------------------------------------------------------- /raw/lib_gen/Hacl_Salsa20_gen.ml: -------------------------------------------------------------------------------- 1 | let _ = 2 | (((Format.set_formatter_out_channel 3 | (open_out_bin "lib/Hacl_Salsa20_stubs.ml"); 4 | Cstubs.write_ml Format.std_formatter ~prefix:"" 5 | (module Hacl_Salsa20_bindings.Bindings)); 6 | Format.set_formatter_out_channel 7 | (open_out_bin "lib/Hacl_Salsa20_c_stubs.c")); 8 | Format.printf "#include \"Hacl_Salsa20.h\"\n"); 9 | Cstubs.write_c Format.std_formatter ~prefix:"" 10 | (module Hacl_Salsa20_bindings.Bindings) -------------------------------------------------------------------------------- /raw/lib_gen/Hacl_Bignum_gen.ml: -------------------------------------------------------------------------------- 1 | let _ = 2 | (((Format.set_formatter_out_channel 3 | (open_out_bin "lib/Hacl_Bignum_stubs.ml"); 4 | Cstubs.write_ml Format.std_formatter ~prefix:"" 5 | (module Hacl_Bignum_bindings.Bindings)); 6 | Format.set_formatter_out_channel 7 | (open_out_bin "lib/Hacl_Bignum_c_stubs.c")); 8 | Format.printf "#include \"internal/Hacl_Bignum.h\"\n"); 9 | Cstubs.write_c Format.std_formatter ~prefix:"" 10 | (module Hacl_Bignum_bindings.Bindings) -------------------------------------------------------------------------------- /raw/lib_gen/EverCrypt_CTR_gen.ml: -------------------------------------------------------------------------------- 1 | let _ = 2 | (((Format.set_formatter_out_channel 3 | (open_out_bin "lib/EverCrypt_CTR_stubs.ml"); 4 | Cstubs.write_ml Format.std_formatter ~prefix:"" 5 | (module EverCrypt_CTR_bindings.Bindings)); 6 | Format.set_formatter_out_channel 7 | (open_out_bin "lib/EverCrypt_CTR_c_stubs.c")); 8 | Format.printf "#include \"EverCrypt_CTR.h\"\n"); 9 | Cstubs.write_c Format.std_formatter ~prefix:"" 10 | (module EverCrypt_CTR_bindings.Bindings) -------------------------------------------------------------------------------- /raw/lib_gen/Hacl_Bignum32_gen.ml: -------------------------------------------------------------------------------- 1 | let _ = 2 | (((Format.set_formatter_out_channel 3 | (open_out_bin "lib/Hacl_Bignum32_stubs.ml"); 4 | Cstubs.write_ml Format.std_formatter ~prefix:"" 5 | (module Hacl_Bignum32_bindings.Bindings)); 6 | Format.set_formatter_out_channel 7 | (open_out_bin "lib/Hacl_Bignum32_c_stubs.c")); 8 | Format.printf "#include \"Hacl_Bignum32.h\"\n"); 9 | Cstubs.write_c Format.std_formatter ~prefix:"" 10 | (module Hacl_Bignum32_bindings.Bindings) -------------------------------------------------------------------------------- /raw/lib_gen/Hacl_Bignum64_gen.ml: -------------------------------------------------------------------------------- 1 | let _ = 2 | (((Format.set_formatter_out_channel 3 | (open_out_bin "lib/Hacl_Bignum64_stubs.ml"); 4 | Cstubs.write_ml Format.std_formatter ~prefix:"" 5 | (module Hacl_Bignum64_bindings.Bindings)); 6 | Format.set_formatter_out_channel 7 | (open_out_bin "lib/Hacl_Bignum64_c_stubs.c")); 8 | Format.printf "#include \"Hacl_Bignum64.h\"\n"); 9 | Cstubs.write_c Format.std_formatter ~prefix:"" 10 | (module Hacl_Bignum64_bindings.Bindings) -------------------------------------------------------------------------------- /raw/lib_gen/Hacl_Frodo640_gen.ml: -------------------------------------------------------------------------------- 1 | let _ = 2 | (((Format.set_formatter_out_channel 3 | (open_out_bin "lib/Hacl_Frodo640_stubs.ml"); 4 | Cstubs.write_ml Format.std_formatter ~prefix:"" 5 | (module Hacl_Frodo640_bindings.Bindings)); 6 | Format.set_formatter_out_channel 7 | (open_out_bin "lib/Hacl_Frodo640_c_stubs.c")); 8 | Format.printf "#include \"Hacl_Frodo640.h\"\n"); 9 | Cstubs.write_c Format.std_formatter ~prefix:"" 10 | (module Hacl_Frodo640_bindings.Bindings) -------------------------------------------------------------------------------- /raw/lib_gen/Hacl_Frodo976_gen.ml: -------------------------------------------------------------------------------- 1 | let _ = 2 | (((Format.set_formatter_out_channel 3 | (open_out_bin "lib/Hacl_Frodo976_stubs.ml"); 4 | Cstubs.write_ml Format.std_formatter ~prefix:"" 5 | (module Hacl_Frodo976_bindings.Bindings)); 6 | Format.set_formatter_out_channel 7 | (open_out_bin "lib/Hacl_Frodo976_c_stubs.c")); 8 | Format.printf "#include \"Hacl_Frodo976.h\"\n"); 9 | Cstubs.write_c Format.std_formatter ~prefix:"" 10 | (module Hacl_Frodo976_bindings.Bindings) -------------------------------------------------------------------------------- /raw/lib_gen/EverCrypt_AEAD_gen.ml: -------------------------------------------------------------------------------- 1 | let _ = 2 | (((Format.set_formatter_out_channel 3 | (open_out_bin "lib/EverCrypt_AEAD_stubs.ml"); 4 | Cstubs.write_ml Format.std_formatter ~prefix:"" 5 | (module EverCrypt_AEAD_bindings.Bindings)); 6 | Format.set_formatter_out_channel 7 | (open_out_bin "lib/EverCrypt_AEAD_c_stubs.c")); 8 | Format.printf "#include \"EverCrypt_AEAD.h\"\n"); 9 | Cstubs.write_c Format.std_formatter ~prefix:"" 10 | (module EverCrypt_AEAD_bindings.Bindings) -------------------------------------------------------------------------------- /raw/lib_gen/EverCrypt_DRBG_gen.ml: -------------------------------------------------------------------------------- 1 | let _ = 2 | (((Format.set_formatter_out_channel 3 | (open_out_bin "lib/EverCrypt_DRBG_stubs.ml"); 4 | Cstubs.write_ml Format.std_formatter ~prefix:"" 5 | (module EverCrypt_DRBG_bindings.Bindings)); 6 | Format.set_formatter_out_channel 7 | (open_out_bin "lib/EverCrypt_DRBG_c_stubs.c")); 8 | Format.printf "#include \"EverCrypt_DRBG.h\"\n"); 9 | Cstubs.write_c Format.std_formatter ~prefix:"" 10 | (module EverCrypt_DRBG_bindings.Bindings) -------------------------------------------------------------------------------- /raw/lib_gen/EverCrypt_HKDF_gen.ml: -------------------------------------------------------------------------------- 1 | let _ = 2 | (((Format.set_formatter_out_channel 3 | (open_out_bin "lib/EverCrypt_HKDF_stubs.ml"); 4 | Cstubs.write_ml Format.std_formatter ~prefix:"" 5 | (module EverCrypt_HKDF_bindings.Bindings)); 6 | Format.set_formatter_out_channel 7 | (open_out_bin "lib/EverCrypt_HKDF_c_stubs.c")); 8 | Format.printf "#include \"EverCrypt_HKDF.h\"\n"); 9 | Cstubs.write_c Format.std_formatter ~prefix:"" 10 | (module EverCrypt_HKDF_bindings.Bindings) -------------------------------------------------------------------------------- /raw/lib_gen/EverCrypt_HMAC_gen.ml: -------------------------------------------------------------------------------- 1 | let _ = 2 | (((Format.set_formatter_out_channel 3 | (open_out_bin "lib/EverCrypt_HMAC_stubs.ml"); 4 | Cstubs.write_ml Format.std_formatter ~prefix:"" 5 | (module EverCrypt_HMAC_bindings.Bindings)); 6 | Format.set_formatter_out_channel 7 | (open_out_bin "lib/EverCrypt_HMAC_c_stubs.c")); 8 | Format.printf "#include \"EverCrypt_HMAC.h\"\n"); 9 | Cstubs.write_c Format.std_formatter ~prefix:"" 10 | (module EverCrypt_HMAC_bindings.Bindings) -------------------------------------------------------------------------------- /raw/lib_gen/EverCrypt_Hash_gen.ml: -------------------------------------------------------------------------------- 1 | let _ = 2 | (((Format.set_formatter_out_channel 3 | (open_out_bin "lib/EverCrypt_Hash_stubs.ml"); 4 | Cstubs.write_ml Format.std_formatter ~prefix:"" 5 | (module EverCrypt_Hash_bindings.Bindings)); 6 | Format.set_formatter_out_channel 7 | (open_out_bin "lib/EverCrypt_Hash_c_stubs.c")); 8 | Format.printf "#include \"EverCrypt_Hash.h\"\n"); 9 | Cstubs.write_c Format.std_formatter ~prefix:"" 10 | (module EverCrypt_Hash_bindings.Bindings) -------------------------------------------------------------------------------- /raw/lib_gen/EverCrypt_Vale_gen.ml: -------------------------------------------------------------------------------- 1 | let _ = 2 | (((Format.set_formatter_out_channel 3 | (open_out_bin "lib/EverCrypt_Vale_stubs.ml"); 4 | Cstubs.write_ml Format.std_formatter ~prefix:"" 5 | (module EverCrypt_Vale_bindings.Bindings)); 6 | Format.set_formatter_out_channel 7 | (open_out_bin "lib/EverCrypt_Vale_c_stubs.c")); 8 | Format.printf "#include \"EverCrypt_Vale.h\"\n"); 9 | Cstubs.write_c Format.std_formatter ~prefix:"" 10 | (module EverCrypt_Vale_bindings.Bindings) -------------------------------------------------------------------------------- /raw/lib_gen/Hacl_Bignum256_gen.ml: -------------------------------------------------------------------------------- 1 | let _ = 2 | (((Format.set_formatter_out_channel 3 | (open_out_bin "lib/Hacl_Bignum256_stubs.ml"); 4 | Cstubs.write_ml Format.std_formatter ~prefix:"" 5 | (module Hacl_Bignum256_bindings.Bindings)); 6 | Format.set_formatter_out_channel 7 | (open_out_bin "lib/Hacl_Bignum256_c_stubs.c")); 8 | Format.printf "#include \"Hacl_Bignum256.h\"\n"); 9 | Cstubs.write_c Format.std_formatter ~prefix:"" 10 | (module Hacl_Bignum256_bindings.Bindings) -------------------------------------------------------------------------------- /raw/lib_gen/Hacl_Frodo1344_gen.ml: -------------------------------------------------------------------------------- 1 | let _ = 2 | (((Format.set_formatter_out_channel 3 | (open_out_bin "lib/Hacl_Frodo1344_stubs.ml"); 4 | Cstubs.write_ml Format.std_formatter ~prefix:"" 5 | (module Hacl_Frodo1344_bindings.Bindings)); 6 | Format.set_formatter_out_channel 7 | (open_out_bin "lib/Hacl_Frodo1344_c_stubs.c")); 8 | Format.printf "#include \"Hacl_Frodo1344.h\"\n"); 9 | Cstubs.write_c Format.std_formatter ~prefix:"" 10 | (module Hacl_Frodo1344_bindings.Bindings) -------------------------------------------------------------------------------- /raw/lib_gen/Hacl_HMAC_DRBG_gen.ml: -------------------------------------------------------------------------------- 1 | let _ = 2 | (((Format.set_formatter_out_channel 3 | (open_out_bin "lib/Hacl_HMAC_DRBG_stubs.ml"); 4 | Cstubs.write_ml Format.std_formatter ~prefix:"" 5 | (module Hacl_HMAC_DRBG_bindings.Bindings)); 6 | Format.set_formatter_out_channel 7 | (open_out_bin "lib/Hacl_HMAC_DRBG_c_stubs.c")); 8 | Format.printf "#include \"Hacl_HMAC_DRBG.h\"\n"); 9 | Cstubs.write_c Format.std_formatter ~prefix:"" 10 | (module Hacl_HMAC_DRBG_bindings.Bindings) -------------------------------------------------------------------------------- /raw/lib_gen/Hacl_Hash_Base_gen.ml: -------------------------------------------------------------------------------- 1 | let _ = 2 | (((Format.set_formatter_out_channel 3 | (open_out_bin "lib/Hacl_Hash_Base_stubs.ml"); 4 | Cstubs.write_ml Format.std_formatter ~prefix:"" 5 | (module Hacl_Hash_Base_bindings.Bindings)); 6 | Format.set_formatter_out_channel 7 | (open_out_bin "lib/Hacl_Hash_Base_c_stubs.c")); 8 | Format.printf "#include \"Hacl_Hash_Base.h\"\n"); 9 | Cstubs.write_c Format.std_formatter ~prefix:"" 10 | (module Hacl_Hash_Base_bindings.Bindings) -------------------------------------------------------------------------------- /raw/lib_gen/EverCrypt_Error_gen.ml: -------------------------------------------------------------------------------- 1 | let _ = 2 | (((Format.set_formatter_out_channel 3 | (open_out_bin "lib/EverCrypt_Error_stubs.ml"); 4 | Cstubs.write_ml Format.std_formatter ~prefix:"" 5 | (module EverCrypt_Error_bindings.Bindings)); 6 | Format.set_formatter_out_channel 7 | (open_out_bin "lib/EverCrypt_Error_c_stubs.c")); 8 | Format.printf "#include \"EverCrypt_Error.h\"\n"); 9 | Cstubs.write_c Format.std_formatter ~prefix:"" 10 | (module EverCrypt_Error_bindings.Bindings) -------------------------------------------------------------------------------- /raw/lib_gen/Hacl_Bignum4096_gen.ml: -------------------------------------------------------------------------------- 1 | let _ = 2 | (((Format.set_formatter_out_channel 3 | (open_out_bin "lib/Hacl_Bignum4096_stubs.ml"); 4 | Cstubs.write_ml Format.std_formatter ~prefix:"" 5 | (module Hacl_Bignum4096_bindings.Bindings)); 6 | Format.set_formatter_out_channel 7 | (open_out_bin "lib/Hacl_Bignum4096_c_stubs.c")); 8 | Format.printf "#include \"Hacl_Bignum4096.h\"\n"); 9 | Cstubs.write_c Format.std_formatter ~prefix:"" 10 | (module Hacl_Bignum4096_bindings.Bindings) -------------------------------------------------------------------------------- /raw/lib_gen/Hacl_EC_Ed25519_gen.ml: -------------------------------------------------------------------------------- 1 | let _ = 2 | (((Format.set_formatter_out_channel 3 | (open_out_bin "lib/Hacl_EC_Ed25519_stubs.ml"); 4 | Cstubs.write_ml Format.std_formatter ~prefix:"" 5 | (module Hacl_EC_Ed25519_bindings.Bindings)); 6 | Format.set_formatter_out_channel 7 | (open_out_bin "lib/Hacl_EC_Ed25519_c_stubs.c")); 8 | Format.printf "#include \"Hacl_EC_Ed25519.h\"\n"); 9 | Cstubs.write_c Format.std_formatter ~prefix:"" 10 | (module Hacl_EC_Ed25519_bindings.Bindings) -------------------------------------------------------------------------------- /tests/dune: -------------------------------------------------------------------------------- 1 | (tests 2 | (names config_test 3 | aead_test 4 | curve25519_test 5 | ed25519_test 6 | hash_test 7 | poly1305_test 8 | hmac_test 9 | hkdf_test 10 | nacl_test 11 | drbg_test 12 | p256_test) 13 | (libraries hacl-star) 14 | (preprocessor_deps config.h) 15 | (preprocess (action (run %{bin:cppo} %{input-file}))) 16 | (flags (:standard -open Hacl_star -warn-error -3))) 17 | 18 | (rule 19 | (copy ../config.h config.h)) 20 | -------------------------------------------------------------------------------- /raw/lib_gen/EverCrypt_Cipher_gen.ml: -------------------------------------------------------------------------------- 1 | let _ = 2 | (((Format.set_formatter_out_channel 3 | (open_out_bin "lib/EverCrypt_Cipher_stubs.ml"); 4 | Cstubs.write_ml Format.std_formatter ~prefix:"" 5 | (module EverCrypt_Cipher_bindings.Bindings)); 6 | Format.set_formatter_out_channel 7 | (open_out_bin "lib/EverCrypt_Cipher_c_stubs.c")); 8 | Format.printf "#include \"EverCrypt_Cipher.h\"\n"); 9 | Cstubs.write_c Format.std_formatter ~prefix:"" 10 | (module EverCrypt_Cipher_bindings.Bindings) -------------------------------------------------------------------------------- /raw/lib_gen/Hacl_Bignum_Base_gen.ml: -------------------------------------------------------------------------------- 1 | let _ = 2 | (((Format.set_formatter_out_channel 3 | (open_out_bin "lib/Hacl_Bignum_Base_stubs.ml"); 4 | Cstubs.write_ml Format.std_formatter ~prefix:"" 5 | (module Hacl_Bignum_Base_bindings.Bindings)); 6 | Format.set_formatter_out_channel 7 | (open_out_bin "lib/Hacl_Bignum_Base_c_stubs.c")); 8 | Format.printf "#include \"Hacl_Bignum_Base.h\"\n"); 9 | Cstubs.write_c Format.std_formatter ~prefix:"" 10 | (module Hacl_Bignum_Base_bindings.Bindings) -------------------------------------------------------------------------------- /raw/lib_gen/Hacl_Poly1305_32_gen.ml: -------------------------------------------------------------------------------- 1 | let _ = 2 | (((Format.set_formatter_out_channel 3 | (open_out_bin "lib/Hacl_Poly1305_32_stubs.ml"); 4 | Cstubs.write_ml Format.std_formatter ~prefix:"" 5 | (module Hacl_Poly1305_32_bindings.Bindings)); 6 | Format.set_formatter_out_channel 7 | (open_out_bin "lib/Hacl_Poly1305_32_c_stubs.c")); 8 | Format.printf "#include \"Hacl_Poly1305_32.h\"\n"); 9 | Cstubs.write_c Format.std_formatter ~prefix:"" 10 | (module Hacl_Poly1305_32_bindings.Bindings) -------------------------------------------------------------------------------- /raw/lib_gen/Hacl_SHA2_Vec128_gen.ml: -------------------------------------------------------------------------------- 1 | let _ = 2 | (((Format.set_formatter_out_channel 3 | (open_out_bin "lib/Hacl_SHA2_Vec128_stubs.ml"); 4 | Cstubs.write_ml Format.std_formatter ~prefix:"" 5 | (module Hacl_SHA2_Vec128_bindings.Bindings)); 6 | Format.set_formatter_out_channel 7 | (open_out_bin "lib/Hacl_SHA2_Vec128_c_stubs.c")); 8 | Format.printf "#include \"Hacl_SHA2_Vec128.h\"\n"); 9 | Cstubs.write_c Format.std_formatter ~prefix:"" 10 | (module Hacl_SHA2_Vec128_bindings.Bindings) -------------------------------------------------------------------------------- /raw/lib_gen/EverCrypt_Ed25519_gen.ml: -------------------------------------------------------------------------------- 1 | let _ = 2 | (((Format.set_formatter_out_channel 3 | (open_out_bin "lib/EverCrypt_Ed25519_stubs.ml"); 4 | Cstubs.write_ml Format.std_formatter ~prefix:"" 5 | (module EverCrypt_Ed25519_bindings.Bindings)); 6 | Format.set_formatter_out_channel 7 | (open_out_bin "lib/EverCrypt_Ed25519_c_stubs.c")); 8 | Format.printf "#include \"EverCrypt_Ed25519.h\"\n"); 9 | Cstubs.write_c Format.std_formatter ~prefix:"" 10 | (module EverCrypt_Ed25519_bindings.Bindings) -------------------------------------------------------------------------------- /raw/lib_gen/Hacl_Bignum256_32_gen.ml: -------------------------------------------------------------------------------- 1 | let _ = 2 | (((Format.set_formatter_out_channel 3 | (open_out_bin "lib/Hacl_Bignum256_32_stubs.ml"); 4 | Cstubs.write_ml Format.std_formatter ~prefix:"" 5 | (module Hacl_Bignum256_32_bindings.Bindings)); 6 | Format.set_formatter_out_channel 7 | (open_out_bin "lib/Hacl_Bignum256_32_c_stubs.c")); 8 | Format.printf "#include \"Hacl_Bignum256_32.h\"\n"); 9 | Cstubs.write_c Format.std_formatter ~prefix:"" 10 | (module Hacl_Bignum256_32_bindings.Bindings) -------------------------------------------------------------------------------- /raw/lib_gen/EverCrypt_Poly1305_gen.ml: -------------------------------------------------------------------------------- 1 | let _ = 2 | (((Format.set_formatter_out_channel 3 | (open_out_bin "lib/EverCrypt_Poly1305_stubs.ml"); 4 | Cstubs.write_ml Format.std_formatter ~prefix:"" 5 | (module EverCrypt_Poly1305_bindings.Bindings)); 6 | Format.set_formatter_out_channel 7 | (open_out_bin "lib/EverCrypt_Poly1305_c_stubs.c")); 8 | Format.printf "#include \"EverCrypt_Poly1305.h\"\n"); 9 | Cstubs.write_c Format.std_formatter ~prefix:"" 10 | (module EverCrypt_Poly1305_bindings.Bindings) -------------------------------------------------------------------------------- /raw/lib_gen/Hacl_Bignum4096_32_gen.ml: -------------------------------------------------------------------------------- 1 | let _ = 2 | (((Format.set_formatter_out_channel 3 | (open_out_bin "lib/Hacl_Bignum4096_32_stubs.ml"); 4 | Cstubs.write_ml Format.std_formatter ~prefix:"" 5 | (module Hacl_Bignum4096_32_bindings.Bindings)); 6 | Format.set_formatter_out_channel 7 | (open_out_bin "lib/Hacl_Bignum4096_32_c_stubs.c")); 8 | Format.printf "#include \"Hacl_Bignum4096_32.h\"\n"); 9 | Cstubs.write_c Format.std_formatter ~prefix:"" 10 | (module Hacl_Bignum4096_32_bindings.Bindings) -------------------------------------------------------------------------------- /raw/lib_gen/Hacl_Curve25519_64_gen.ml: -------------------------------------------------------------------------------- 1 | let _ = 2 | (((Format.set_formatter_out_channel 3 | (open_out_bin "lib/Hacl_Curve25519_64_stubs.ml"); 4 | Cstubs.write_ml Format.std_formatter ~prefix:"" 5 | (module Hacl_Curve25519_64_bindings.Bindings)); 6 | Format.set_formatter_out_channel 7 | (open_out_bin "lib/Hacl_Curve25519_64_c_stubs.c")); 8 | Format.printf "#include \"Hacl_Curve25519_64.h\"\n"); 9 | Cstubs.write_c Format.std_formatter ~prefix:"" 10 | (module Hacl_Curve25519_64_bindings.Bindings) -------------------------------------------------------------------------------- /raw/lib_gen/Hacl_SHA2_Scalar32_gen.ml: -------------------------------------------------------------------------------- 1 | let _ = 2 | (((Format.set_formatter_out_channel 3 | (open_out_bin "lib/Hacl_SHA2_Scalar32_stubs.ml"); 4 | Cstubs.write_ml Format.std_formatter ~prefix:"" 5 | (module Hacl_SHA2_Scalar32_bindings.Bindings)); 6 | Format.set_formatter_out_channel 7 | (open_out_bin "lib/Hacl_SHA2_Scalar32_c_stubs.c")); 8 | Format.printf "#include \"Hacl_SHA2_Scalar32.h\"\n"); 9 | Cstubs.write_c Format.std_formatter ~prefix:"" 10 | (module Hacl_SHA2_Scalar32_bindings.Bindings) -------------------------------------------------------------------------------- /raw/lib_gen/Hacl_Streaming_MD5_gen.ml: -------------------------------------------------------------------------------- 1 | let _ = 2 | (((Format.set_formatter_out_channel 3 | (open_out_bin "lib/Hacl_Streaming_MD5_stubs.ml"); 4 | Cstubs.write_ml Format.std_formatter ~prefix:"" 5 | (module Hacl_Streaming_MD5_bindings.Bindings)); 6 | Format.set_formatter_out_channel 7 | (open_out_bin "lib/Hacl_Streaming_MD5_c_stubs.c")); 8 | Format.printf "#include \"Hacl_Streaming_MD5.h\"\n"); 9 | Cstubs.write_c Format.std_formatter ~prefix:"" 10 | (module Hacl_Streaming_MD5_bindings.Bindings) -------------------------------------------------------------------------------- /raw/lib_gen/Lib_RandomBuffer_System_gen.ml: -------------------------------------------------------------------------------- 1 | let _ = 2 | Format.set_formatter_out_channel (open_out_bin "lib/Lib_RandomBuffer_System_stubs.ml"); 3 | Cstubs.write_ml Format.std_formatter ~prefix:"" 4 | (module Lib_RandomBuffer_System_bindings.Bindings); 5 | Format.set_formatter_out_channel (open_out_bin "lib/Lib_RandomBuffer_System_c_stubs.c"); 6 | Format.printf "#include \"Lib_RandomBuffer_System.h\"\n"; 7 | Cstubs.write_c Format.std_formatter ~prefix:"" 8 | (module Lib_RandomBuffer_System_bindings.Bindings) 9 | 10 | -------------------------------------------------------------------------------- /raw/lib_gen/Hacl_Bignum25519_51_gen.ml: -------------------------------------------------------------------------------- 1 | let _ = 2 | (((Format.set_formatter_out_channel 3 | (open_out_bin "lib/Hacl_Bignum25519_51_stubs.ml"); 4 | Cstubs.write_ml Format.std_formatter ~prefix:"" 5 | (module Hacl_Bignum25519_51_bindings.Bindings)); 6 | Format.set_formatter_out_channel 7 | (open_out_bin "lib/Hacl_Bignum25519_51_c_stubs.c")); 8 | Format.printf "#include \"Hacl_Bignum25519_51.h\"\n"); 9 | Cstubs.write_c Format.std_formatter ~prefix:"" 10 | (module Hacl_Bignum25519_51_bindings.Bindings) -------------------------------------------------------------------------------- /raw/lib_gen/Hacl_Chacha20_Vec32_gen.ml: -------------------------------------------------------------------------------- 1 | let _ = 2 | (((Format.set_formatter_out_channel 3 | (open_out_bin "lib/Hacl_Chacha20_Vec32_stubs.ml"); 4 | Cstubs.write_ml Format.std_formatter ~prefix:"" 5 | (module Hacl_Chacha20_Vec32_bindings.Bindings)); 6 | Format.set_formatter_out_channel 7 | (open_out_bin "lib/Hacl_Chacha20_Vec32_c_stubs.c")); 8 | Format.printf "#include \"Hacl_Chacha20_Vec32.h\"\n"); 9 | Cstubs.write_c Format.std_formatter ~prefix:"" 10 | (module Hacl_Chacha20_Vec32_bindings.Bindings) -------------------------------------------------------------------------------- /raw/lib_gen/Hacl_GenericField32_gen.ml: -------------------------------------------------------------------------------- 1 | let _ = 2 | (((Format.set_formatter_out_channel 3 | (open_out_bin "lib/Hacl_GenericField32_stubs.ml"); 4 | Cstubs.write_ml Format.std_formatter ~prefix:"" 5 | (module Hacl_GenericField32_bindings.Bindings)); 6 | Format.set_formatter_out_channel 7 | (open_out_bin "lib/Hacl_GenericField32_c_stubs.c")); 8 | Format.printf "#include \"Hacl_GenericField32.h\"\n"); 9 | Cstubs.write_c Format.std_formatter ~prefix:"" 10 | (module Hacl_GenericField32_bindings.Bindings) -------------------------------------------------------------------------------- /raw/lib_gen/Hacl_GenericField64_gen.ml: -------------------------------------------------------------------------------- 1 | let _ = 2 | (((Format.set_formatter_out_channel 3 | (open_out_bin "lib/Hacl_GenericField64_stubs.ml"); 4 | Cstubs.write_ml Format.std_formatter ~prefix:"" 5 | (module Hacl_GenericField64_bindings.Bindings)); 6 | Format.set_formatter_out_channel 7 | (open_out_bin "lib/Hacl_GenericField64_c_stubs.c")); 8 | Format.printf "#include \"Hacl_GenericField64.h\"\n"); 9 | Cstubs.write_c Format.std_formatter ~prefix:"" 10 | (module Hacl_GenericField64_bindings.Bindings) -------------------------------------------------------------------------------- /raw/lib_gen/Hacl_Streaming_SHA1_gen.ml: -------------------------------------------------------------------------------- 1 | let _ = 2 | (((Format.set_formatter_out_channel 3 | (open_out_bin "lib/Hacl_Streaming_SHA1_stubs.ml"); 4 | Cstubs.write_ml Format.std_formatter ~prefix:"" 5 | (module Hacl_Streaming_SHA1_bindings.Bindings)); 6 | Format.set_formatter_out_channel 7 | (open_out_bin "lib/Hacl_Streaming_SHA1_c_stubs.c")); 8 | Format.printf "#include \"Hacl_Streaming_SHA1.h\"\n"); 9 | Cstubs.write_c Format.std_formatter ~prefix:"" 10 | (module Hacl_Streaming_SHA1_bindings.Bindings) -------------------------------------------------------------------------------- /raw/lib_gen/Hacl_Streaming_SHA2_gen.ml: -------------------------------------------------------------------------------- 1 | let _ = 2 | (((Format.set_formatter_out_channel 3 | (open_out_bin "lib/Hacl_Streaming_SHA2_stubs.ml"); 4 | Cstubs.write_ml Format.std_formatter ~prefix:"" 5 | (module Hacl_Streaming_SHA2_bindings.Bindings)); 6 | Format.set_formatter_out_channel 7 | (open_out_bin "lib/Hacl_Streaming_SHA2_c_stubs.c")); 8 | Format.printf "#include \"Hacl_Streaming_SHA2.h\"\n"); 9 | Cstubs.write_c Format.std_formatter ~prefix:"" 10 | (module Hacl_Streaming_SHA2_bindings.Bindings) -------------------------------------------------------------------------------- /raw/lib/EverCrypt_StaticConfig_bindings.ml: -------------------------------------------------------------------------------- 1 | open Ctypes 2 | module Bindings(F:Cstubs.FOREIGN) = 3 | struct 4 | open F 5 | let everCrypt_StaticConfig_hacl = 6 | foreign_value "EverCrypt_StaticConfig_hacl" bool 7 | let everCrypt_StaticConfig_vale = 8 | foreign_value "EverCrypt_StaticConfig_vale" bool 9 | let everCrypt_StaticConfig_openssl = 10 | foreign_value "EverCrypt_StaticConfig_openssl" bool 11 | let everCrypt_StaticConfig_bcrypt = 12 | foreign_value "EverCrypt_StaticConfig_bcrypt" bool 13 | end -------------------------------------------------------------------------------- /raw/lib_gen/EverCrypt_Curve25519_gen.ml: -------------------------------------------------------------------------------- 1 | let _ = 2 | (((Format.set_formatter_out_channel 3 | (open_out_bin "lib/EverCrypt_Curve25519_stubs.ml"); 4 | Cstubs.write_ml Format.std_formatter ~prefix:"" 5 | (module EverCrypt_Curve25519_bindings.Bindings)); 6 | Format.set_formatter_out_channel 7 | (open_out_bin "lib/EverCrypt_Curve25519_c_stubs.c")); 8 | Format.printf "#include \"EverCrypt_Curve25519.h\"\n"); 9 | Cstubs.write_c Format.std_formatter ~prefix:"" 10 | (module EverCrypt_Curve25519_bindings.Bindings) -------------------------------------------------------------------------------- /raw/lib_gen/Hacl_Chacha20_Vec128_gen.ml: -------------------------------------------------------------------------------- 1 | let _ = 2 | (((Format.set_formatter_out_channel 3 | (open_out_bin "lib/Hacl_Chacha20_Vec128_stubs.ml"); 4 | Cstubs.write_ml Format.std_formatter ~prefix:"" 5 | (module Hacl_Chacha20_Vec128_bindings.Bindings)); 6 | Format.set_formatter_out_channel 7 | (open_out_bin "lib/Hacl_Chacha20_Vec128_c_stubs.c")); 8 | Format.printf "#include \"Hacl_Chacha20_Vec128.h\"\n"); 9 | Cstubs.write_c Format.std_formatter ~prefix:"" 10 | (module Hacl_Chacha20_Vec128_bindings.Bindings) -------------------------------------------------------------------------------- /raw/lib_gen/Hacl_Chacha20_Vec256_gen.ml: -------------------------------------------------------------------------------- 1 | let _ = 2 | (((Format.set_formatter_out_channel 3 | (open_out_bin "lib/Hacl_Chacha20_Vec256_stubs.ml"); 4 | Cstubs.write_ml Format.std_formatter ~prefix:"" 5 | (module Hacl_Chacha20_Vec256_bindings.Bindings)); 6 | Format.set_formatter_out_channel 7 | (open_out_bin "lib/Hacl_Chacha20_Vec256_c_stubs.c")); 8 | Format.printf "#include \"Hacl_Chacha20_Vec256.h\"\n"); 9 | Cstubs.write_c Format.std_formatter ~prefix:"" 10 | (module Hacl_Chacha20_Vec256_bindings.Bindings) -------------------------------------------------------------------------------- /raw/lib_gen/Hacl_Ed25519_gen.ml: -------------------------------------------------------------------------------- 1 | let _ = 2 | (((Format.set_formatter_out_channel 3 | (open_out_bin "lib/Hacl_Ed25519_stubs.ml"); 4 | Cstubs.write_ml Format.std_formatter ~prefix:"" 5 | (module Hacl_Ed25519_bindings.Bindings)); 6 | Format.set_formatter_out_channel 7 | (open_out_bin "lib/Hacl_Ed25519_c_stubs.c")); 8 | Format.printf 9 | "#include \"Hacl_Ed25519.h\"\n#include \"internal/Hacl_Ed25519.h\"\n"); 10 | Cstubs.write_c Format.std_formatter ~prefix:"" 11 | (module Hacl_Ed25519_bindings.Bindings) -------------------------------------------------------------------------------- /raw/lib_gen/EverCrypt_AutoConfig2_gen.ml: -------------------------------------------------------------------------------- 1 | let _ = 2 | (((Format.set_formatter_out_channel 3 | (open_out_bin "lib/EverCrypt_AutoConfig2_stubs.ml"); 4 | Cstubs.write_ml Format.std_formatter ~prefix:"" 5 | (module EverCrypt_AutoConfig2_bindings.Bindings)); 6 | Format.set_formatter_out_channel 7 | (open_out_bin "lib/EverCrypt_AutoConfig2_c_stubs.c")); 8 | Format.printf "#include \"EverCrypt_AutoConfig2.h\"\n"); 9 | Cstubs.write_c Format.std_formatter ~prefix:"" 10 | (module EverCrypt_AutoConfig2_bindings.Bindings) -------------------------------------------------------------------------------- /raw/lib_gen/Hacl_Chacha20_gen.ml: -------------------------------------------------------------------------------- 1 | let _ = 2 | (((Format.set_formatter_out_channel 3 | (open_out_bin "lib/Hacl_Chacha20_stubs.ml"); 4 | Cstubs.write_ml Format.std_formatter ~prefix:"" 5 | (module Hacl_Chacha20_bindings.Bindings)); 6 | Format.set_formatter_out_channel 7 | (open_out_bin "lib/Hacl_Chacha20_c_stubs.c")); 8 | Format.printf 9 | "#include \"Hacl_Chacha20.h\"\n#include \"internal/Hacl_Chacha20.h\"\n"); 10 | Cstubs.write_c Format.std_formatter ~prefix:"" 11 | (module Hacl_Chacha20_bindings.Bindings) -------------------------------------------------------------------------------- /raw/lib_gen/Hacl_HKDF_Blake2b_256_gen.ml: -------------------------------------------------------------------------------- 1 | let _ = 2 | (((Format.set_formatter_out_channel 3 | (open_out_bin "lib/Hacl_HKDF_Blake2b_256_stubs.ml"); 4 | Cstubs.write_ml Format.std_formatter ~prefix:"" 5 | (module Hacl_HKDF_Blake2b_256_bindings.Bindings)); 6 | Format.set_formatter_out_channel 7 | (open_out_bin "lib/Hacl_HKDF_Blake2b_256_c_stubs.c")); 8 | Format.printf "#include \"Hacl_HKDF_Blake2b_256.h\"\n"); 9 | Cstubs.write_c Format.std_formatter ~prefix:"" 10 | (module Hacl_HKDF_Blake2b_256_bindings.Bindings) -------------------------------------------------------------------------------- /raw/lib_gen/Hacl_HKDF_Blake2s_128_gen.ml: -------------------------------------------------------------------------------- 1 | let _ = 2 | (((Format.set_formatter_out_channel 3 | (open_out_bin "lib/Hacl_HKDF_Blake2s_128_stubs.ml"); 4 | Cstubs.write_ml Format.std_formatter ~prefix:"" 5 | (module Hacl_HKDF_Blake2s_128_bindings.Bindings)); 6 | Format.set_formatter_out_channel 7 | (open_out_bin "lib/Hacl_HKDF_Blake2s_128_c_stubs.c")); 8 | Format.printf "#include \"Hacl_HKDF_Blake2s_128.h\"\n"); 9 | Cstubs.write_c Format.std_formatter ~prefix:"" 10 | (module Hacl_HKDF_Blake2s_128_bindings.Bindings) -------------------------------------------------------------------------------- /raw/lib_gen/Hacl_HMAC_Blake2b_256_gen.ml: -------------------------------------------------------------------------------- 1 | let _ = 2 | (((Format.set_formatter_out_channel 3 | (open_out_bin "lib/Hacl_HMAC_Blake2b_256_stubs.ml"); 4 | Cstubs.write_ml Format.std_formatter ~prefix:"" 5 | (module Hacl_HMAC_Blake2b_256_bindings.Bindings)); 6 | Format.set_formatter_out_channel 7 | (open_out_bin "lib/Hacl_HMAC_Blake2b_256_c_stubs.c")); 8 | Format.printf "#include \"Hacl_HMAC_Blake2b_256.h\"\n"); 9 | Cstubs.write_c Format.std_formatter ~prefix:"" 10 | (module Hacl_HMAC_Blake2b_256_bindings.Bindings) -------------------------------------------------------------------------------- /raw/lib_gen/Hacl_HMAC_Blake2s_128_gen.ml: -------------------------------------------------------------------------------- 1 | let _ = 2 | (((Format.set_formatter_out_channel 3 | (open_out_bin "lib/Hacl_HMAC_Blake2s_128_stubs.ml"); 4 | Cstubs.write_ml Format.std_formatter ~prefix:"" 5 | (module Hacl_HMAC_Blake2s_128_bindings.Bindings)); 6 | Format.set_formatter_out_channel 7 | (open_out_bin "lib/Hacl_HMAC_Blake2s_128_c_stubs.c")); 8 | Format.printf "#include \"Hacl_HMAC_Blake2s_128.h\"\n"); 9 | Cstubs.write_c Format.std_formatter ~prefix:"" 10 | (module Hacl_HMAC_Blake2s_128_bindings.Bindings) -------------------------------------------------------------------------------- /raw/lib_gen/Hacl_Hash_MD5_gen.ml: -------------------------------------------------------------------------------- 1 | let _ = 2 | (((Format.set_formatter_out_channel 3 | (open_out_bin "lib/Hacl_Hash_MD5_stubs.ml"); 4 | Cstubs.write_ml Format.std_formatter ~prefix:"" 5 | (module Hacl_Hash_MD5_bindings.Bindings)); 6 | Format.set_formatter_out_channel 7 | (open_out_bin "lib/Hacl_Hash_MD5_c_stubs.c")); 8 | Format.printf 9 | "#include \"Hacl_Hash_MD5.h\"\n#include \"internal/Hacl_Hash_MD5.h\"\n"); 10 | Cstubs.write_c Format.std_formatter ~prefix:"" 11 | (module Hacl_Hash_MD5_bindings.Bindings) -------------------------------------------------------------------------------- /raw/lib_gen/Hacl_Streaming_Blake2_gen.ml: -------------------------------------------------------------------------------- 1 | let _ = 2 | (((Format.set_formatter_out_channel 3 | (open_out_bin "lib/Hacl_Streaming_Blake2_stubs.ml"); 4 | Cstubs.write_ml Format.std_formatter ~prefix:"" 5 | (module Hacl_Streaming_Blake2_bindings.Bindings)); 6 | Format.set_formatter_out_channel 7 | (open_out_bin "lib/Hacl_Streaming_Blake2_c_stubs.c")); 8 | Format.printf "#include \"Hacl_Streaming_Blake2.h\"\n"); 9 | Cstubs.write_c Format.std_formatter ~prefix:"" 10 | (module Hacl_Streaming_Blake2_bindings.Bindings) -------------------------------------------------------------------------------- /raw/lib_gen/EverCrypt_StaticConfig_gen.ml: -------------------------------------------------------------------------------- 1 | let _ = 2 | (((Format.set_formatter_out_channel 3 | (open_out_bin "lib/EverCrypt_StaticConfig_stubs.ml"); 4 | Cstubs.write_ml Format.std_formatter ~prefix:"" 5 | (module EverCrypt_StaticConfig_bindings.Bindings)); 6 | Format.set_formatter_out_channel 7 | (open_out_bin "lib/EverCrypt_StaticConfig_c_stubs.c")); 8 | Format.printf "#include \"EverCrypt_StaticConfig.h\"\n"); 9 | Cstubs.write_c Format.std_formatter ~prefix:"" 10 | (module EverCrypt_StaticConfig_bindings.Bindings) -------------------------------------------------------------------------------- /raw/lib_gen/Hacl_Frodo_KEM_gen.ml: -------------------------------------------------------------------------------- 1 | let _ = 2 | (((Format.set_formatter_out_channel 3 | (open_out_bin "lib/Hacl_Frodo_KEM_stubs.ml"); 4 | Cstubs.write_ml Format.std_formatter ~prefix:"" 5 | (module Hacl_Frodo_KEM_bindings.Bindings)); 6 | Format.set_formatter_out_channel 7 | (open_out_bin "lib/Hacl_Frodo_KEM_c_stubs.c")); 8 | Format.printf 9 | "#include \"Hacl_Frodo_KEM.h\"\n#include \"internal/Hacl_Frodo_KEM.h\"\n"); 10 | Cstubs.write_c Format.std_formatter ~prefix:"" 11 | (module Hacl_Frodo_KEM_bindings.Bindings) -------------------------------------------------------------------------------- /raw/lib_gen/Hacl_Hash_SHA1_gen.ml: -------------------------------------------------------------------------------- 1 | let _ = 2 | (((Format.set_formatter_out_channel 3 | (open_out_bin "lib/Hacl_Hash_SHA1_stubs.ml"); 4 | Cstubs.write_ml Format.std_formatter ~prefix:"" 5 | (module Hacl_Hash_SHA1_bindings.Bindings)); 6 | Format.set_formatter_out_channel 7 | (open_out_bin "lib/Hacl_Hash_SHA1_c_stubs.c")); 8 | Format.printf 9 | "#include \"Hacl_Hash_SHA1.h\"\n#include \"internal/Hacl_Hash_SHA1.h\"\n"); 10 | Cstubs.write_c Format.std_formatter ~prefix:"" 11 | (module Hacl_Hash_SHA1_bindings.Bindings) -------------------------------------------------------------------------------- /raw/lib_gen/Hacl_Hash_SHA2_gen.ml: -------------------------------------------------------------------------------- 1 | let _ = 2 | (((Format.set_formatter_out_channel 3 | (open_out_bin "lib/Hacl_Hash_SHA2_stubs.ml"); 4 | Cstubs.write_ml Format.std_formatter ~prefix:"" 5 | (module Hacl_Hash_SHA2_bindings.Bindings)); 6 | Format.set_formatter_out_channel 7 | (open_out_bin "lib/Hacl_Hash_SHA2_c_stubs.c")); 8 | Format.printf 9 | "#include \"Hacl_Hash_SHA2.h\"\n#include \"internal/Hacl_Hash_SHA2.h\"\n"); 10 | Cstubs.write_c Format.std_formatter ~prefix:"" 11 | (module Hacl_Hash_SHA2_bindings.Bindings) -------------------------------------------------------------------------------- /raw/lib_gen/Hacl_Curve25519_64_Slow_gen.ml: -------------------------------------------------------------------------------- 1 | let _ = 2 | (((Format.set_formatter_out_channel 3 | (open_out_bin "lib/Hacl_Curve25519_64_Slow_stubs.ml"); 4 | Cstubs.write_ml Format.std_formatter ~prefix:"" 5 | (module Hacl_Curve25519_64_Slow_bindings.Bindings)); 6 | Format.set_formatter_out_channel 7 | (open_out_bin "lib/Hacl_Curve25519_64_Slow_c_stubs.c")); 8 | Format.printf "#include \"Hacl_Curve25519_64_Slow.h\"\n"); 9 | Cstubs.write_c Format.std_formatter ~prefix:"" 10 | (module Hacl_Curve25519_64_Slow_bindings.Bindings) -------------------------------------------------------------------------------- /raw/lib_gen/Hacl_Chacha20Poly1305_32_gen.ml: -------------------------------------------------------------------------------- 1 | let _ = 2 | (((Format.set_formatter_out_channel 3 | (open_out_bin "lib/Hacl_Chacha20Poly1305_32_stubs.ml"); 4 | Cstubs.write_ml Format.std_formatter ~prefix:"" 5 | (module Hacl_Chacha20Poly1305_32_bindings.Bindings)); 6 | Format.set_formatter_out_channel 7 | (open_out_bin "lib/Hacl_Chacha20Poly1305_32_c_stubs.c")); 8 | Format.printf "#include \"Hacl_Chacha20Poly1305_32.h\"\n"); 9 | Cstubs.write_c Format.std_formatter ~prefix:"" 10 | (module Hacl_Chacha20Poly1305_32_bindings.Bindings) -------------------------------------------------------------------------------- /raw/lib_gen/Hacl_IntTypes_Intrinsics_gen.ml: -------------------------------------------------------------------------------- 1 | let _ = 2 | (((Format.set_formatter_out_channel 3 | (open_out_bin "lib/Hacl_IntTypes_Intrinsics_stubs.ml"); 4 | Cstubs.write_ml Format.std_formatter ~prefix:"" 5 | (module Hacl_IntTypes_Intrinsics_bindings.Bindings)); 6 | Format.set_formatter_out_channel 7 | (open_out_bin "lib/Hacl_IntTypes_Intrinsics_c_stubs.c")); 8 | Format.printf "#include \"Hacl_IntTypes_Intrinsics.h\"\n"); 9 | Cstubs.write_c Format.std_formatter ~prefix:"" 10 | (module Hacl_IntTypes_Intrinsics_bindings.Bindings) -------------------------------------------------------------------------------- /raw/lib_gen/Hacl_Chacha20Poly1305_128_gen.ml: -------------------------------------------------------------------------------- 1 | let _ = 2 | (((Format.set_formatter_out_channel 3 | (open_out_bin "lib/Hacl_Chacha20Poly1305_128_stubs.ml"); 4 | Cstubs.write_ml Format.std_formatter ~prefix:"" 5 | (module Hacl_Chacha20Poly1305_128_bindings.Bindings)); 6 | Format.set_formatter_out_channel 7 | (open_out_bin "lib/Hacl_Chacha20Poly1305_128_c_stubs.c")); 8 | Format.printf "#include \"Hacl_Chacha20Poly1305_128.h\"\n"); 9 | Cstubs.write_c Format.std_formatter ~prefix:"" 10 | (module Hacl_Chacha20Poly1305_128_bindings.Bindings) -------------------------------------------------------------------------------- /raw/lib_gen/Hacl_Chacha20Poly1305_256_gen.ml: -------------------------------------------------------------------------------- 1 | let _ = 2 | (((Format.set_formatter_out_channel 3 | (open_out_bin "lib/Hacl_Chacha20Poly1305_256_stubs.ml"); 4 | Cstubs.write_ml Format.std_formatter ~prefix:"" 5 | (module Hacl_Chacha20Poly1305_256_bindings.Bindings)); 6 | Format.set_formatter_out_channel 7 | (open_out_bin "lib/Hacl_Chacha20Poly1305_256_c_stubs.c")); 8 | Format.printf "#include \"Hacl_Chacha20Poly1305_256.h\"\n"); 9 | Cstubs.write_c Format.std_formatter ~prefix:"" 10 | (module Hacl_Chacha20Poly1305_256_bindings.Bindings) -------------------------------------------------------------------------------- /raw/lib_gen/Hacl_Hash_Blake2_gen.ml: -------------------------------------------------------------------------------- 1 | let _ = 2 | (((Format.set_formatter_out_channel 3 | (open_out_bin "lib/Hacl_Hash_Blake2_stubs.ml"); 4 | Cstubs.write_ml Format.std_formatter ~prefix:"" 5 | (module Hacl_Hash_Blake2_bindings.Bindings)); 6 | Format.set_formatter_out_channel 7 | (open_out_bin "lib/Hacl_Hash_Blake2_c_stubs.c")); 8 | Format.printf 9 | "#include \"Hacl_Hash_Blake2.h\"\n#include \"internal/Hacl_Hash_Blake2.h\"\n"); 10 | Cstubs.write_c Format.std_formatter ~prefix:"" 11 | (module Hacl_Hash_Blake2_bindings.Bindings) -------------------------------------------------------------------------------- /raw/lib_gen/Hacl_SHA2_Vec256_gen.ml: -------------------------------------------------------------------------------- 1 | let _ = 2 | (((Format.set_formatter_out_channel 3 | (open_out_bin "lib/Hacl_SHA2_Vec256_stubs.ml"); 4 | Cstubs.write_ml Format.std_formatter ~prefix:"" 5 | (module Hacl_SHA2_Vec256_bindings.Bindings)); 6 | Format.set_formatter_out_channel 7 | (open_out_bin "lib/Hacl_SHA2_Vec256_c_stubs.c")); 8 | Format.printf 9 | "#include \"Hacl_SHA2_Vec256.h\"\n#include \"internal/Hacl_SHA2_Vec256.h\"\n"); 10 | Cstubs.write_c Format.std_formatter ~prefix:"" 11 | (module Hacl_SHA2_Vec256_bindings.Bindings) -------------------------------------------------------------------------------- /raw/lib_gen/EverCrypt_Chacha20Poly1305_gen.ml: -------------------------------------------------------------------------------- 1 | let _ = 2 | (((Format.set_formatter_out_channel 3 | (open_out_bin "lib/EverCrypt_Chacha20Poly1305_stubs.ml"); 4 | Cstubs.write_ml Format.std_formatter ~prefix:"" 5 | (module EverCrypt_Chacha20Poly1305_bindings.Bindings)); 6 | Format.set_formatter_out_channel 7 | (open_out_bin "lib/EverCrypt_Chacha20Poly1305_c_stubs.c")); 8 | Format.printf "#include \"EverCrypt_Chacha20Poly1305.h\"\n"); 9 | Cstubs.write_c Format.std_formatter ~prefix:"" 10 | (module EverCrypt_Chacha20Poly1305_bindings.Bindings) -------------------------------------------------------------------------------- /raw/lib_gen/Hacl_HPKE_P256_CP32_SHA256_gen.ml: -------------------------------------------------------------------------------- 1 | let _ = 2 | (((Format.set_formatter_out_channel 3 | (open_out_bin "lib/Hacl_HPKE_P256_CP32_SHA256_stubs.ml"); 4 | Cstubs.write_ml Format.std_formatter ~prefix:"" 5 | (module Hacl_HPKE_P256_CP32_SHA256_bindings.Bindings)); 6 | Format.set_formatter_out_channel 7 | (open_out_bin "lib/Hacl_HPKE_P256_CP32_SHA256_c_stubs.c")); 8 | Format.printf "#include \"Hacl_HPKE_P256_CP32_SHA256.h\"\n"); 9 | Cstubs.write_c Format.std_formatter ~prefix:"" 10 | (module Hacl_HPKE_P256_CP32_SHA256_bindings.Bindings) -------------------------------------------------------------------------------- /raw/lib_gen/Hacl_Poly1305_128_gen.ml: -------------------------------------------------------------------------------- 1 | let _ = 2 | (((Format.set_formatter_out_channel 3 | (open_out_bin "lib/Hacl_Poly1305_128_stubs.ml"); 4 | Cstubs.write_ml Format.std_formatter ~prefix:"" 5 | (module Hacl_Poly1305_128_bindings.Bindings)); 6 | Format.set_formatter_out_channel 7 | (open_out_bin "lib/Hacl_Poly1305_128_c_stubs.c")); 8 | Format.printf 9 | "#include \"Hacl_Poly1305_128.h\"\n#include \"internal/Hacl_Poly1305_128.h\"\n"); 10 | Cstubs.write_c Format.std_formatter ~prefix:"" 11 | (module Hacl_Poly1305_128_bindings.Bindings) -------------------------------------------------------------------------------- /raw/lib_gen/Hacl_Poly1305_256_gen.ml: -------------------------------------------------------------------------------- 1 | let _ = 2 | (((Format.set_formatter_out_channel 3 | (open_out_bin "lib/Hacl_Poly1305_256_stubs.ml"); 4 | Cstubs.write_ml Format.std_formatter ~prefix:"" 5 | (module Hacl_Poly1305_256_bindings.Bindings)); 6 | Format.set_formatter_out_channel 7 | (open_out_bin "lib/Hacl_Poly1305_256_c_stubs.c")); 8 | Format.printf 9 | "#include \"Hacl_Poly1305_256.h\"\n#include \"internal/Hacl_Poly1305_256.h\"\n"); 10 | Cstubs.write_c Format.std_formatter ~prefix:"" 11 | (module Hacl_Poly1305_256_bindings.Bindings) -------------------------------------------------------------------------------- /raw/lib_gen/Hacl_Streaming_Poly1305_32_gen.ml: -------------------------------------------------------------------------------- 1 | let _ = 2 | (((Format.set_formatter_out_channel 3 | (open_out_bin "lib/Hacl_Streaming_Poly1305_32_stubs.ml"); 4 | Cstubs.write_ml Format.std_formatter ~prefix:"" 5 | (module Hacl_Streaming_Poly1305_32_bindings.Bindings)); 6 | Format.set_formatter_out_channel 7 | (open_out_bin "lib/Hacl_Streaming_Poly1305_32_c_stubs.c")); 8 | Format.printf "#include \"Hacl_Streaming_Poly1305_32.h\"\n"); 9 | Cstubs.write_c Format.std_formatter ~prefix:"" 10 | (module Hacl_Streaming_Poly1305_32_bindings.Bindings) -------------------------------------------------------------------------------- /kremlin/include/kremlin/internal/builtin.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) INRIA and Microsoft Corporation. All rights reserved. 2 | Licensed under the Apache 2.0 License. */ 3 | 4 | #ifndef __KREMLIN_BUILTIN_H 5 | #define __KREMLIN_BUILTIN_H 6 | 7 | /* For alloca, when using KreMLin's -falloca */ 8 | #if (defined(_WIN32) || defined(_WIN64)) 9 | # include 10 | #endif 11 | 12 | /* If some globals need to be initialized before the main, then kremlin will 13 | * generate and try to link last a function with this type: */ 14 | void kremlinit_globals(void); 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /raw/lib_gen/Hacl_Curve25519_51_gen.ml: -------------------------------------------------------------------------------- 1 | let _ = 2 | (((Format.set_formatter_out_channel 3 | (open_out_bin "lib/Hacl_Curve25519_51_stubs.ml"); 4 | Cstubs.write_ml Format.std_formatter ~prefix:"" 5 | (module Hacl_Curve25519_51_bindings.Bindings)); 6 | Format.set_formatter_out_channel 7 | (open_out_bin "lib/Hacl_Curve25519_51_c_stubs.c")); 8 | Format.printf 9 | "#include \"Hacl_Curve25519_51.h\"\n#include \"internal/Hacl_Curve25519_51.h\"\n"); 10 | Cstubs.write_c Format.std_formatter ~prefix:"" 11 | (module Hacl_Curve25519_51_bindings.Bindings) -------------------------------------------------------------------------------- /raw/lib_gen/Hacl_HPKE_P256_CP128_SHA256_gen.ml: -------------------------------------------------------------------------------- 1 | let _ = 2 | (((Format.set_formatter_out_channel 3 | (open_out_bin "lib/Hacl_HPKE_P256_CP128_SHA256_stubs.ml"); 4 | Cstubs.write_ml Format.std_formatter ~prefix:"" 5 | (module Hacl_HPKE_P256_CP128_SHA256_bindings.Bindings)); 6 | Format.set_formatter_out_channel 7 | (open_out_bin "lib/Hacl_HPKE_P256_CP128_SHA256_c_stubs.c")); 8 | Format.printf "#include \"Hacl_HPKE_P256_CP128_SHA256.h\"\n"); 9 | Cstubs.write_c Format.std_formatter ~prefix:"" 10 | (module Hacl_HPKE_P256_CP128_SHA256_bindings.Bindings) -------------------------------------------------------------------------------- /raw/lib_gen/Hacl_HPKE_P256_CP256_SHA256_gen.ml: -------------------------------------------------------------------------------- 1 | let _ = 2 | (((Format.set_formatter_out_channel 3 | (open_out_bin "lib/Hacl_HPKE_P256_CP256_SHA256_stubs.ml"); 4 | Cstubs.write_ml Format.std_formatter ~prefix:"" 5 | (module Hacl_HPKE_P256_CP256_SHA256_bindings.Bindings)); 6 | Format.set_formatter_out_channel 7 | (open_out_bin "lib/Hacl_HPKE_P256_CP256_SHA256_c_stubs.c")); 8 | Format.printf "#include \"Hacl_HPKE_P256_CP256_SHA256.h\"\n"); 9 | Cstubs.write_c Format.std_formatter ~prefix:"" 10 | (module Hacl_HPKE_P256_CP256_SHA256_bindings.Bindings) -------------------------------------------------------------------------------- /raw/lib_gen/Hacl_IntTypes_Intrinsics_128_gen.ml: -------------------------------------------------------------------------------- 1 | let _ = 2 | (((Format.set_formatter_out_channel 3 | (open_out_bin "lib/Hacl_IntTypes_Intrinsics_128_stubs.ml"); 4 | Cstubs.write_ml Format.std_formatter ~prefix:"" 5 | (module Hacl_IntTypes_Intrinsics_128_bindings.Bindings)); 6 | Format.set_formatter_out_channel 7 | (open_out_bin "lib/Hacl_IntTypes_Intrinsics_128_c_stubs.c")); 8 | Format.printf "#include \"Hacl_IntTypes_Intrinsics_128.h\"\n"); 9 | Cstubs.write_c Format.std_formatter ~prefix:"" 10 | (module Hacl_IntTypes_Intrinsics_128_bindings.Bindings) -------------------------------------------------------------------------------- /raw/lib_gen/Hacl_HPKE_Curve51_CP32_SHA256_gen.ml: -------------------------------------------------------------------------------- 1 | let _ = 2 | (((Format.set_formatter_out_channel 3 | (open_out_bin "lib/Hacl_HPKE_Curve51_CP32_SHA256_stubs.ml"); 4 | Cstubs.write_ml Format.std_formatter ~prefix:"" 5 | (module Hacl_HPKE_Curve51_CP32_SHA256_bindings.Bindings)); 6 | Format.set_formatter_out_channel 7 | (open_out_bin "lib/Hacl_HPKE_Curve51_CP32_SHA256_c_stubs.c")); 8 | Format.printf "#include \"Hacl_HPKE_Curve51_CP32_SHA256.h\"\n"); 9 | Cstubs.write_c Format.std_formatter ~prefix:"" 10 | (module Hacl_HPKE_Curve51_CP32_SHA256_bindings.Bindings) -------------------------------------------------------------------------------- /raw/lib_gen/Hacl_HPKE_Curve51_CP32_SHA512_gen.ml: -------------------------------------------------------------------------------- 1 | let _ = 2 | (((Format.set_formatter_out_channel 3 | (open_out_bin "lib/Hacl_HPKE_Curve51_CP32_SHA512_stubs.ml"); 4 | Cstubs.write_ml Format.std_formatter ~prefix:"" 5 | (module Hacl_HPKE_Curve51_CP32_SHA512_bindings.Bindings)); 6 | Format.set_formatter_out_channel 7 | (open_out_bin "lib/Hacl_HPKE_Curve51_CP32_SHA512_c_stubs.c")); 8 | Format.printf "#include \"Hacl_HPKE_Curve51_CP32_SHA512.h\"\n"); 9 | Cstubs.write_c Format.std_formatter ~prefix:"" 10 | (module Hacl_HPKE_Curve51_CP32_SHA512_bindings.Bindings) -------------------------------------------------------------------------------- /raw/lib_gen/Hacl_HPKE_Curve64_CP32_SHA256_gen.ml: -------------------------------------------------------------------------------- 1 | let _ = 2 | (((Format.set_formatter_out_channel 3 | (open_out_bin "lib/Hacl_HPKE_Curve64_CP32_SHA256_stubs.ml"); 4 | Cstubs.write_ml Format.std_formatter ~prefix:"" 5 | (module Hacl_HPKE_Curve64_CP32_SHA256_bindings.Bindings)); 6 | Format.set_formatter_out_channel 7 | (open_out_bin "lib/Hacl_HPKE_Curve64_CP32_SHA256_c_stubs.c")); 8 | Format.printf "#include \"Hacl_HPKE_Curve64_CP32_SHA256.h\"\n"); 9 | Cstubs.write_c Format.std_formatter ~prefix:"" 10 | (module Hacl_HPKE_Curve64_CP32_SHA256_bindings.Bindings) -------------------------------------------------------------------------------- /raw/lib_gen/Hacl_HPKE_Curve64_CP32_SHA512_gen.ml: -------------------------------------------------------------------------------- 1 | let _ = 2 | (((Format.set_formatter_out_channel 3 | (open_out_bin "lib/Hacl_HPKE_Curve64_CP32_SHA512_stubs.ml"); 4 | Cstubs.write_ml Format.std_formatter ~prefix:"" 5 | (module Hacl_HPKE_Curve64_CP32_SHA512_bindings.Bindings)); 6 | Format.set_formatter_out_channel 7 | (open_out_bin "lib/Hacl_HPKE_Curve64_CP32_SHA512_c_stubs.c")); 8 | Format.printf "#include \"Hacl_HPKE_Curve64_CP32_SHA512.h\"\n"); 9 | Cstubs.write_c Format.std_formatter ~prefix:"" 10 | (module Hacl_HPKE_Curve64_CP32_SHA512_bindings.Bindings) -------------------------------------------------------------------------------- /raw/lib_gen/Hacl_HPKE_Curve51_CP128_SHA256_gen.ml: -------------------------------------------------------------------------------- 1 | let _ = 2 | (((Format.set_formatter_out_channel 3 | (open_out_bin "lib/Hacl_HPKE_Curve51_CP128_SHA256_stubs.ml"); 4 | Cstubs.write_ml Format.std_formatter ~prefix:"" 5 | (module Hacl_HPKE_Curve51_CP128_SHA256_bindings.Bindings)); 6 | Format.set_formatter_out_channel 7 | (open_out_bin "lib/Hacl_HPKE_Curve51_CP128_SHA256_c_stubs.c")); 8 | Format.printf "#include \"Hacl_HPKE_Curve51_CP128_SHA256.h\"\n"); 9 | Cstubs.write_c Format.std_formatter ~prefix:"" 10 | (module Hacl_HPKE_Curve51_CP128_SHA256_bindings.Bindings) -------------------------------------------------------------------------------- /raw/lib_gen/Hacl_HPKE_Curve51_CP128_SHA512_gen.ml: -------------------------------------------------------------------------------- 1 | let _ = 2 | (((Format.set_formatter_out_channel 3 | (open_out_bin "lib/Hacl_HPKE_Curve51_CP128_SHA512_stubs.ml"); 4 | Cstubs.write_ml Format.std_formatter ~prefix:"" 5 | (module Hacl_HPKE_Curve51_CP128_SHA512_bindings.Bindings)); 6 | Format.set_formatter_out_channel 7 | (open_out_bin "lib/Hacl_HPKE_Curve51_CP128_SHA512_c_stubs.c")); 8 | Format.printf "#include \"Hacl_HPKE_Curve51_CP128_SHA512.h\"\n"); 9 | Cstubs.write_c Format.std_formatter ~prefix:"" 10 | (module Hacl_HPKE_Curve51_CP128_SHA512_bindings.Bindings) -------------------------------------------------------------------------------- /raw/lib_gen/Hacl_HPKE_Curve51_CP256_SHA256_gen.ml: -------------------------------------------------------------------------------- 1 | let _ = 2 | (((Format.set_formatter_out_channel 3 | (open_out_bin "lib/Hacl_HPKE_Curve51_CP256_SHA256_stubs.ml"); 4 | Cstubs.write_ml Format.std_formatter ~prefix:"" 5 | (module Hacl_HPKE_Curve51_CP256_SHA256_bindings.Bindings)); 6 | Format.set_formatter_out_channel 7 | (open_out_bin "lib/Hacl_HPKE_Curve51_CP256_SHA256_c_stubs.c")); 8 | Format.printf "#include \"Hacl_HPKE_Curve51_CP256_SHA256.h\"\n"); 9 | Cstubs.write_c Format.std_formatter ~prefix:"" 10 | (module Hacl_HPKE_Curve51_CP256_SHA256_bindings.Bindings) -------------------------------------------------------------------------------- /raw/lib_gen/Hacl_HPKE_Curve51_CP256_SHA512_gen.ml: -------------------------------------------------------------------------------- 1 | let _ = 2 | (((Format.set_formatter_out_channel 3 | (open_out_bin "lib/Hacl_HPKE_Curve51_CP256_SHA512_stubs.ml"); 4 | Cstubs.write_ml Format.std_formatter ~prefix:"" 5 | (module Hacl_HPKE_Curve51_CP256_SHA512_bindings.Bindings)); 6 | Format.set_formatter_out_channel 7 | (open_out_bin "lib/Hacl_HPKE_Curve51_CP256_SHA512_c_stubs.c")); 8 | Format.printf "#include \"Hacl_HPKE_Curve51_CP256_SHA512.h\"\n"); 9 | Cstubs.write_c Format.std_formatter ~prefix:"" 10 | (module Hacl_HPKE_Curve51_CP256_SHA512_bindings.Bindings) -------------------------------------------------------------------------------- /raw/lib_gen/Hacl_HPKE_Curve64_CP128_SHA256_gen.ml: -------------------------------------------------------------------------------- 1 | let _ = 2 | (((Format.set_formatter_out_channel 3 | (open_out_bin "lib/Hacl_HPKE_Curve64_CP128_SHA256_stubs.ml"); 4 | Cstubs.write_ml Format.std_formatter ~prefix:"" 5 | (module Hacl_HPKE_Curve64_CP128_SHA256_bindings.Bindings)); 6 | Format.set_formatter_out_channel 7 | (open_out_bin "lib/Hacl_HPKE_Curve64_CP128_SHA256_c_stubs.c")); 8 | Format.printf "#include \"Hacl_HPKE_Curve64_CP128_SHA256.h\"\n"); 9 | Cstubs.write_c Format.std_formatter ~prefix:"" 10 | (module Hacl_HPKE_Curve64_CP128_SHA256_bindings.Bindings) -------------------------------------------------------------------------------- /raw/lib_gen/Hacl_HPKE_Curve64_CP128_SHA512_gen.ml: -------------------------------------------------------------------------------- 1 | let _ = 2 | (((Format.set_formatter_out_channel 3 | (open_out_bin "lib/Hacl_HPKE_Curve64_CP128_SHA512_stubs.ml"); 4 | Cstubs.write_ml Format.std_formatter ~prefix:"" 5 | (module Hacl_HPKE_Curve64_CP128_SHA512_bindings.Bindings)); 6 | Format.set_formatter_out_channel 7 | (open_out_bin "lib/Hacl_HPKE_Curve64_CP128_SHA512_c_stubs.c")); 8 | Format.printf "#include \"Hacl_HPKE_Curve64_CP128_SHA512.h\"\n"); 9 | Cstubs.write_c Format.std_formatter ~prefix:"" 10 | (module Hacl_HPKE_Curve64_CP128_SHA512_bindings.Bindings) -------------------------------------------------------------------------------- /raw/lib_gen/Hacl_HPKE_Curve64_CP256_SHA256_gen.ml: -------------------------------------------------------------------------------- 1 | let _ = 2 | (((Format.set_formatter_out_channel 3 | (open_out_bin "lib/Hacl_HPKE_Curve64_CP256_SHA256_stubs.ml"); 4 | Cstubs.write_ml Format.std_formatter ~prefix:"" 5 | (module Hacl_HPKE_Curve64_CP256_SHA256_bindings.Bindings)); 6 | Format.set_formatter_out_channel 7 | (open_out_bin "lib/Hacl_HPKE_Curve64_CP256_SHA256_c_stubs.c")); 8 | Format.printf "#include \"Hacl_HPKE_Curve64_CP256_SHA256.h\"\n"); 9 | Cstubs.write_c Format.std_formatter ~prefix:"" 10 | (module Hacl_HPKE_Curve64_CP256_SHA256_bindings.Bindings) -------------------------------------------------------------------------------- /raw/lib_gen/Hacl_HPKE_Curve64_CP256_SHA512_gen.ml: -------------------------------------------------------------------------------- 1 | let _ = 2 | (((Format.set_formatter_out_channel 3 | (open_out_bin "lib/Hacl_HPKE_Curve64_CP256_SHA512_stubs.ml"); 4 | Cstubs.write_ml Format.std_formatter ~prefix:"" 5 | (module Hacl_HPKE_Curve64_CP256_SHA512_bindings.Bindings)); 6 | Format.set_formatter_out_channel 7 | (open_out_bin "lib/Hacl_HPKE_Curve64_CP256_SHA512_c_stubs.c")); 8 | Format.printf "#include \"Hacl_HPKE_Curve64_CP256_SHA512.h\"\n"); 9 | Cstubs.write_c Format.std_formatter ~prefix:"" 10 | (module Hacl_HPKE_Curve64_CP256_SHA512_bindings.Bindings) -------------------------------------------------------------------------------- /raw/lib_gen/Hacl_Hash_Blake2b_256_gen.ml: -------------------------------------------------------------------------------- 1 | let _ = 2 | (((Format.set_formatter_out_channel 3 | (open_out_bin "lib/Hacl_Hash_Blake2b_256_stubs.ml"); 4 | Cstubs.write_ml Format.std_formatter ~prefix:"" 5 | (module Hacl_Hash_Blake2b_256_bindings.Bindings)); 6 | Format.set_formatter_out_channel 7 | (open_out_bin "lib/Hacl_Hash_Blake2b_256_c_stubs.c")); 8 | Format.printf 9 | "#include \"Hacl_Hash_Blake2b_256.h\"\n#include \"internal/Hacl_Hash_Blake2b_256.h\"\n"); 10 | Cstubs.write_c Format.std_formatter ~prefix:"" 11 | (module Hacl_Hash_Blake2b_256_bindings.Bindings) -------------------------------------------------------------------------------- /raw/lib_gen/Hacl_Hash_Blake2s_128_gen.ml: -------------------------------------------------------------------------------- 1 | let _ = 2 | (((Format.set_formatter_out_channel 3 | (open_out_bin "lib/Hacl_Hash_Blake2s_128_stubs.ml"); 4 | Cstubs.write_ml Format.std_formatter ~prefix:"" 5 | (module Hacl_Hash_Blake2s_128_bindings.Bindings)); 6 | Format.set_formatter_out_channel 7 | (open_out_bin "lib/Hacl_Hash_Blake2s_128_c_stubs.c")); 8 | Format.printf 9 | "#include \"Hacl_Hash_Blake2s_128.h\"\n#include \"internal/Hacl_Hash_Blake2s_128.h\"\n"); 10 | Cstubs.write_c Format.std_formatter ~prefix:"" 11 | (module Hacl_Hash_Blake2s_128_bindings.Bindings) -------------------------------------------------------------------------------- /raw/lib/Hacl_Hash_Blake2b_256_bindings.ml: -------------------------------------------------------------------------------- 1 | open Ctypes 2 | module Bindings(F:Cstubs.FOREIGN) = 3 | struct 4 | open F 5 | let hacl_Hash_Blake2b_256_hash_blake2b_256 = 6 | foreign "Hacl_Hash_Blake2b_256_hash_blake2b_256" 7 | (ocaml_bytes @-> (uint32_t @-> (ocaml_bytes @-> (returning void)))) 8 | let hacl_Blake2b_256_blake2b = 9 | foreign "Hacl_Blake2b_256_blake2b" 10 | (uint32_t @-> 11 | (ocaml_bytes @-> 12 | (uint32_t @-> 13 | (ocaml_bytes @-> 14 | (uint32_t @-> (ocaml_bytes @-> (returning void))))))) 15 | end -------------------------------------------------------------------------------- /raw/lib/Hacl_Hash_Blake2s_128_bindings.ml: -------------------------------------------------------------------------------- 1 | open Ctypes 2 | module Bindings(F:Cstubs.FOREIGN) = 3 | struct 4 | open F 5 | let hacl_Hash_Blake2s_128_hash_blake2s_128 = 6 | foreign "Hacl_Hash_Blake2s_128_hash_blake2s_128" 7 | (ocaml_bytes @-> (uint32_t @-> (ocaml_bytes @-> (returning void)))) 8 | let hacl_Blake2s_128_blake2s = 9 | foreign "Hacl_Blake2s_128_blake2s" 10 | (uint32_t @-> 11 | (ocaml_bytes @-> 12 | (uint32_t @-> 13 | (ocaml_bytes @-> 14 | (uint32_t @-> (ocaml_bytes @-> (returning void))))))) 15 | end -------------------------------------------------------------------------------- /raw/lib/Hacl_Curve25519_51_bindings.ml: -------------------------------------------------------------------------------- 1 | open Ctypes 2 | module Bindings(F:Cstubs.FOREIGN) = 3 | struct 4 | open F 5 | let hacl_Curve25519_51_scalarmult = 6 | foreign "Hacl_Curve25519_51_scalarmult" 7 | (ocaml_bytes @-> (ocaml_bytes @-> (ocaml_bytes @-> (returning void)))) 8 | let hacl_Curve25519_51_secret_to_public = 9 | foreign "Hacl_Curve25519_51_secret_to_public" 10 | (ocaml_bytes @-> (ocaml_bytes @-> (returning void))) 11 | let hacl_Curve25519_51_ecdh = 12 | foreign "Hacl_Curve25519_51_ecdh" 13 | (ocaml_bytes @-> (ocaml_bytes @-> (ocaml_bytes @-> (returning bool)))) 14 | end -------------------------------------------------------------------------------- /raw/lib/Hacl_Curve25519_64_bindings.ml: -------------------------------------------------------------------------------- 1 | open Ctypes 2 | module Bindings(F:Cstubs.FOREIGN) = 3 | struct 4 | open F 5 | let hacl_Curve25519_64_scalarmult = 6 | foreign "Hacl_Curve25519_64_scalarmult" 7 | (ocaml_bytes @-> (ocaml_bytes @-> (ocaml_bytes @-> (returning void)))) 8 | let hacl_Curve25519_64_secret_to_public = 9 | foreign "Hacl_Curve25519_64_secret_to_public" 10 | (ocaml_bytes @-> (ocaml_bytes @-> (returning void))) 11 | let hacl_Curve25519_64_ecdh = 12 | foreign "Hacl_Curve25519_64_ecdh" 13 | (ocaml_bytes @-> (ocaml_bytes @-> (ocaml_bytes @-> (returning bool)))) 14 | end -------------------------------------------------------------------------------- /raw/lib/Hacl_IntTypes_Intrinsics_128_bindings.ml: -------------------------------------------------------------------------------- 1 | open Ctypes 2 | module Bindings(F:Cstubs.FOREIGN) = 3 | struct 4 | open F 5 | let hacl_IntTypes_Intrinsics_128_add_carry_u64 = 6 | foreign "Hacl_IntTypes_Intrinsics_128_add_carry_u64" 7 | (uint64_t @-> 8 | (uint64_t @-> 9 | (uint64_t @-> ((ptr uint64_t) @-> (returning uint64_t))))) 10 | let hacl_IntTypes_Intrinsics_128_sub_borrow_u64 = 11 | foreign "Hacl_IntTypes_Intrinsics_128_sub_borrow_u64" 12 | (uint64_t @-> 13 | (uint64_t @-> 14 | (uint64_t @-> ((ptr uint64_t) @-> (returning uint64_t))))) 15 | end -------------------------------------------------------------------------------- /raw/lib/EverCrypt_Curve25519_bindings.ml: -------------------------------------------------------------------------------- 1 | open Ctypes 2 | module Bindings(F:Cstubs.FOREIGN) = 3 | struct 4 | open F 5 | let everCrypt_Curve25519_secret_to_public = 6 | foreign "EverCrypt_Curve25519_secret_to_public" 7 | (ocaml_bytes @-> (ocaml_bytes @-> (returning void))) 8 | let everCrypt_Curve25519_scalarmult = 9 | foreign "EverCrypt_Curve25519_scalarmult" 10 | (ocaml_bytes @-> (ocaml_bytes @-> (ocaml_bytes @-> (returning void)))) 11 | let everCrypt_Curve25519_ecdh = 12 | foreign "EverCrypt_Curve25519_ecdh" 13 | (ocaml_bytes @-> (ocaml_bytes @-> (ocaml_bytes @-> (returning bool)))) 14 | end -------------------------------------------------------------------------------- /dune: -------------------------------------------------------------------------------- 1 | (library 2 | (name hacl_star) 3 | (public_name hacl-star) 4 | (modules EverCrypt SharedDefs SharedFunctors AutoConfig2 Hacl) 5 | (libraries hacl-star-raw 6 | zarith) 7 | (preprocessor_deps config.h) 8 | (preprocess (action (run %{bin:cppo} %{input-file}))) 9 | (flags (:standard -warn-error -3))) 10 | 11 | (documentation 12 | (package hacl-star) 13 | (mld_files index)) 14 | 15 | (executable 16 | (name gen_dune_rules) 17 | (modules Gen_dune_rules)) 18 | 19 | (rule 20 | (mode promote) 21 | (action 22 | (with-stdout-to dune.inc 23 | (run ./gen_dune_rules.exe)) 24 | )) 25 | 26 | (include dune.inc) 27 | 28 | (data_only_dirs raw) 29 | -------------------------------------------------------------------------------- /raw/lib/Hacl_Curve25519_64_Slow_bindings.ml: -------------------------------------------------------------------------------- 1 | open Ctypes 2 | module Bindings(F:Cstubs.FOREIGN) = 3 | struct 4 | open F 5 | let hacl_Curve25519_64_Slow_scalarmult = 6 | foreign "Hacl_Curve25519_64_Slow_scalarmult" 7 | (ocaml_bytes @-> (ocaml_bytes @-> (ocaml_bytes @-> (returning void)))) 8 | let hacl_Curve25519_64_Slow_secret_to_public = 9 | foreign "Hacl_Curve25519_64_Slow_secret_to_public" 10 | (ocaml_bytes @-> (ocaml_bytes @-> (returning void))) 11 | let hacl_Curve25519_64_Slow_ecdh = 12 | foreign "Hacl_Curve25519_64_Slow_ecdh" 13 | (ocaml_bytes @-> (ocaml_bytes @-> (ocaml_bytes @-> (returning bool)))) 14 | end -------------------------------------------------------------------------------- /raw/lib/Hacl_HKDF_Blake2b_256_bindings.ml: -------------------------------------------------------------------------------- 1 | open Ctypes 2 | module Bindings(F:Cstubs.FOREIGN) = 3 | struct 4 | open F 5 | let hacl_HKDF_Blake2b_256_expand_blake2b_256 = 6 | foreign "Hacl_HKDF_Blake2b_256_expand_blake2b_256" 7 | (ocaml_bytes @-> 8 | (ocaml_bytes @-> 9 | (uint32_t @-> 10 | (ocaml_bytes @-> 11 | (uint32_t @-> (uint32_t @-> (returning void))))))) 12 | let hacl_HKDF_Blake2b_256_extract_blake2b_256 = 13 | foreign "Hacl_HKDF_Blake2b_256_extract_blake2b_256" 14 | (ocaml_bytes @-> 15 | (ocaml_bytes @-> 16 | (uint32_t @-> (ocaml_bytes @-> (uint32_t @-> (returning void)))))) 17 | end -------------------------------------------------------------------------------- /raw/lib/Hacl_HKDF_Blake2s_128_bindings.ml: -------------------------------------------------------------------------------- 1 | open Ctypes 2 | module Bindings(F:Cstubs.FOREIGN) = 3 | struct 4 | open F 5 | let hacl_HKDF_Blake2s_128_expand_blake2s_128 = 6 | foreign "Hacl_HKDF_Blake2s_128_expand_blake2s_128" 7 | (ocaml_bytes @-> 8 | (ocaml_bytes @-> 9 | (uint32_t @-> 10 | (ocaml_bytes @-> 11 | (uint32_t @-> (uint32_t @-> (returning void))))))) 12 | let hacl_HKDF_Blake2s_128_extract_blake2s_128 = 13 | foreign "Hacl_HKDF_Blake2s_128_extract_blake2s_128" 14 | (ocaml_bytes @-> 15 | (ocaml_bytes @-> 16 | (uint32_t @-> (ocaml_bytes @-> (uint32_t @-> (returning void)))))) 17 | end -------------------------------------------------------------------------------- /raw/lib/Hacl_Chacha20_Vec32_bindings.ml: -------------------------------------------------------------------------------- 1 | open Ctypes 2 | module Bindings(F:Cstubs.FOREIGN) = 3 | struct 4 | open F 5 | let hacl_Chacha20_Vec32_chacha20_encrypt_32 = 6 | foreign "Hacl_Chacha20_Vec32_chacha20_encrypt_32" 7 | (uint32_t @-> 8 | (ocaml_bytes @-> 9 | (ocaml_bytes @-> 10 | (ocaml_bytes @-> 11 | (ocaml_bytes @-> (uint32_t @-> (returning void))))))) 12 | let hacl_Chacha20_Vec32_chacha20_decrypt_32 = 13 | foreign "Hacl_Chacha20_Vec32_chacha20_decrypt_32" 14 | (uint32_t @-> 15 | (ocaml_bytes @-> 16 | (ocaml_bytes @-> 17 | (ocaml_bytes @-> 18 | (ocaml_bytes @-> (uint32_t @-> (returning void))))))) 19 | end -------------------------------------------------------------------------------- /raw/lib/Hacl_Chacha20_Vec128_bindings.ml: -------------------------------------------------------------------------------- 1 | open Ctypes 2 | module Bindings(F:Cstubs.FOREIGN) = 3 | struct 4 | open F 5 | let hacl_Chacha20_Vec128_chacha20_encrypt_128 = 6 | foreign "Hacl_Chacha20_Vec128_chacha20_encrypt_128" 7 | (uint32_t @-> 8 | (ocaml_bytes @-> 9 | (ocaml_bytes @-> 10 | (ocaml_bytes @-> 11 | (ocaml_bytes @-> (uint32_t @-> (returning void))))))) 12 | let hacl_Chacha20_Vec128_chacha20_decrypt_128 = 13 | foreign "Hacl_Chacha20_Vec128_chacha20_decrypt_128" 14 | (uint32_t @-> 15 | (ocaml_bytes @-> 16 | (ocaml_bytes @-> 17 | (ocaml_bytes @-> 18 | (ocaml_bytes @-> (uint32_t @-> (returning void))))))) 19 | end -------------------------------------------------------------------------------- /raw/lib/Hacl_Chacha20_Vec256_bindings.ml: -------------------------------------------------------------------------------- 1 | open Ctypes 2 | module Bindings(F:Cstubs.FOREIGN) = 3 | struct 4 | open F 5 | let hacl_Chacha20_Vec256_chacha20_encrypt_256 = 6 | foreign "Hacl_Chacha20_Vec256_chacha20_encrypt_256" 7 | (uint32_t @-> 8 | (ocaml_bytes @-> 9 | (ocaml_bytes @-> 10 | (ocaml_bytes @-> 11 | (ocaml_bytes @-> (uint32_t @-> (returning void))))))) 12 | let hacl_Chacha20_Vec256_chacha20_decrypt_256 = 13 | foreign "Hacl_Chacha20_Vec256_chacha20_decrypt_256" 14 | (uint32_t @-> 15 | (ocaml_bytes @-> 16 | (ocaml_bytes @-> 17 | (ocaml_bytes @-> 18 | (ocaml_bytes @-> (uint32_t @-> (returning void))))))) 19 | end -------------------------------------------------------------------------------- /raw/lib/Hacl_SHA2_Scalar32_bindings.ml: -------------------------------------------------------------------------------- 1 | open Ctypes 2 | module Bindings(F:Cstubs.FOREIGN) = 3 | struct 4 | open F 5 | let hacl_SHA2_Scalar32_sha224 = 6 | foreign "Hacl_SHA2_Scalar32_sha224" 7 | (ocaml_bytes @-> (uint32_t @-> (ocaml_bytes @-> (returning void)))) 8 | let hacl_SHA2_Scalar32_sha256 = 9 | foreign "Hacl_SHA2_Scalar32_sha256" 10 | (ocaml_bytes @-> (uint32_t @-> (ocaml_bytes @-> (returning void)))) 11 | let hacl_SHA2_Scalar32_sha384 = 12 | foreign "Hacl_SHA2_Scalar32_sha384" 13 | (ocaml_bytes @-> (uint32_t @-> (ocaml_bytes @-> (returning void)))) 14 | let hacl_SHA2_Scalar32_sha512 = 15 | foreign "Hacl_SHA2_Scalar32_sha512" 16 | (ocaml_bytes @-> (uint32_t @-> (ocaml_bytes @-> (returning void)))) 17 | end -------------------------------------------------------------------------------- /raw/lib/EverCrypt_Vale_bindings.ml: -------------------------------------------------------------------------------- 1 | open Ctypes 2 | module Bindings(F:Cstubs.FOREIGN) = 3 | struct 4 | open F 5 | type gcm_args = [ `gcm_args ] structure 6 | let (gcm_args : [ `gcm_args ] structure typ) = structure "gcm_args_s" 7 | let gcm_args_plain = field gcm_args "plain" (ptr uint8_t) 8 | let gcm_args_plain_len = field gcm_args "plain_len" uint64_t 9 | let gcm_args_aad = field gcm_args "aad" (ptr uint8_t) 10 | let gcm_args_aad_len = field gcm_args "aad_len" uint64_t 11 | let gcm_args_iv = field gcm_args "iv" (ptr uint8_t) 12 | let gcm_args_expanded_key = field gcm_args "expanded_key" (ptr uint8_t) 13 | let gcm_args_cipher = field gcm_args "cipher" (ptr uint8_t) 14 | let gcm_args_tag = field gcm_args "tag" (ptr uint8_t) 15 | let _ = seal gcm_args 16 | end -------------------------------------------------------------------------------- /raw/lib/Hacl_Bignum_Base_bindings.ml: -------------------------------------------------------------------------------- 1 | open Ctypes 2 | module Bindings(F:Cstubs.FOREIGN) = 3 | struct 4 | open F 5 | let hacl_Bignum_Base_mul_wide_add_u64 = 6 | foreign "Hacl_Bignum_Base_mul_wide_add_u64" 7 | (uint64_t @-> 8 | (uint64_t @-> 9 | (uint64_t @-> ((ptr uint64_t) @-> (returning uint64_t))))) 10 | let hacl_Bignum_Base_mul_wide_add2_u32 = 11 | foreign "Hacl_Bignum_Base_mul_wide_add2_u32" 12 | (uint32_t @-> 13 | (uint32_t @-> 14 | (uint32_t @-> ((ptr uint32_t) @-> (returning uint32_t))))) 15 | let hacl_Bignum_Base_mul_wide_add2_u64 = 16 | foreign "Hacl_Bignum_Base_mul_wide_add2_u64" 17 | (uint64_t @-> 18 | (uint64_t @-> 19 | (uint64_t @-> ((ptr uint64_t) @-> (returning uint64_t))))) 20 | end -------------------------------------------------------------------------------- /AutoConfig2.ml: -------------------------------------------------------------------------------- 1 | module EverCrypt_AutoConfig2 = EverCrypt_AutoConfig2_bindings.Bindings(EverCrypt_AutoConfig2_stubs) 2 | 3 | open EverCrypt_AutoConfig2 4 | type feature = 5 | | SHAEXT 6 | | AES_NI 7 | | PCLMULQDQ 8 | | VEC128 9 | | VEC256 10 | | BMI2 11 | | ADX 12 | | SSE 13 | | MOVBE 14 | | RDRAND 15 | let init () = everCrypt_AutoConfig2_init () 16 | let has_feature = function 17 | | SHAEXT -> everCrypt_AutoConfig2_has_shaext () 18 | | AES_NI -> everCrypt_AutoConfig2_has_aesni () 19 | | PCLMULQDQ -> everCrypt_AutoConfig2_has_pclmulqdq () 20 | | VEC128 -> false 21 | | VEC256 -> false 22 | | BMI2 -> everCrypt_AutoConfig2_has_bmi2 () 23 | | ADX -> everCrypt_AutoConfig2_has_adx () 24 | | SSE -> everCrypt_AutoConfig2_has_sse () 25 | | MOVBE -> everCrypt_AutoConfig2_has_movbe () 26 | | RDRAND -> everCrypt_AutoConfig2_has_rdrand () 27 | 28 | let () = init () 29 | -------------------------------------------------------------------------------- /kremlin/kremlib/dist/minimal/LowStar_Endianness.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) INRIA and Microsoft Corporation. All rights reserved. 3 | Licensed under the Apache 2.0 License. 4 | */ 5 | 6 | 7 | #ifndef __LowStar_Endianness_H 8 | #define __LowStar_Endianness_H 9 | #include 10 | #include 11 | #include "kremlin/internal/compat.h" 12 | #include "kremlin/lowstar_endianness.h" 13 | #include "kremlin/internal/types.h" 14 | #include "kremlin/internal/target.h" 15 | 16 | 17 | #include "FStar_UInt128.h" 18 | 19 | static inline void store128_le(uint8_t *x0, FStar_UInt128_uint128 x1); 20 | 21 | static inline FStar_UInt128_uint128 load128_le(uint8_t *x0); 22 | 23 | static inline void store128_be(uint8_t *x0, FStar_UInt128_uint128 x1); 24 | 25 | static inline FStar_UInt128_uint128 load128_be(uint8_t *x0); 26 | 27 | 28 | #define __LowStar_Endianness_H_DEFINED 29 | #endif 30 | -------------------------------------------------------------------------------- /raw/lib/Hacl_Hash_Base_bindings.ml: -------------------------------------------------------------------------------- 1 | open Ctypes 2 | module Bindings(F:Cstubs.FOREIGN) = 3 | struct 4 | open F 5 | module Hacl_Spec_applied = (Hacl_Spec_bindings.Bindings)(Hacl_Spec_stubs) 6 | open Hacl_Spec_applied 7 | let hacl_Hash_Definitions_word_len = 8 | foreign "Hacl_Hash_Definitions_word_len" 9 | (spec_Hash_Definitions_hash_alg @-> (returning uint32_t)) 10 | let hacl_Hash_Definitions_block_len = 11 | foreign "Hacl_Hash_Definitions_block_len" 12 | (spec_Hash_Definitions_hash_alg @-> (returning uint32_t)) 13 | let hacl_Hash_Definitions_hash_word_len = 14 | foreign "Hacl_Hash_Definitions_hash_word_len" 15 | (spec_Hash_Definitions_hash_alg @-> (returning uint32_t)) 16 | let hacl_Hash_Definitions_hash_len = 17 | foreign "Hacl_Hash_Definitions_hash_len" 18 | (spec_Hash_Definitions_hash_alg @-> (returning uint32_t)) 19 | end -------------------------------------------------------------------------------- /raw/lib/EverCrypt_Error_bindings.ml: -------------------------------------------------------------------------------- 1 | open Ctypes 2 | module Bindings(F:Cstubs.FOREIGN) = 3 | struct 4 | open F 5 | type everCrypt_Error_error_code = Unsigned.UInt8.t 6 | let everCrypt_Error_error_code = 7 | typedef uint8_t "EverCrypt_Error_error_code" 8 | let everCrypt_Error_error_code_EverCrypt_Error_Success = 9 | Unsigned.UInt8.of_int 0 10 | let everCrypt_Error_error_code_EverCrypt_Error_UnsupportedAlgorithm = 11 | Unsigned.UInt8.of_int 1 12 | let everCrypt_Error_error_code_EverCrypt_Error_InvalidKey = 13 | Unsigned.UInt8.of_int 2 14 | let everCrypt_Error_error_code_EverCrypt_Error_AuthenticationFailure = 15 | Unsigned.UInt8.of_int 3 16 | let everCrypt_Error_error_code_EverCrypt_Error_InvalidIVLength = 17 | Unsigned.UInt8.of_int 4 18 | let everCrypt_Error_error_code_EverCrypt_Error_DecodeError = 19 | Unsigned.UInt8.of_int 5 20 | end -------------------------------------------------------------------------------- /tests/test_utils.ml: -------------------------------------------------------------------------------- 1 | open EverCrypt.Error 2 | 3 | type result = 4 | | Success 5 | | Failure 6 | | Skipped 7 | 8 | let test_result t res r = 9 | let r = if r <> "" then 10 | Printf.sprintf ": %s" r 11 | else 12 | "" 13 | in 14 | match res with 15 | | Success -> Printf.printf "[%s] Success%s\n" t r 16 | | Failure -> failwith (Printf.sprintf "[%s] Failure%s" t r) 17 | | Skipped -> Printf.printf "[%s] Skipped%s\n" t r 18 | 19 | let print_error = function 20 | | UnsupportedAlgorithm -> "Unsupported algorithm" 21 | | InvalidKey -> "Invalid key" 22 | | AuthenticationFailure -> "Authentication failure" 23 | | InvalidIVLength -> "Invalid IV length" 24 | | DecodeError -> "Decode error" 25 | 26 | let init_bytes len = 27 | let buf = Bytes.create len in 28 | Bytes.fill buf 0 len '\x00'; 29 | buf 30 | 31 | let rec supports = function 32 | | [] -> true 33 | | f::fs -> AutoConfig2.has_feature f && supports fs 34 | -------------------------------------------------------------------------------- /raw/lib/Hacl_Chacha20Poly1305_32_bindings.ml: -------------------------------------------------------------------------------- 1 | open Ctypes 2 | module Bindings(F:Cstubs.FOREIGN) = 3 | struct 4 | open F 5 | let hacl_Chacha20Poly1305_32_aead_encrypt = 6 | foreign "Hacl_Chacha20Poly1305_32_aead_encrypt" 7 | (ocaml_bytes @-> 8 | (ocaml_bytes @-> 9 | (uint32_t @-> 10 | (ocaml_bytes @-> 11 | (uint32_t @-> 12 | (ocaml_bytes @-> 13 | (ocaml_bytes @-> (ocaml_bytes @-> (returning void))))))))) 14 | let hacl_Chacha20Poly1305_32_aead_decrypt = 15 | foreign "Hacl_Chacha20Poly1305_32_aead_decrypt" 16 | (ocaml_bytes @-> 17 | (ocaml_bytes @-> 18 | (uint32_t @-> 19 | (ocaml_bytes @-> 20 | (uint32_t @-> 21 | (ocaml_bytes @-> 22 | (ocaml_bytes @-> 23 | (ocaml_bytes @-> (returning uint32_t))))))))) 24 | end -------------------------------------------------------------------------------- /raw/lib/Hacl_Chacha20Poly1305_128_bindings.ml: -------------------------------------------------------------------------------- 1 | open Ctypes 2 | module Bindings(F:Cstubs.FOREIGN) = 3 | struct 4 | open F 5 | let hacl_Chacha20Poly1305_128_aead_encrypt = 6 | foreign "Hacl_Chacha20Poly1305_128_aead_encrypt" 7 | (ocaml_bytes @-> 8 | (ocaml_bytes @-> 9 | (uint32_t @-> 10 | (ocaml_bytes @-> 11 | (uint32_t @-> 12 | (ocaml_bytes @-> 13 | (ocaml_bytes @-> (ocaml_bytes @-> (returning void))))))))) 14 | let hacl_Chacha20Poly1305_128_aead_decrypt = 15 | foreign "Hacl_Chacha20Poly1305_128_aead_decrypt" 16 | (ocaml_bytes @-> 17 | (ocaml_bytes @-> 18 | (uint32_t @-> 19 | (ocaml_bytes @-> 20 | (uint32_t @-> 21 | (ocaml_bytes @-> 22 | (ocaml_bytes @-> 23 | (ocaml_bytes @-> (returning uint32_t))))))))) 24 | end -------------------------------------------------------------------------------- /raw/lib/Hacl_Chacha20Poly1305_256_bindings.ml: -------------------------------------------------------------------------------- 1 | open Ctypes 2 | module Bindings(F:Cstubs.FOREIGN) = 3 | struct 4 | open F 5 | let hacl_Chacha20Poly1305_256_aead_encrypt = 6 | foreign "Hacl_Chacha20Poly1305_256_aead_encrypt" 7 | (ocaml_bytes @-> 8 | (ocaml_bytes @-> 9 | (uint32_t @-> 10 | (ocaml_bytes @-> 11 | (uint32_t @-> 12 | (ocaml_bytes @-> 13 | (ocaml_bytes @-> (ocaml_bytes @-> (returning void))))))))) 14 | let hacl_Chacha20Poly1305_256_aead_decrypt = 15 | foreign "Hacl_Chacha20Poly1305_256_aead_decrypt" 16 | (ocaml_bytes @-> 17 | (ocaml_bytes @-> 18 | (uint32_t @-> 19 | (ocaml_bytes @-> 20 | (uint32_t @-> 21 | (ocaml_bytes @-> 22 | (ocaml_bytes @-> 23 | (ocaml_bytes @-> (returning uint32_t))))))))) 24 | end -------------------------------------------------------------------------------- /raw/lib/EverCrypt_Chacha20Poly1305_bindings.ml: -------------------------------------------------------------------------------- 1 | open Ctypes 2 | module Bindings(F:Cstubs.FOREIGN) = 3 | struct 4 | open F 5 | let everCrypt_Chacha20Poly1305_aead_encrypt = 6 | foreign "EverCrypt_Chacha20Poly1305_aead_encrypt" 7 | (ocaml_bytes @-> 8 | (ocaml_bytes @-> 9 | (uint32_t @-> 10 | (ocaml_bytes @-> 11 | (uint32_t @-> 12 | (ocaml_bytes @-> 13 | (ocaml_bytes @-> (ocaml_bytes @-> (returning void))))))))) 14 | let everCrypt_Chacha20Poly1305_aead_decrypt = 15 | foreign "EverCrypt_Chacha20Poly1305_aead_decrypt" 16 | (ocaml_bytes @-> 17 | (ocaml_bytes @-> 18 | (uint32_t @-> 19 | (ocaml_bytes @-> 20 | (uint32_t @-> 21 | (ocaml_bytes @-> 22 | (ocaml_bytes @-> 23 | (ocaml_bytes @-> (returning uint32_t))))))))) 24 | end -------------------------------------------------------------------------------- /raw/lib/EverCrypt_Ed25519_bindings.ml: -------------------------------------------------------------------------------- 1 | open Ctypes 2 | module Bindings(F:Cstubs.FOREIGN) = 3 | struct 4 | open F 5 | let everCrypt_Ed25519_sign = 6 | foreign "EverCrypt_Ed25519_sign" 7 | (ocaml_bytes @-> 8 | (ocaml_bytes @-> (uint32_t @-> (ocaml_bytes @-> (returning void))))) 9 | let everCrypt_Ed25519_verify = 10 | foreign "EverCrypt_Ed25519_verify" 11 | (ocaml_bytes @-> 12 | (uint32_t @-> (ocaml_bytes @-> (ocaml_bytes @-> (returning bool))))) 13 | let everCrypt_Ed25519_secret_to_public = 14 | foreign "EverCrypt_Ed25519_secret_to_public" 15 | (ocaml_bytes @-> (ocaml_bytes @-> (returning void))) 16 | let everCrypt_Ed25519_expand_keys = 17 | foreign "EverCrypt_Ed25519_expand_keys" 18 | (ocaml_bytes @-> (ocaml_bytes @-> (returning void))) 19 | let everCrypt_Ed25519_sign_expanded = 20 | foreign "EverCrypt_Ed25519_sign_expanded" 21 | (ocaml_bytes @-> 22 | (ocaml_bytes @-> (uint32_t @-> (ocaml_bytes @-> (returning void))))) 23 | end -------------------------------------------------------------------------------- /hacl-star.opam: -------------------------------------------------------------------------------- 1 | opam-version: "2.0" 2 | name: "hacl-star" 3 | version: "0.4.5" 4 | synopsis: "OCaml API for EverCrypt/HACL*" 5 | description: """ 6 | Documentation for this library can be found 7 | [here](https://hacl-star.github.io/ocaml_doc/hacl-star/index.html). 8 | """ 9 | maintainer: "Victor Dumitrescu " 10 | authors: [ "Project Everest" ] 11 | license: "Apache-2.0" 12 | homepage: "https://hacl-star.github.io/" 13 | doc: "https://hacl-star.github.io/ocaml_doc" 14 | bug-reports: "https://github.com/project-everest/hacl-star/issues" 15 | depends: [ 16 | "ocaml" { >= "4.08.0" } 17 | "dune" {>= "2.6"} 18 | "hacl-star-raw" {= version} 19 | "zarith" 20 | "cppo" {build} 21 | "odoc" {with-doc} 22 | ] 23 | available: [ 24 | os = "freebsd" | os-family != "bsd" 25 | ] 26 | build: [ 27 | [ 28 | "dune" "build" "-p" name "-j" jobs 29 | "@doc" {with-doc} 30 | ] 31 | ] 32 | run-test: [ 33 | ["dune" "runtest" "-p" name "-j" jobs] 34 | ] 35 | dev-repo: "git+https://github.com/project-everest/hacl-star.git" 36 | -------------------------------------------------------------------------------- /raw/lib/Hacl_Salsa20_bindings.ml: -------------------------------------------------------------------------------- 1 | open Ctypes 2 | module Bindings(F:Cstubs.FOREIGN) = 3 | struct 4 | open F 5 | let hacl_Salsa20_salsa20_encrypt = 6 | foreign "Hacl_Salsa20_salsa20_encrypt" 7 | (uint32_t @-> 8 | (ocaml_bytes @-> 9 | (ocaml_bytes @-> 10 | (ocaml_bytes @-> 11 | (ocaml_bytes @-> (uint32_t @-> (returning void))))))) 12 | let hacl_Salsa20_salsa20_decrypt = 13 | foreign "Hacl_Salsa20_salsa20_decrypt" 14 | (uint32_t @-> 15 | (ocaml_bytes @-> 16 | (ocaml_bytes @-> 17 | (ocaml_bytes @-> 18 | (ocaml_bytes @-> (uint32_t @-> (returning void))))))) 19 | let hacl_Salsa20_salsa20_key_block0 = 20 | foreign "Hacl_Salsa20_salsa20_key_block0" 21 | (ocaml_bytes @-> (ocaml_bytes @-> (ocaml_bytes @-> (returning void)))) 22 | let hacl_Salsa20_hsalsa20 = 23 | foreign "Hacl_Salsa20_hsalsa20" 24 | (ocaml_bytes @-> (ocaml_bytes @-> (ocaml_bytes @-> (returning void)))) 25 | end -------------------------------------------------------------------------------- /raw/lib/Hacl_SHA2_Vec128_bindings.ml: -------------------------------------------------------------------------------- 1 | open Ctypes 2 | module Bindings(F:Cstubs.FOREIGN) = 3 | struct 4 | open F 5 | let hacl_SHA2_Vec128_sha224_4 = 6 | foreign "Hacl_SHA2_Vec128_sha224_4" 7 | (ocaml_bytes @-> 8 | (ocaml_bytes @-> 9 | (ocaml_bytes @-> 10 | (ocaml_bytes @-> 11 | (uint32_t @-> 12 | (ocaml_bytes @-> 13 | (ocaml_bytes @-> 14 | (ocaml_bytes @-> 15 | (ocaml_bytes @-> (returning void)))))))))) 16 | let hacl_SHA2_Vec128_sha256_4 = 17 | foreign "Hacl_SHA2_Vec128_sha256_4" 18 | (ocaml_bytes @-> 19 | (ocaml_bytes @-> 20 | (ocaml_bytes @-> 21 | (ocaml_bytes @-> 22 | (uint32_t @-> 23 | (ocaml_bytes @-> 24 | (ocaml_bytes @-> 25 | (ocaml_bytes @-> 26 | (ocaml_bytes @-> (returning void)))))))))) 27 | end -------------------------------------------------------------------------------- /CHANGES.md: -------------------------------------------------------------------------------- 1 | ## 0.4.5 2 | - Faster fallback implementations for certain intrinsics, leading to improved 3 | performance, notably on ARMv8 4 | 5 | ## 0.4.4 6 | - Build fixes (#494) 7 | 8 | ## 0.4.3 9 | - Improved performance for Ed25519 (#486) 10 | 11 | ## 0.4.2 12 | - Fix for bug impacting performance 13 | 14 | ## 0.4.1 15 | - Support for FreeBSD 16 | - Build fixes 17 | 18 | ## 0.4.0 19 | - Complete documentation 20 | - Redesigned API: 21 | * by default, functions return result buffer instead of taking them as arguments 22 | * arguments are now labeled 23 | - Improvements to runtime checks, unit tests 24 | 25 | ## 0.3.2 26 | - Build fixes addressing performance and compatibility issues 27 | 28 | ## 0.3.0 29 | - Updates to P-256 API 30 | - Build fixes 31 | 32 | ## 0.2.2 33 | - Fix for bug impacting performance 34 | 35 | ## 0.2.1 36 | - Minor fixes 37 | 38 | ## 0.2.0 39 | - Updated bindings for P-256 40 | - Bytecode files provided in hacl-star-raw to ease debugging 41 | 42 | ## 0.1.1 43 | - Support for ARM 44 | 45 | ## 0.1 46 | The first release of the OCaml API for HACL* 47 | -------------------------------------------------------------------------------- /raw/lib/Hacl_IntTypes_Intrinsics_bindings.ml: -------------------------------------------------------------------------------- 1 | open Ctypes 2 | module Bindings(F:Cstubs.FOREIGN) = 3 | struct 4 | open F 5 | let hacl_IntTypes_Intrinsics_add_carry_u32 = 6 | foreign "Hacl_IntTypes_Intrinsics_add_carry_u32" 7 | (uint32_t @-> 8 | (uint32_t @-> 9 | (uint32_t @-> ((ptr uint32_t) @-> (returning uint32_t))))) 10 | let hacl_IntTypes_Intrinsics_sub_borrow_u32 = 11 | foreign "Hacl_IntTypes_Intrinsics_sub_borrow_u32" 12 | (uint32_t @-> 13 | (uint32_t @-> 14 | (uint32_t @-> ((ptr uint32_t) @-> (returning uint32_t))))) 15 | let hacl_IntTypes_Intrinsics_add_carry_u64 = 16 | foreign "Hacl_IntTypes_Intrinsics_add_carry_u64" 17 | (uint64_t @-> 18 | (uint64_t @-> 19 | (uint64_t @-> ((ptr uint64_t) @-> (returning uint64_t))))) 20 | let hacl_IntTypes_Intrinsics_sub_borrow_u64 = 21 | foreign "Hacl_IntTypes_Intrinsics_sub_borrow_u64" 22 | (uint64_t @-> 23 | (uint64_t @-> 24 | (uint64_t @-> ((ptr uint64_t) @-> (returning uint64_t))))) 25 | end -------------------------------------------------------------------------------- /raw/lib/Hacl_Frodo64_bindings.ml: -------------------------------------------------------------------------------- 1 | open Ctypes 2 | module Bindings(F:Cstubs.FOREIGN) = 3 | struct 4 | open F 5 | let hacl_Frodo64_crypto_bytes = 6 | foreign_value "Hacl_Frodo64_crypto_bytes" uint32_t 7 | let hacl_Frodo64_crypto_publickeybytes = 8 | foreign_value "Hacl_Frodo64_crypto_publickeybytes" uint32_t 9 | let hacl_Frodo64_crypto_secretkeybytes = 10 | foreign_value "Hacl_Frodo64_crypto_secretkeybytes" uint32_t 11 | let hacl_Frodo64_crypto_ciphertextbytes = 12 | foreign_value "Hacl_Frodo64_crypto_ciphertextbytes" uint32_t 13 | let hacl_Frodo64_crypto_kem_keypair = 14 | foreign "Hacl_Frodo64_crypto_kem_keypair" 15 | (ocaml_bytes @-> (ocaml_bytes @-> (returning uint32_t))) 16 | let hacl_Frodo64_crypto_kem_enc = 17 | foreign "Hacl_Frodo64_crypto_kem_enc" 18 | (ocaml_bytes @-> 19 | (ocaml_bytes @-> (ocaml_bytes @-> (returning uint32_t)))) 20 | let hacl_Frodo64_crypto_kem_dec = 21 | foreign "Hacl_Frodo64_crypto_kem_dec" 22 | (ocaml_bytes @-> 23 | (ocaml_bytes @-> (ocaml_bytes @-> (returning uint32_t)))) 24 | end -------------------------------------------------------------------------------- /raw/lib/Hacl_Bignum25519_51_bindings.ml: -------------------------------------------------------------------------------- 1 | open Ctypes 2 | module Bindings(F:Cstubs.FOREIGN) = 3 | struct 4 | open F 5 | let hacl_Impl_Curve25519_Field51_fadd = 6 | foreign "Hacl_Impl_Curve25519_Field51_fadd" 7 | ((ptr uint64_t) @-> 8 | ((ptr uint64_t) @-> ((ptr uint64_t) @-> (returning void)))) 9 | let hacl_Impl_Curve25519_Field51_fsub = 10 | foreign "Hacl_Impl_Curve25519_Field51_fsub" 11 | ((ptr uint64_t) @-> 12 | ((ptr uint64_t) @-> ((ptr uint64_t) @-> (returning void)))) 13 | let hacl_Impl_Curve25519_Field51_fmul1 = 14 | foreign "Hacl_Impl_Curve25519_Field51_fmul1" 15 | ((ptr uint64_t) @-> 16 | ((ptr uint64_t) @-> (uint64_t @-> (returning void)))) 17 | let hacl_Impl_Curve25519_Field51_store_felem = 18 | foreign "Hacl_Impl_Curve25519_Field51_store_felem" 19 | ((ptr uint64_t) @-> ((ptr uint64_t) @-> (returning void))) 20 | let hacl_Impl_Curve25519_Field51_cswap2 = 21 | foreign "Hacl_Impl_Curve25519_Field51_cswap2" 22 | (uint64_t @-> 23 | ((ptr uint64_t) @-> ((ptr uint64_t) @-> (returning void)))) 24 | end -------------------------------------------------------------------------------- /raw/lib/Hacl_Frodo640_bindings.ml: -------------------------------------------------------------------------------- 1 | open Ctypes 2 | module Bindings(F:Cstubs.FOREIGN) = 3 | struct 4 | open F 5 | let hacl_Frodo640_crypto_bytes = 6 | foreign_value "Hacl_Frodo640_crypto_bytes" uint32_t 7 | let hacl_Frodo640_crypto_publickeybytes = 8 | foreign_value "Hacl_Frodo640_crypto_publickeybytes" uint32_t 9 | let hacl_Frodo640_crypto_secretkeybytes = 10 | foreign_value "Hacl_Frodo640_crypto_secretkeybytes" uint32_t 11 | let hacl_Frodo640_crypto_ciphertextbytes = 12 | foreign_value "Hacl_Frodo640_crypto_ciphertextbytes" uint32_t 13 | let hacl_Frodo640_crypto_kem_keypair = 14 | foreign "Hacl_Frodo640_crypto_kem_keypair" 15 | (ocaml_bytes @-> (ocaml_bytes @-> (returning uint32_t))) 16 | let hacl_Frodo640_crypto_kem_enc = 17 | foreign "Hacl_Frodo640_crypto_kem_enc" 18 | (ocaml_bytes @-> 19 | (ocaml_bytes @-> (ocaml_bytes @-> (returning uint32_t)))) 20 | let hacl_Frodo640_crypto_kem_dec = 21 | foreign "Hacl_Frodo640_crypto_kem_dec" 22 | (ocaml_bytes @-> 23 | (ocaml_bytes @-> (ocaml_bytes @-> (returning uint32_t)))) 24 | end -------------------------------------------------------------------------------- /raw/lib/Hacl_Frodo976_bindings.ml: -------------------------------------------------------------------------------- 1 | open Ctypes 2 | module Bindings(F:Cstubs.FOREIGN) = 3 | struct 4 | open F 5 | let hacl_Frodo976_crypto_bytes = 6 | foreign_value "Hacl_Frodo976_crypto_bytes" uint32_t 7 | let hacl_Frodo976_crypto_publickeybytes = 8 | foreign_value "Hacl_Frodo976_crypto_publickeybytes" uint32_t 9 | let hacl_Frodo976_crypto_secretkeybytes = 10 | foreign_value "Hacl_Frodo976_crypto_secretkeybytes" uint32_t 11 | let hacl_Frodo976_crypto_ciphertextbytes = 12 | foreign_value "Hacl_Frodo976_crypto_ciphertextbytes" uint32_t 13 | let hacl_Frodo976_crypto_kem_keypair = 14 | foreign "Hacl_Frodo976_crypto_kem_keypair" 15 | (ocaml_bytes @-> (ocaml_bytes @-> (returning uint32_t))) 16 | let hacl_Frodo976_crypto_kem_enc = 17 | foreign "Hacl_Frodo976_crypto_kem_enc" 18 | (ocaml_bytes @-> 19 | (ocaml_bytes @-> (ocaml_bytes @-> (returning uint32_t)))) 20 | let hacl_Frodo976_crypto_kem_dec = 21 | foreign "Hacl_Frodo976_crypto_kem_dec" 22 | (ocaml_bytes @-> 23 | (ocaml_bytes @-> (ocaml_bytes @-> (returning uint32_t)))) 24 | end -------------------------------------------------------------------------------- /raw/lib/Hacl_Poly1305_32_bindings.ml: -------------------------------------------------------------------------------- 1 | open Ctypes 2 | module Bindings(F:Cstubs.FOREIGN) = 3 | struct 4 | open F 5 | let hacl_Poly1305_32_blocklen = 6 | foreign_value "Hacl_Poly1305_32_blocklen" uint32_t 7 | let hacl_Poly1305_32_poly1305_init = 8 | foreign "Hacl_Poly1305_32_poly1305_init" 9 | ((ptr uint64_t) @-> (ocaml_bytes @-> (returning void))) 10 | let hacl_Poly1305_32_poly1305_update1 = 11 | foreign "Hacl_Poly1305_32_poly1305_update1" 12 | ((ptr uint64_t) @-> (ocaml_bytes @-> (returning void))) 13 | let hacl_Poly1305_32_poly1305_update = 14 | foreign "Hacl_Poly1305_32_poly1305_update" 15 | ((ptr uint64_t) @-> (uint32_t @-> (ocaml_bytes @-> (returning void)))) 16 | let hacl_Poly1305_32_poly1305_finish = 17 | foreign "Hacl_Poly1305_32_poly1305_finish" 18 | (ocaml_bytes @-> 19 | (ocaml_bytes @-> ((ptr uint64_t) @-> (returning void)))) 20 | let hacl_Poly1305_32_poly1305_mac = 21 | foreign "Hacl_Poly1305_32_poly1305_mac" 22 | (ocaml_bytes @-> 23 | (uint32_t @-> (ocaml_bytes @-> (ocaml_bytes @-> (returning void))))) 24 | end -------------------------------------------------------------------------------- /raw/lib/Hacl_Frodo1344_bindings.ml: -------------------------------------------------------------------------------- 1 | open Ctypes 2 | module Bindings(F:Cstubs.FOREIGN) = 3 | struct 4 | open F 5 | let hacl_Frodo1344_crypto_bytes = 6 | foreign_value "Hacl_Frodo1344_crypto_bytes" uint32_t 7 | let hacl_Frodo1344_crypto_publickeybytes = 8 | foreign_value "Hacl_Frodo1344_crypto_publickeybytes" uint32_t 9 | let hacl_Frodo1344_crypto_secretkeybytes = 10 | foreign_value "Hacl_Frodo1344_crypto_secretkeybytes" uint32_t 11 | let hacl_Frodo1344_crypto_ciphertextbytes = 12 | foreign_value "Hacl_Frodo1344_crypto_ciphertextbytes" uint32_t 13 | let hacl_Frodo1344_crypto_kem_keypair = 14 | foreign "Hacl_Frodo1344_crypto_kem_keypair" 15 | (ocaml_bytes @-> (ocaml_bytes @-> (returning uint32_t))) 16 | let hacl_Frodo1344_crypto_kem_enc = 17 | foreign "Hacl_Frodo1344_crypto_kem_enc" 18 | (ocaml_bytes @-> 19 | (ocaml_bytes @-> (ocaml_bytes @-> (returning uint32_t)))) 20 | let hacl_Frodo1344_crypto_kem_dec = 21 | foreign "Hacl_Frodo1344_crypto_kem_dec" 22 | (ocaml_bytes @-> 23 | (ocaml_bytes @-> (ocaml_bytes @-> (returning uint32_t)))) 24 | end -------------------------------------------------------------------------------- /raw/lib/Hacl_Hash_MD5_bindings.ml: -------------------------------------------------------------------------------- 1 | open Ctypes 2 | module Bindings(F:Cstubs.FOREIGN) = 3 | struct 4 | open F 5 | let hacl_Hash_Core_MD5_legacy_init = 6 | foreign "Hacl_Hash_Core_MD5_legacy_init" 7 | ((ptr uint32_t) @-> (returning void)) 8 | let hacl_Hash_Core_MD5_legacy_update = 9 | foreign "Hacl_Hash_Core_MD5_legacy_update" 10 | ((ptr uint32_t) @-> (ocaml_bytes @-> (returning void))) 11 | let hacl_Hash_Core_MD5_legacy_finish = 12 | foreign "Hacl_Hash_Core_MD5_legacy_finish" 13 | ((ptr uint32_t) @-> (ocaml_bytes @-> (returning void))) 14 | let hacl_Hash_MD5_legacy_update_multi = 15 | foreign "Hacl_Hash_MD5_legacy_update_multi" 16 | ((ptr uint32_t) @-> (ocaml_bytes @-> (uint32_t @-> (returning void)))) 17 | let hacl_Hash_MD5_legacy_update_last = 18 | foreign "Hacl_Hash_MD5_legacy_update_last" 19 | ((ptr uint32_t) @-> 20 | (uint64_t @-> (ocaml_bytes @-> (uint32_t @-> (returning void))))) 21 | let hacl_Hash_MD5_legacy_hash = 22 | foreign "Hacl_Hash_MD5_legacy_hash" 23 | (ocaml_bytes @-> (uint32_t @-> (ocaml_bytes @-> (returning void)))) 24 | end -------------------------------------------------------------------------------- /raw/lib/Hacl_Hash_SHA1_bindings.ml: -------------------------------------------------------------------------------- 1 | open Ctypes 2 | module Bindings(F:Cstubs.FOREIGN) = 3 | struct 4 | open F 5 | let hacl_Hash_Core_SHA1_legacy_init = 6 | foreign "Hacl_Hash_Core_SHA1_legacy_init" 7 | ((ptr uint32_t) @-> (returning void)) 8 | let hacl_Hash_Core_SHA1_legacy_update = 9 | foreign "Hacl_Hash_Core_SHA1_legacy_update" 10 | ((ptr uint32_t) @-> (ocaml_bytes @-> (returning void))) 11 | let hacl_Hash_Core_SHA1_legacy_finish = 12 | foreign "Hacl_Hash_Core_SHA1_legacy_finish" 13 | ((ptr uint32_t) @-> (ocaml_bytes @-> (returning void))) 14 | let hacl_Hash_SHA1_legacy_update_multi = 15 | foreign "Hacl_Hash_SHA1_legacy_update_multi" 16 | ((ptr uint32_t) @-> (ocaml_bytes @-> (uint32_t @-> (returning void)))) 17 | let hacl_Hash_SHA1_legacy_update_last = 18 | foreign "Hacl_Hash_SHA1_legacy_update_last" 19 | ((ptr uint32_t) @-> 20 | (uint64_t @-> (ocaml_bytes @-> (uint32_t @-> (returning void))))) 21 | let hacl_Hash_SHA1_legacy_hash = 22 | foreign "Hacl_Hash_SHA1_legacy_hash" 23 | (ocaml_bytes @-> (uint32_t @-> (ocaml_bytes @-> (returning void)))) 24 | end -------------------------------------------------------------------------------- /kremlin/include/kremlib.h: -------------------------------------------------------------------------------- 1 | #ifndef __KREMLIB_H 2 | #define __KREMLIB_H 3 | 4 | /******************************************************************************/ 5 | /* The all-in-one kremlib.h header */ 6 | /******************************************************************************/ 7 | 8 | /* This is a meta-header that is included by default in KreMLin generated 9 | * programs. If you wish to have a more lightweight set of headers, or are 10 | * targeting an environment where controlling these macros yourself is 11 | * important, consider using: 12 | * 13 | * krml -minimal 14 | * 15 | * to disable the inclusion of this file (note: this also disables the default 16 | * argument "-bundle FStar.*"). You can then include the headers of your choice 17 | * one by one, using -add-early-include. */ 18 | 19 | #include "kremlin/internal/target.h" 20 | #include "kremlin/internal/callconv.h" 21 | #include "kremlin/internal/builtin.h" 22 | #include "kremlin/internal/debug.h" 23 | #include "kremlin/internal/types.h" 24 | 25 | #include "kremlin/lowstar_endianness.h" 26 | #include "kremlin/fstar_int.h" 27 | 28 | #endif /* __KREMLIB_H */ 29 | -------------------------------------------------------------------------------- /tests/config_test.ml: -------------------------------------------------------------------------------- 1 | open AutoConfig2 2 | 3 | open Test_utils 4 | 5 | let test_random_noalloc () = 6 | let test_result = test_result "Hacl.RandomBuffer.randombytes_noalloc" in 7 | let buf = Test_utils.init_bytes 256 in 8 | if Hacl.RandomBuffer.Noalloc.randombytes ~out:buf then 9 | test_result Success "" 10 | else 11 | test_result Failure "" 12 | 13 | let test_random () = 14 | let test_result = test_result "Hacl.RandomBuffer.randombytes" in 15 | if Option.is_some (Hacl.RandomBuffer.randombytes ~size:128) then 16 | test_result Success "" 17 | else 18 | test_result Failure "" 19 | 20 | let _ = 21 | Printf.printf "SHAEXT: %b\n" (has_feature SHAEXT); 22 | Printf.printf "AES_NI: %b\n" (has_feature AES_NI); 23 | Printf.printf "PCLMULQDQ: %b\n" (has_feature PCLMULQDQ); 24 | Printf.printf "VEC256: %b\n" (has_feature VEC256); 25 | Printf.printf "VEC128: %b\n" (has_feature VEC128); 26 | Printf.printf "BMI2: %b\n" (has_feature BMI2); 27 | Printf.printf "ADX: %b\n" (has_feature ADX); 28 | Printf.printf "SSE: %b\n" (has_feature SSE); 29 | Printf.printf "MOVBE: %b\n" (has_feature MOVBE); 30 | Printf.printf "RDRAND: %b\n" (has_feature RDRAND); 31 | 32 | test_random_noalloc (); 33 | test_random () 34 | -------------------------------------------------------------------------------- /tests/drbg_test.ml: -------------------------------------------------------------------------------- 1 | open Test_utils 2 | open SharedDefs.HashDefs 3 | 4 | let test name alg = 5 | let test_result = test_result ("EverCrypt.DRBG with " ^ name) in 6 | assert (EverCrypt.DRBG.is_supported_alg alg); 7 | match EverCrypt.DRBG.instantiate alg ~personalization_string:(init_bytes 128) with 8 | | Some st -> 9 | (* reseeding is optional, it is included here for testing purposes *) 10 | if EverCrypt.DRBG.reseed st ~additional_input:(init_bytes 128) then 11 | let output1 = init_bytes 1024 in 12 | let output2 = init_bytes 1024 in 13 | if EverCrypt.DRBG.Noalloc.generate st output1 ~additional_input:(init_bytes 128) && 14 | EverCrypt.DRBG.Noalloc.generate st output2 then 15 | assert (output1 <> output2) 16 | else 17 | test_result Failure "Generation failure (noalloc)" 18 | else 19 | test_result Failure "Reseed failure"; 20 | (match EverCrypt.DRBG.generate st 512 with 21 | | Some output -> 22 | assert (Bytes.length output = 512) 23 | | None -> 24 | test_result Failure "Generation failure"); 25 | test_result Success "" 26 | | None -> test_result Failure "Initialization failure" 27 | 28 | let _ = 29 | test "SHA2_256" SHA2_256; 30 | test "SHA2_384" SHA2_384; 31 | test "SHA2_512" SHA2_512 32 | -------------------------------------------------------------------------------- /hacl-star-raw.opam: -------------------------------------------------------------------------------- 1 | opam-version: "2.0" 2 | name: "hacl-star-raw" 3 | version: "0.4.5" 4 | synopsis: "Auto-generated low-level OCaml bindings for EverCrypt/HACL*" 5 | description: """ 6 | This package contains a snapshot of the EverCrypt crypto provider and 7 | the HACL* library, along with automatically generated Ctypes bindings. 8 | For a higher-level idiomatic API see the `hacl-star` package, of 9 | which `hacl-star-raw` is a dependency. 10 | """ 11 | maintainer: "Victor Dumitrescu " 12 | authors: [ "Project Everest" ] 13 | license: "Apache-2.0" 14 | homepage: "https://hacl-star.github.io/" 15 | bug-reports: "https://github.com/project-everest/hacl-star/issues" 16 | depends: [ 17 | "dune" { >= "2.6" } 18 | "ocaml" { >= "4.08.0" } 19 | "ocamlfind" {build} 20 | "ctypes" { >= "0.18.0" } 21 | "conf-which" {build} 22 | ] 23 | available: [ 24 | arch != "ppc64" & arch != "ppc32" & 25 | (os = "freebsd" | os-family != "bsd") 26 | ] 27 | x-ci-accept-failures: [ 28 | "centos-7" # Default C compiler is too old 29 | "oraclelinux-7" # Default C compiler is too old 30 | ] 31 | build: [ 32 | ["sh" "-exc" "cd raw && ./configure"] 33 | [make "-C" "raw"] 34 | ] 35 | install: [ 36 | make "-C" "raw" "install-hacl-star-raw" 37 | ] 38 | dev-repo: "git+https://github.com/project-everest/hacl-star.git" 39 | -------------------------------------------------------------------------------- /raw/Vale.c: -------------------------------------------------------------------------------- 1 | /* MIT License 2 | * 3 | * Copyright (c) 2016-2020 INRIA, CMU and Microsoft Corporation 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | */ 23 | 24 | 25 | #include "internal/Vale.h" 26 | 27 | 28 | 29 | typedef uint64_t als_ret; 30 | 31 | -------------------------------------------------------------------------------- /raw/lib/Hacl_Chacha20_bindings.ml: -------------------------------------------------------------------------------- 1 | open Ctypes 2 | module Bindings(F:Cstubs.FOREIGN) = 3 | struct 4 | open F 5 | let hacl_Impl_Chacha20_chacha20_init = 6 | foreign "Hacl_Impl_Chacha20_chacha20_init" 7 | ((ptr uint32_t) @-> 8 | (ocaml_bytes @-> (ocaml_bytes @-> (uint32_t @-> (returning void))))) 9 | let hacl_Impl_Chacha20_chacha20_encrypt_block = 10 | foreign "Hacl_Impl_Chacha20_chacha20_encrypt_block" 11 | ((ptr uint32_t) @-> 12 | (ocaml_bytes @-> (uint32_t @-> (ocaml_bytes @-> (returning void))))) 13 | let hacl_Impl_Chacha20_chacha20_update = 14 | foreign "Hacl_Impl_Chacha20_chacha20_update" 15 | ((ptr uint32_t) @-> 16 | (uint32_t @-> (ocaml_bytes @-> (ocaml_bytes @-> (returning void))))) 17 | let hacl_Chacha20_chacha20_encrypt = 18 | foreign "Hacl_Chacha20_chacha20_encrypt" 19 | (uint32_t @-> 20 | (ocaml_bytes @-> 21 | (ocaml_bytes @-> 22 | (ocaml_bytes @-> 23 | (ocaml_bytes @-> (uint32_t @-> (returning void))))))) 24 | let hacl_Chacha20_chacha20_decrypt = 25 | foreign "Hacl_Chacha20_chacha20_decrypt" 26 | (uint32_t @-> 27 | (ocaml_bytes @-> 28 | (ocaml_bytes @-> 29 | (ocaml_bytes @-> 30 | (ocaml_bytes @-> (uint32_t @-> (returning void))))))) 31 | end -------------------------------------------------------------------------------- /kremlin/include/kremlin/internal/compat.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) INRIA and Microsoft Corporation. All rights reserved. 2 | Licensed under the Apache 2.0 License. */ 3 | 4 | #ifndef KRML_COMPAT_H 5 | #define KRML_COMPAT_H 6 | 7 | #include 8 | 9 | /* A series of macros that define C implementations of types that are not Low*, 10 | * to facilitate porting programs to Low*. */ 11 | 12 | typedef struct { 13 | uint32_t length; 14 | const char *data; 15 | } FStar_Bytes_bytes; 16 | 17 | typedef int32_t Prims_pos, Prims_nat, Prims_nonzero, Prims_int, 18 | krml_checked_int_t; 19 | 20 | #define RETURN_OR(x) \ 21 | do { \ 22 | int64_t __ret = x; \ 23 | if (__ret < INT32_MIN || INT32_MAX < __ret) { \ 24 | KRML_HOST_PRINTF( \ 25 | "Prims.{int,nat,pos} integer overflow at %s:%d\n", __FILE__, \ 26 | __LINE__); \ 27 | KRML_HOST_EXIT(252); \ 28 | } \ 29 | return (int32_t)__ret; \ 30 | } while (0) 31 | 32 | #endif 33 | -------------------------------------------------------------------------------- /raw/Hacl_Frodo_KEM.c: -------------------------------------------------------------------------------- 1 | /* MIT License 2 | * 3 | * Copyright (c) 2016-2020 INRIA, CMU and Microsoft Corporation 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | */ 23 | 24 | 25 | #include "internal/Hacl_Frodo_KEM.h" 26 | 27 | #include "internal/Hacl_Kremlib.h" 28 | 29 | void randombytes_(uint32_t len, uint8_t *res) 30 | { 31 | bool b = Lib_RandomBuffer_System_randombytes(res, len); 32 | } 33 | 34 | -------------------------------------------------------------------------------- /raw/lib/Hacl_Streaming_MD5_bindings.ml: -------------------------------------------------------------------------------- 1 | open Ctypes 2 | module Bindings(F:Cstubs.FOREIGN) = 3 | struct 4 | open F 5 | module Hacl_Streaming_SHA2_applied = 6 | (Hacl_Streaming_SHA2_bindings.Bindings)(Hacl_Streaming_SHA2_stubs) 7 | open Hacl_Streaming_SHA2_applied 8 | type hacl_Streaming_MD5_state_md5 = hacl_Streaming_SHA2_state_sha2_224 9 | let hacl_Streaming_MD5_state_md5 = 10 | typedef hacl_Streaming_SHA2_state_sha2_224 11 | "Hacl_Streaming_MD5_state_md5" 12 | let hacl_Streaming_MD5_legacy_create_in_md5 = 13 | foreign "Hacl_Streaming_MD5_legacy_create_in_md5" 14 | (void @-> (returning (ptr hacl_Streaming_SHA2_state_sha2_224))) 15 | let hacl_Streaming_MD5_legacy_init_md5 = 16 | foreign "Hacl_Streaming_MD5_legacy_init_md5" 17 | ((ptr hacl_Streaming_SHA2_state_sha2_224) @-> (returning void)) 18 | let hacl_Streaming_MD5_legacy_update_md5 = 19 | foreign "Hacl_Streaming_MD5_legacy_update_md5" 20 | ((ptr hacl_Streaming_SHA2_state_sha2_224) @-> 21 | (ocaml_bytes @-> (uint32_t @-> (returning void)))) 22 | let hacl_Streaming_MD5_legacy_finish_md5 = 23 | foreign "Hacl_Streaming_MD5_legacy_finish_md5" 24 | ((ptr hacl_Streaming_SHA2_state_sha2_224) @-> 25 | (ocaml_bytes @-> (returning void))) 26 | let hacl_Streaming_MD5_legacy_free_md5 = 27 | foreign "Hacl_Streaming_MD5_legacy_free_md5" 28 | ((ptr hacl_Streaming_SHA2_state_sha2_224) @-> (returning void)) 29 | end -------------------------------------------------------------------------------- /raw/lib/Hacl_Streaming_SHA1_bindings.ml: -------------------------------------------------------------------------------- 1 | open Ctypes 2 | module Bindings(F:Cstubs.FOREIGN) = 3 | struct 4 | open F 5 | module Hacl_Streaming_SHA2_applied = 6 | (Hacl_Streaming_SHA2_bindings.Bindings)(Hacl_Streaming_SHA2_stubs) 7 | open Hacl_Streaming_SHA2_applied 8 | type hacl_Streaming_SHA1_state_sha1 = hacl_Streaming_SHA2_state_sha2_224 9 | let hacl_Streaming_SHA1_state_sha1 = 10 | typedef hacl_Streaming_SHA2_state_sha2_224 11 | "Hacl_Streaming_SHA1_state_sha1" 12 | let hacl_Streaming_SHA1_legacy_create_in_sha1 = 13 | foreign "Hacl_Streaming_SHA1_legacy_create_in_sha1" 14 | (void @-> (returning (ptr hacl_Streaming_SHA2_state_sha2_224))) 15 | let hacl_Streaming_SHA1_legacy_init_sha1 = 16 | foreign "Hacl_Streaming_SHA1_legacy_init_sha1" 17 | ((ptr hacl_Streaming_SHA2_state_sha2_224) @-> (returning void)) 18 | let hacl_Streaming_SHA1_legacy_update_sha1 = 19 | foreign "Hacl_Streaming_SHA1_legacy_update_sha1" 20 | ((ptr hacl_Streaming_SHA2_state_sha2_224) @-> 21 | (ocaml_bytes @-> (uint32_t @-> (returning void)))) 22 | let hacl_Streaming_SHA1_legacy_finish_sha1 = 23 | foreign "Hacl_Streaming_SHA1_legacy_finish_sha1" 24 | ((ptr hacl_Streaming_SHA2_state_sha2_224) @-> 25 | (ocaml_bytes @-> (returning void))) 26 | let hacl_Streaming_SHA1_legacy_free_sha1 = 27 | foreign "Hacl_Streaming_SHA1_legacy_free_sha1" 28 | ((ptr hacl_Streaming_SHA2_state_sha2_224) @-> (returning void)) 29 | end -------------------------------------------------------------------------------- /raw/lib/Hacl_HMAC_bindings.ml: -------------------------------------------------------------------------------- 1 | open Ctypes 2 | module Bindings(F:Cstubs.FOREIGN) = 3 | struct 4 | open F 5 | let hacl_HMAC_legacy_compute_sha1 = 6 | foreign "Hacl_HMAC_legacy_compute_sha1" 7 | (ocaml_bytes @-> 8 | (ocaml_bytes @-> 9 | (uint32_t @-> (ocaml_bytes @-> (uint32_t @-> (returning void)))))) 10 | let hacl_HMAC_compute_sha2_256 = 11 | foreign "Hacl_HMAC_compute_sha2_256" 12 | (ocaml_bytes @-> 13 | (ocaml_bytes @-> 14 | (uint32_t @-> (ocaml_bytes @-> (uint32_t @-> (returning void)))))) 15 | let hacl_HMAC_compute_sha2_384 = 16 | foreign "Hacl_HMAC_compute_sha2_384" 17 | (ocaml_bytes @-> 18 | (ocaml_bytes @-> 19 | (uint32_t @-> (ocaml_bytes @-> (uint32_t @-> (returning void)))))) 20 | let hacl_HMAC_compute_sha2_512 = 21 | foreign "Hacl_HMAC_compute_sha2_512" 22 | (ocaml_bytes @-> 23 | (ocaml_bytes @-> 24 | (uint32_t @-> (ocaml_bytes @-> (uint32_t @-> (returning void)))))) 25 | let hacl_HMAC_compute_blake2s_32 = 26 | foreign "Hacl_HMAC_compute_blake2s_32" 27 | (ocaml_bytes @-> 28 | (ocaml_bytes @-> 29 | (uint32_t @-> (ocaml_bytes @-> (uint32_t @-> (returning void)))))) 30 | let hacl_HMAC_compute_blake2b_32 = 31 | foreign "Hacl_HMAC_compute_blake2b_32" 32 | (ocaml_bytes @-> 33 | (ocaml_bytes @-> 34 | (uint32_t @-> (ocaml_bytes @-> (uint32_t @-> (returning void)))))) 35 | end -------------------------------------------------------------------------------- /raw/lib/Hacl_FFDHE_bindings.ml: -------------------------------------------------------------------------------- 1 | open Ctypes 2 | module Bindings(F:Cstubs.FOREIGN) = 3 | struct 4 | open F 5 | module Hacl_Spec_applied = (Hacl_Spec_bindings.Bindings)(Hacl_Spec_stubs) 6 | open Hacl_Spec_applied 7 | let hacl_FFDHE_ffdhe_len = 8 | foreign "Hacl_FFDHE_ffdhe_len" 9 | (spec_FFDHE_ffdhe_alg @-> (returning uint32_t)) 10 | let hacl_FFDHE_new_ffdhe_precomp_p = 11 | foreign "Hacl_FFDHE_new_ffdhe_precomp_p" 12 | (spec_FFDHE_ffdhe_alg @-> (returning (ptr uint64_t))) 13 | let hacl_FFDHE_ffdhe_secret_to_public_precomp = 14 | foreign "Hacl_FFDHE_ffdhe_secret_to_public_precomp" 15 | (spec_FFDHE_ffdhe_alg @-> 16 | ((ptr uint64_t) @-> 17 | (ocaml_bytes @-> (ocaml_bytes @-> (returning void))))) 18 | let hacl_FFDHE_ffdhe_secret_to_public = 19 | foreign "Hacl_FFDHE_ffdhe_secret_to_public" 20 | (spec_FFDHE_ffdhe_alg @-> 21 | (ocaml_bytes @-> (ocaml_bytes @-> (returning void)))) 22 | let hacl_FFDHE_ffdhe_shared_secret_precomp = 23 | foreign "Hacl_FFDHE_ffdhe_shared_secret_precomp" 24 | (spec_FFDHE_ffdhe_alg @-> 25 | ((ptr uint64_t) @-> 26 | (ocaml_bytes @-> 27 | (ocaml_bytes @-> (ocaml_bytes @-> (returning uint64_t)))))) 28 | let hacl_FFDHE_ffdhe_shared_secret = 29 | foreign "Hacl_FFDHE_ffdhe_shared_secret" 30 | (spec_FFDHE_ffdhe_alg @-> 31 | (ocaml_bytes @-> 32 | (ocaml_bytes @-> (ocaml_bytes @-> (returning uint64_t))))) 33 | end -------------------------------------------------------------------------------- /raw/EverCrypt_StaticConfig.c: -------------------------------------------------------------------------------- 1 | /* MIT License 2 | * 3 | * Copyright (c) 2016-2020 INRIA, CMU and Microsoft Corporation 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | */ 23 | 24 | 25 | #include "EverCrypt_StaticConfig.h" 26 | 27 | 28 | 29 | bool EverCrypt_StaticConfig_hacl = true; 30 | 31 | bool EverCrypt_StaticConfig_vale = true; 32 | 33 | bool EverCrypt_StaticConfig_openssl = true; 34 | 35 | bool EverCrypt_StaticConfig_bcrypt = false; 36 | 37 | -------------------------------------------------------------------------------- /raw/Lib_PrintBuffer.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | void Lib_PrintBuffer_print_bytes(uint32_t len, uint8_t* buffer) { 7 | uint32_t i; 8 | for (i = 0; i < len; i++){ 9 | printf("%02x ", buffer[i]); 10 | } 11 | printf("\n"); 12 | } 13 | 14 | void Lib_PrintBuffer_print_compare(uint32_t len, uint8_t* buffer1, uint8_t* buffer2) { 15 | uint32_t i; 16 | for (i = 0; i < len; i++){ 17 | printf("%02x ", buffer1[i]); 18 | } 19 | printf("\n"); 20 | for (i = 0; i < len; i++){ 21 | printf("%02x ", buffer2[i]); 22 | } 23 | printf("\n"); 24 | } 25 | 26 | void Lib_PrintBuffer_print_compare_display(uint32_t len, const uint8_t* buffer1, const uint8_t* buffer2) { 27 | uint8_t res = 0; 28 | uint32_t i; 29 | Lib_PrintBuffer_print_compare(len, (uint8_t*)buffer1, (uint8_t*)buffer2); 30 | for (i = 0; i < len; i++) { 31 | res |= buffer1[i] ^ buffer2[i]; 32 | } 33 | if (res == 0) { 34 | printf("Success !\n"); 35 | } else { 36 | printf("Failure !\n"); 37 | } 38 | printf("\n"); 39 | } 40 | 41 | bool Lib_PrintBuffer_result_compare_display(uint32_t len, const uint8_t* buffer1, const uint8_t* buffer2) { 42 | uint8_t res = 0; 43 | uint32_t i; 44 | Lib_PrintBuffer_print_compare(len, (uint8_t*)buffer1, (uint8_t*)buffer2); 45 | for (i = 0; i < len; i++) { 46 | res |= buffer1[i] ^ buffer2[i]; 47 | } 48 | if (res == 0) { 49 | printf("Success !\n\n"); 50 | return true; 51 | } else { 52 | printf("Failure !\n\n"); 53 | return false; 54 | } 55 | } 56 | 57 | -------------------------------------------------------------------------------- /raw/lib/Hacl_HPKE_P256_CP32_SHA256_bindings.ml: -------------------------------------------------------------------------------- 1 | open Ctypes 2 | module Bindings(F:Cstubs.FOREIGN) = 3 | struct 4 | open F 5 | let hacl_HPKE_P256_CP32_SHA256_setupBaseI = 6 | foreign "Hacl_HPKE_P256_CP32_SHA256_setupBaseI" 7 | (ocaml_bytes @-> 8 | (ocaml_bytes @-> 9 | (ocaml_bytes @-> 10 | (ocaml_bytes @-> 11 | (ocaml_bytes @-> 12 | (uint32_t @-> (ocaml_bytes @-> (returning uint32_t)))))))) 13 | let hacl_HPKE_P256_CP32_SHA256_setupBaseR = 14 | foreign "Hacl_HPKE_P256_CP32_SHA256_setupBaseR" 15 | (ocaml_bytes @-> 16 | (ocaml_bytes @-> 17 | (ocaml_bytes @-> 18 | (ocaml_bytes @-> 19 | (uint32_t @-> (ocaml_bytes @-> (returning uint32_t))))))) 20 | let hacl_HPKE_P256_CP32_SHA256_sealBase = 21 | foreign "Hacl_HPKE_P256_CP32_SHA256_sealBase" 22 | (ocaml_bytes @-> 23 | (ocaml_bytes @-> 24 | (uint32_t @-> 25 | (ocaml_bytes @-> 26 | (uint32_t @-> 27 | (ocaml_bytes @-> 28 | (ocaml_bytes @-> (returning uint32_t)))))))) 29 | let hacl_HPKE_P256_CP32_SHA256_openBase = 30 | foreign "Hacl_HPKE_P256_CP32_SHA256_openBase" 31 | (ocaml_bytes @-> 32 | (ocaml_bytes @-> 33 | (uint32_t @-> 34 | (ocaml_bytes @-> 35 | (uint32_t @-> 36 | (ocaml_bytes @-> 37 | (ocaml_bytes @-> (returning uint32_t)))))))) 38 | end -------------------------------------------------------------------------------- /raw/lib/Hacl_HPKE_P256_CP128_SHA256_bindings.ml: -------------------------------------------------------------------------------- 1 | open Ctypes 2 | module Bindings(F:Cstubs.FOREIGN) = 3 | struct 4 | open F 5 | let hacl_HPKE_P256_CP128_SHA256_setupBaseI = 6 | foreign "Hacl_HPKE_P256_CP128_SHA256_setupBaseI" 7 | (ocaml_bytes @-> 8 | (ocaml_bytes @-> 9 | (ocaml_bytes @-> 10 | (ocaml_bytes @-> 11 | (ocaml_bytes @-> 12 | (uint32_t @-> (ocaml_bytes @-> (returning uint32_t)))))))) 13 | let hacl_HPKE_P256_CP128_SHA256_setupBaseR = 14 | foreign "Hacl_HPKE_P256_CP128_SHA256_setupBaseR" 15 | (ocaml_bytes @-> 16 | (ocaml_bytes @-> 17 | (ocaml_bytes @-> 18 | (ocaml_bytes @-> 19 | (uint32_t @-> (ocaml_bytes @-> (returning uint32_t))))))) 20 | let hacl_HPKE_P256_CP128_SHA256_sealBase = 21 | foreign "Hacl_HPKE_P256_CP128_SHA256_sealBase" 22 | (ocaml_bytes @-> 23 | (ocaml_bytes @-> 24 | (uint32_t @-> 25 | (ocaml_bytes @-> 26 | (uint32_t @-> 27 | (ocaml_bytes @-> 28 | (ocaml_bytes @-> (returning uint32_t)))))))) 29 | let hacl_HPKE_P256_CP128_SHA256_openBase = 30 | foreign "Hacl_HPKE_P256_CP128_SHA256_openBase" 31 | (ocaml_bytes @-> 32 | (ocaml_bytes @-> 33 | (uint32_t @-> 34 | (ocaml_bytes @-> 35 | (uint32_t @-> 36 | (ocaml_bytes @-> 37 | (ocaml_bytes @-> (returning uint32_t)))))))) 38 | end -------------------------------------------------------------------------------- /raw/lib/Hacl_HPKE_P256_CP256_SHA256_bindings.ml: -------------------------------------------------------------------------------- 1 | open Ctypes 2 | module Bindings(F:Cstubs.FOREIGN) = 3 | struct 4 | open F 5 | let hacl_HPKE_P256_CP256_SHA256_setupBaseI = 6 | foreign "Hacl_HPKE_P256_CP256_SHA256_setupBaseI" 7 | (ocaml_bytes @-> 8 | (ocaml_bytes @-> 9 | (ocaml_bytes @-> 10 | (ocaml_bytes @-> 11 | (ocaml_bytes @-> 12 | (uint32_t @-> (ocaml_bytes @-> (returning uint32_t)))))))) 13 | let hacl_HPKE_P256_CP256_SHA256_setupBaseR = 14 | foreign "Hacl_HPKE_P256_CP256_SHA256_setupBaseR" 15 | (ocaml_bytes @-> 16 | (ocaml_bytes @-> 17 | (ocaml_bytes @-> 18 | (ocaml_bytes @-> 19 | (uint32_t @-> (ocaml_bytes @-> (returning uint32_t))))))) 20 | let hacl_HPKE_P256_CP256_SHA256_sealBase = 21 | foreign "Hacl_HPKE_P256_CP256_SHA256_sealBase" 22 | (ocaml_bytes @-> 23 | (ocaml_bytes @-> 24 | (uint32_t @-> 25 | (ocaml_bytes @-> 26 | (uint32_t @-> 27 | (ocaml_bytes @-> 28 | (ocaml_bytes @-> (returning uint32_t)))))))) 29 | let hacl_HPKE_P256_CP256_SHA256_openBase = 30 | foreign "Hacl_HPKE_P256_CP256_SHA256_openBase" 31 | (ocaml_bytes @-> 32 | (ocaml_bytes @-> 33 | (uint32_t @-> 34 | (ocaml_bytes @-> 35 | (uint32_t @-> 36 | (ocaml_bytes @-> 37 | (ocaml_bytes @-> (returning uint32_t)))))))) 38 | end -------------------------------------------------------------------------------- /raw/lib/Hacl_HPKE_Curve51_CP32_SHA256_bindings.ml: -------------------------------------------------------------------------------- 1 | open Ctypes 2 | module Bindings(F:Cstubs.FOREIGN) = 3 | struct 4 | open F 5 | let hacl_HPKE_Curve51_CP32_SHA256_setupBaseI = 6 | foreign "Hacl_HPKE_Curve51_CP32_SHA256_setupBaseI" 7 | (ocaml_bytes @-> 8 | (ocaml_bytes @-> 9 | (ocaml_bytes @-> 10 | (ocaml_bytes @-> 11 | (ocaml_bytes @-> 12 | (uint32_t @-> (ocaml_bytes @-> (returning uint32_t)))))))) 13 | let hacl_HPKE_Curve51_CP32_SHA256_setupBaseR = 14 | foreign "Hacl_HPKE_Curve51_CP32_SHA256_setupBaseR" 15 | (ocaml_bytes @-> 16 | (ocaml_bytes @-> 17 | (ocaml_bytes @-> 18 | (ocaml_bytes @-> 19 | (uint32_t @-> (ocaml_bytes @-> (returning uint32_t))))))) 20 | let hacl_HPKE_Curve51_CP32_SHA256_sealBase = 21 | foreign "Hacl_HPKE_Curve51_CP32_SHA256_sealBase" 22 | (ocaml_bytes @-> 23 | (ocaml_bytes @-> 24 | (uint32_t @-> 25 | (ocaml_bytes @-> 26 | (uint32_t @-> 27 | (ocaml_bytes @-> 28 | (ocaml_bytes @-> (returning uint32_t)))))))) 29 | let hacl_HPKE_Curve51_CP32_SHA256_openBase = 30 | foreign "Hacl_HPKE_Curve51_CP32_SHA256_openBase" 31 | (ocaml_bytes @-> 32 | (ocaml_bytes @-> 33 | (uint32_t @-> 34 | (ocaml_bytes @-> 35 | (uint32_t @-> 36 | (ocaml_bytes @-> 37 | (ocaml_bytes @-> (returning uint32_t)))))))) 38 | end -------------------------------------------------------------------------------- /raw/lib/Hacl_HPKE_Curve51_CP32_SHA512_bindings.ml: -------------------------------------------------------------------------------- 1 | open Ctypes 2 | module Bindings(F:Cstubs.FOREIGN) = 3 | struct 4 | open F 5 | let hacl_HPKE_Curve51_CP32_SHA512_setupBaseI = 6 | foreign "Hacl_HPKE_Curve51_CP32_SHA512_setupBaseI" 7 | (ocaml_bytes @-> 8 | (ocaml_bytes @-> 9 | (ocaml_bytes @-> 10 | (ocaml_bytes @-> 11 | (ocaml_bytes @-> 12 | (uint32_t @-> (ocaml_bytes @-> (returning uint32_t)))))))) 13 | let hacl_HPKE_Curve51_CP32_SHA512_setupBaseR = 14 | foreign "Hacl_HPKE_Curve51_CP32_SHA512_setupBaseR" 15 | (ocaml_bytes @-> 16 | (ocaml_bytes @-> 17 | (ocaml_bytes @-> 18 | (ocaml_bytes @-> 19 | (uint32_t @-> (ocaml_bytes @-> (returning uint32_t))))))) 20 | let hacl_HPKE_Curve51_CP32_SHA512_sealBase = 21 | foreign "Hacl_HPKE_Curve51_CP32_SHA512_sealBase" 22 | (ocaml_bytes @-> 23 | (ocaml_bytes @-> 24 | (uint32_t @-> 25 | (ocaml_bytes @-> 26 | (uint32_t @-> 27 | (ocaml_bytes @-> 28 | (ocaml_bytes @-> (returning uint32_t)))))))) 29 | let hacl_HPKE_Curve51_CP32_SHA512_openBase = 30 | foreign "Hacl_HPKE_Curve51_CP32_SHA512_openBase" 31 | (ocaml_bytes @-> 32 | (ocaml_bytes @-> 33 | (uint32_t @-> 34 | (ocaml_bytes @-> 35 | (uint32_t @-> 36 | (ocaml_bytes @-> 37 | (ocaml_bytes @-> (returning uint32_t)))))))) 38 | end -------------------------------------------------------------------------------- /raw/lib/Hacl_HPKE_Curve64_CP32_SHA256_bindings.ml: -------------------------------------------------------------------------------- 1 | open Ctypes 2 | module Bindings(F:Cstubs.FOREIGN) = 3 | struct 4 | open F 5 | let hacl_HPKE_Curve64_CP32_SHA256_setupBaseI = 6 | foreign "Hacl_HPKE_Curve64_CP32_SHA256_setupBaseI" 7 | (ocaml_bytes @-> 8 | (ocaml_bytes @-> 9 | (ocaml_bytes @-> 10 | (ocaml_bytes @-> 11 | (ocaml_bytes @-> 12 | (uint32_t @-> (ocaml_bytes @-> (returning uint32_t)))))))) 13 | let hacl_HPKE_Curve64_CP32_SHA256_setupBaseR = 14 | foreign "Hacl_HPKE_Curve64_CP32_SHA256_setupBaseR" 15 | (ocaml_bytes @-> 16 | (ocaml_bytes @-> 17 | (ocaml_bytes @-> 18 | (ocaml_bytes @-> 19 | (uint32_t @-> (ocaml_bytes @-> (returning uint32_t))))))) 20 | let hacl_HPKE_Curve64_CP32_SHA256_sealBase = 21 | foreign "Hacl_HPKE_Curve64_CP32_SHA256_sealBase" 22 | (ocaml_bytes @-> 23 | (ocaml_bytes @-> 24 | (uint32_t @-> 25 | (ocaml_bytes @-> 26 | (uint32_t @-> 27 | (ocaml_bytes @-> 28 | (ocaml_bytes @-> (returning uint32_t)))))))) 29 | let hacl_HPKE_Curve64_CP32_SHA256_openBase = 30 | foreign "Hacl_HPKE_Curve64_CP32_SHA256_openBase" 31 | (ocaml_bytes @-> 32 | (ocaml_bytes @-> 33 | (uint32_t @-> 34 | (ocaml_bytes @-> 35 | (uint32_t @-> 36 | (ocaml_bytes @-> 37 | (ocaml_bytes @-> (returning uint32_t)))))))) 38 | end -------------------------------------------------------------------------------- /raw/lib/Hacl_HPKE_Curve64_CP32_SHA512_bindings.ml: -------------------------------------------------------------------------------- 1 | open Ctypes 2 | module Bindings(F:Cstubs.FOREIGN) = 3 | struct 4 | open F 5 | let hacl_HPKE_Curve64_CP32_SHA512_setupBaseI = 6 | foreign "Hacl_HPKE_Curve64_CP32_SHA512_setupBaseI" 7 | (ocaml_bytes @-> 8 | (ocaml_bytes @-> 9 | (ocaml_bytes @-> 10 | (ocaml_bytes @-> 11 | (ocaml_bytes @-> 12 | (uint32_t @-> (ocaml_bytes @-> (returning uint32_t)))))))) 13 | let hacl_HPKE_Curve64_CP32_SHA512_setupBaseR = 14 | foreign "Hacl_HPKE_Curve64_CP32_SHA512_setupBaseR" 15 | (ocaml_bytes @-> 16 | (ocaml_bytes @-> 17 | (ocaml_bytes @-> 18 | (ocaml_bytes @-> 19 | (uint32_t @-> (ocaml_bytes @-> (returning uint32_t))))))) 20 | let hacl_HPKE_Curve64_CP32_SHA512_sealBase = 21 | foreign "Hacl_HPKE_Curve64_CP32_SHA512_sealBase" 22 | (ocaml_bytes @-> 23 | (ocaml_bytes @-> 24 | (uint32_t @-> 25 | (ocaml_bytes @-> 26 | (uint32_t @-> 27 | (ocaml_bytes @-> 28 | (ocaml_bytes @-> (returning uint32_t)))))))) 29 | let hacl_HPKE_Curve64_CP32_SHA512_openBase = 30 | foreign "Hacl_HPKE_Curve64_CP32_SHA512_openBase" 31 | (ocaml_bytes @-> 32 | (ocaml_bytes @-> 33 | (uint32_t @-> 34 | (ocaml_bytes @-> 35 | (uint32_t @-> 36 | (ocaml_bytes @-> 37 | (ocaml_bytes @-> (returning uint32_t)))))))) 38 | end -------------------------------------------------------------------------------- /kremlin/include/kremlin/internal/callconv.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) INRIA and Microsoft Corporation. All rights reserved. 2 | Licensed under the Apache 2.0 License. */ 3 | 4 | #ifndef __KREMLIN_CALLCONV_H 5 | #define __KREMLIN_CALLCONV_H 6 | 7 | /******************************************************************************/ 8 | /* Some macros to ease compatibility */ 9 | /******************************************************************************/ 10 | 11 | /* We want to generate __cdecl safely without worrying about it being undefined. 12 | * When using MSVC, these are always defined. When using MinGW, these are 13 | * defined too. They have no meaning for other platforms, so we define them to 14 | * be empty macros in other situations. */ 15 | #ifndef _MSC_VER 16 | #ifndef __cdecl 17 | #define __cdecl 18 | #endif 19 | #ifndef __stdcall 20 | #define __stdcall 21 | #endif 22 | #ifndef __fastcall 23 | #define __fastcall 24 | #endif 25 | #endif 26 | 27 | /* Since KreMLin emits the inline keyword unconditionally, we follow the 28 | * guidelines at https://gcc.gnu.org/onlinedocs/gcc/Inline.html and make this 29 | * __inline__ to ensure the code compiles with -std=c90 and earlier. */ 30 | #ifdef __GNUC__ 31 | # define inline __inline__ 32 | #endif 33 | 34 | /* GCC-specific attribute syntax; everyone else gets the standard C inline 35 | * attribute. */ 36 | #ifdef __GNU_C__ 37 | # ifndef __clang__ 38 | # define force_inline inline __attribute__((always_inline)) 39 | # else 40 | # define force_inline inline 41 | # endif 42 | #else 43 | # define force_inline inline 44 | #endif 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /raw/lib/Hacl_HPKE_Curve51_CP128_SHA256_bindings.ml: -------------------------------------------------------------------------------- 1 | open Ctypes 2 | module Bindings(F:Cstubs.FOREIGN) = 3 | struct 4 | open F 5 | let hacl_HPKE_Curve51_CP128_SHA256_setupBaseI = 6 | foreign "Hacl_HPKE_Curve51_CP128_SHA256_setupBaseI" 7 | (ocaml_bytes @-> 8 | (ocaml_bytes @-> 9 | (ocaml_bytes @-> 10 | (ocaml_bytes @-> 11 | (ocaml_bytes @-> 12 | (uint32_t @-> (ocaml_bytes @-> (returning uint32_t)))))))) 13 | let hacl_HPKE_Curve51_CP128_SHA256_setupBaseR = 14 | foreign "Hacl_HPKE_Curve51_CP128_SHA256_setupBaseR" 15 | (ocaml_bytes @-> 16 | (ocaml_bytes @-> 17 | (ocaml_bytes @-> 18 | (ocaml_bytes @-> 19 | (uint32_t @-> (ocaml_bytes @-> (returning uint32_t))))))) 20 | let hacl_HPKE_Curve51_CP128_SHA256_sealBase = 21 | foreign "Hacl_HPKE_Curve51_CP128_SHA256_sealBase" 22 | (ocaml_bytes @-> 23 | (ocaml_bytes @-> 24 | (uint32_t @-> 25 | (ocaml_bytes @-> 26 | (uint32_t @-> 27 | (ocaml_bytes @-> 28 | (ocaml_bytes @-> (returning uint32_t)))))))) 29 | let hacl_HPKE_Curve51_CP128_SHA256_openBase = 30 | foreign "Hacl_HPKE_Curve51_CP128_SHA256_openBase" 31 | (ocaml_bytes @-> 32 | (ocaml_bytes @-> 33 | (uint32_t @-> 34 | (ocaml_bytes @-> 35 | (uint32_t @-> 36 | (ocaml_bytes @-> 37 | (ocaml_bytes @-> (returning uint32_t)))))))) 38 | end -------------------------------------------------------------------------------- /raw/lib/Hacl_HPKE_Curve51_CP128_SHA512_bindings.ml: -------------------------------------------------------------------------------- 1 | open Ctypes 2 | module Bindings(F:Cstubs.FOREIGN) = 3 | struct 4 | open F 5 | let hacl_HPKE_Curve51_CP128_SHA512_setupBaseI = 6 | foreign "Hacl_HPKE_Curve51_CP128_SHA512_setupBaseI" 7 | (ocaml_bytes @-> 8 | (ocaml_bytes @-> 9 | (ocaml_bytes @-> 10 | (ocaml_bytes @-> 11 | (ocaml_bytes @-> 12 | (uint32_t @-> (ocaml_bytes @-> (returning uint32_t)))))))) 13 | let hacl_HPKE_Curve51_CP128_SHA512_setupBaseR = 14 | foreign "Hacl_HPKE_Curve51_CP128_SHA512_setupBaseR" 15 | (ocaml_bytes @-> 16 | (ocaml_bytes @-> 17 | (ocaml_bytes @-> 18 | (ocaml_bytes @-> 19 | (uint32_t @-> (ocaml_bytes @-> (returning uint32_t))))))) 20 | let hacl_HPKE_Curve51_CP128_SHA512_sealBase = 21 | foreign "Hacl_HPKE_Curve51_CP128_SHA512_sealBase" 22 | (ocaml_bytes @-> 23 | (ocaml_bytes @-> 24 | (uint32_t @-> 25 | (ocaml_bytes @-> 26 | (uint32_t @-> 27 | (ocaml_bytes @-> 28 | (ocaml_bytes @-> (returning uint32_t)))))))) 29 | let hacl_HPKE_Curve51_CP128_SHA512_openBase = 30 | foreign "Hacl_HPKE_Curve51_CP128_SHA512_openBase" 31 | (ocaml_bytes @-> 32 | (ocaml_bytes @-> 33 | (uint32_t @-> 34 | (ocaml_bytes @-> 35 | (uint32_t @-> 36 | (ocaml_bytes @-> 37 | (ocaml_bytes @-> (returning uint32_t)))))))) 38 | end -------------------------------------------------------------------------------- /raw/lib/Hacl_HPKE_Curve51_CP256_SHA256_bindings.ml: -------------------------------------------------------------------------------- 1 | open Ctypes 2 | module Bindings(F:Cstubs.FOREIGN) = 3 | struct 4 | open F 5 | let hacl_HPKE_Curve51_CP256_SHA256_setupBaseI = 6 | foreign "Hacl_HPKE_Curve51_CP256_SHA256_setupBaseI" 7 | (ocaml_bytes @-> 8 | (ocaml_bytes @-> 9 | (ocaml_bytes @-> 10 | (ocaml_bytes @-> 11 | (ocaml_bytes @-> 12 | (uint32_t @-> (ocaml_bytes @-> (returning uint32_t)))))))) 13 | let hacl_HPKE_Curve51_CP256_SHA256_setupBaseR = 14 | foreign "Hacl_HPKE_Curve51_CP256_SHA256_setupBaseR" 15 | (ocaml_bytes @-> 16 | (ocaml_bytes @-> 17 | (ocaml_bytes @-> 18 | (ocaml_bytes @-> 19 | (uint32_t @-> (ocaml_bytes @-> (returning uint32_t))))))) 20 | let hacl_HPKE_Curve51_CP256_SHA256_sealBase = 21 | foreign "Hacl_HPKE_Curve51_CP256_SHA256_sealBase" 22 | (ocaml_bytes @-> 23 | (ocaml_bytes @-> 24 | (uint32_t @-> 25 | (ocaml_bytes @-> 26 | (uint32_t @-> 27 | (ocaml_bytes @-> 28 | (ocaml_bytes @-> (returning uint32_t)))))))) 29 | let hacl_HPKE_Curve51_CP256_SHA256_openBase = 30 | foreign "Hacl_HPKE_Curve51_CP256_SHA256_openBase" 31 | (ocaml_bytes @-> 32 | (ocaml_bytes @-> 33 | (uint32_t @-> 34 | (ocaml_bytes @-> 35 | (uint32_t @-> 36 | (ocaml_bytes @-> 37 | (ocaml_bytes @-> (returning uint32_t)))))))) 38 | end -------------------------------------------------------------------------------- /raw/lib/Hacl_HPKE_Curve51_CP256_SHA512_bindings.ml: -------------------------------------------------------------------------------- 1 | open Ctypes 2 | module Bindings(F:Cstubs.FOREIGN) = 3 | struct 4 | open F 5 | let hacl_HPKE_Curve51_CP256_SHA512_setupBaseI = 6 | foreign "Hacl_HPKE_Curve51_CP256_SHA512_setupBaseI" 7 | (ocaml_bytes @-> 8 | (ocaml_bytes @-> 9 | (ocaml_bytes @-> 10 | (ocaml_bytes @-> 11 | (ocaml_bytes @-> 12 | (uint32_t @-> (ocaml_bytes @-> (returning uint32_t)))))))) 13 | let hacl_HPKE_Curve51_CP256_SHA512_setupBaseR = 14 | foreign "Hacl_HPKE_Curve51_CP256_SHA512_setupBaseR" 15 | (ocaml_bytes @-> 16 | (ocaml_bytes @-> 17 | (ocaml_bytes @-> 18 | (ocaml_bytes @-> 19 | (uint32_t @-> (ocaml_bytes @-> (returning uint32_t))))))) 20 | let hacl_HPKE_Curve51_CP256_SHA512_sealBase = 21 | foreign "Hacl_HPKE_Curve51_CP256_SHA512_sealBase" 22 | (ocaml_bytes @-> 23 | (ocaml_bytes @-> 24 | (uint32_t @-> 25 | (ocaml_bytes @-> 26 | (uint32_t @-> 27 | (ocaml_bytes @-> 28 | (ocaml_bytes @-> (returning uint32_t)))))))) 29 | let hacl_HPKE_Curve51_CP256_SHA512_openBase = 30 | foreign "Hacl_HPKE_Curve51_CP256_SHA512_openBase" 31 | (ocaml_bytes @-> 32 | (ocaml_bytes @-> 33 | (uint32_t @-> 34 | (ocaml_bytes @-> 35 | (uint32_t @-> 36 | (ocaml_bytes @-> 37 | (ocaml_bytes @-> (returning uint32_t)))))))) 38 | end -------------------------------------------------------------------------------- /raw/lib/Hacl_HPKE_Curve64_CP128_SHA256_bindings.ml: -------------------------------------------------------------------------------- 1 | open Ctypes 2 | module Bindings(F:Cstubs.FOREIGN) = 3 | struct 4 | open F 5 | let hacl_HPKE_Curve64_CP128_SHA256_setupBaseI = 6 | foreign "Hacl_HPKE_Curve64_CP128_SHA256_setupBaseI" 7 | (ocaml_bytes @-> 8 | (ocaml_bytes @-> 9 | (ocaml_bytes @-> 10 | (ocaml_bytes @-> 11 | (ocaml_bytes @-> 12 | (uint32_t @-> (ocaml_bytes @-> (returning uint32_t)))))))) 13 | let hacl_HPKE_Curve64_CP128_SHA256_setupBaseR = 14 | foreign "Hacl_HPKE_Curve64_CP128_SHA256_setupBaseR" 15 | (ocaml_bytes @-> 16 | (ocaml_bytes @-> 17 | (ocaml_bytes @-> 18 | (ocaml_bytes @-> 19 | (uint32_t @-> (ocaml_bytes @-> (returning uint32_t))))))) 20 | let hacl_HPKE_Curve64_CP128_SHA256_sealBase = 21 | foreign "Hacl_HPKE_Curve64_CP128_SHA256_sealBase" 22 | (ocaml_bytes @-> 23 | (ocaml_bytes @-> 24 | (uint32_t @-> 25 | (ocaml_bytes @-> 26 | (uint32_t @-> 27 | (ocaml_bytes @-> 28 | (ocaml_bytes @-> (returning uint32_t)))))))) 29 | let hacl_HPKE_Curve64_CP128_SHA256_openBase = 30 | foreign "Hacl_HPKE_Curve64_CP128_SHA256_openBase" 31 | (ocaml_bytes @-> 32 | (ocaml_bytes @-> 33 | (uint32_t @-> 34 | (ocaml_bytes @-> 35 | (uint32_t @-> 36 | (ocaml_bytes @-> 37 | (ocaml_bytes @-> (returning uint32_t)))))))) 38 | end -------------------------------------------------------------------------------- /raw/lib/Hacl_HPKE_Curve64_CP128_SHA512_bindings.ml: -------------------------------------------------------------------------------- 1 | open Ctypes 2 | module Bindings(F:Cstubs.FOREIGN) = 3 | struct 4 | open F 5 | let hacl_HPKE_Curve64_CP128_SHA512_setupBaseI = 6 | foreign "Hacl_HPKE_Curve64_CP128_SHA512_setupBaseI" 7 | (ocaml_bytes @-> 8 | (ocaml_bytes @-> 9 | (ocaml_bytes @-> 10 | (ocaml_bytes @-> 11 | (ocaml_bytes @-> 12 | (uint32_t @-> (ocaml_bytes @-> (returning uint32_t)))))))) 13 | let hacl_HPKE_Curve64_CP128_SHA512_setupBaseR = 14 | foreign "Hacl_HPKE_Curve64_CP128_SHA512_setupBaseR" 15 | (ocaml_bytes @-> 16 | (ocaml_bytes @-> 17 | (ocaml_bytes @-> 18 | (ocaml_bytes @-> 19 | (uint32_t @-> (ocaml_bytes @-> (returning uint32_t))))))) 20 | let hacl_HPKE_Curve64_CP128_SHA512_sealBase = 21 | foreign "Hacl_HPKE_Curve64_CP128_SHA512_sealBase" 22 | (ocaml_bytes @-> 23 | (ocaml_bytes @-> 24 | (uint32_t @-> 25 | (ocaml_bytes @-> 26 | (uint32_t @-> 27 | (ocaml_bytes @-> 28 | (ocaml_bytes @-> (returning uint32_t)))))))) 29 | let hacl_HPKE_Curve64_CP128_SHA512_openBase = 30 | foreign "Hacl_HPKE_Curve64_CP128_SHA512_openBase" 31 | (ocaml_bytes @-> 32 | (ocaml_bytes @-> 33 | (uint32_t @-> 34 | (ocaml_bytes @-> 35 | (uint32_t @-> 36 | (ocaml_bytes @-> 37 | (ocaml_bytes @-> (returning uint32_t)))))))) 38 | end -------------------------------------------------------------------------------- /raw/lib/Hacl_HPKE_Curve64_CP256_SHA256_bindings.ml: -------------------------------------------------------------------------------- 1 | open Ctypes 2 | module Bindings(F:Cstubs.FOREIGN) = 3 | struct 4 | open F 5 | let hacl_HPKE_Curve64_CP256_SHA256_setupBaseI = 6 | foreign "Hacl_HPKE_Curve64_CP256_SHA256_setupBaseI" 7 | (ocaml_bytes @-> 8 | (ocaml_bytes @-> 9 | (ocaml_bytes @-> 10 | (ocaml_bytes @-> 11 | (ocaml_bytes @-> 12 | (uint32_t @-> (ocaml_bytes @-> (returning uint32_t)))))))) 13 | let hacl_HPKE_Curve64_CP256_SHA256_setupBaseR = 14 | foreign "Hacl_HPKE_Curve64_CP256_SHA256_setupBaseR" 15 | (ocaml_bytes @-> 16 | (ocaml_bytes @-> 17 | (ocaml_bytes @-> 18 | (ocaml_bytes @-> 19 | (uint32_t @-> (ocaml_bytes @-> (returning uint32_t))))))) 20 | let hacl_HPKE_Curve64_CP256_SHA256_sealBase = 21 | foreign "Hacl_HPKE_Curve64_CP256_SHA256_sealBase" 22 | (ocaml_bytes @-> 23 | (ocaml_bytes @-> 24 | (uint32_t @-> 25 | (ocaml_bytes @-> 26 | (uint32_t @-> 27 | (ocaml_bytes @-> 28 | (ocaml_bytes @-> (returning uint32_t)))))))) 29 | let hacl_HPKE_Curve64_CP256_SHA256_openBase = 30 | foreign "Hacl_HPKE_Curve64_CP256_SHA256_openBase" 31 | (ocaml_bytes @-> 32 | (ocaml_bytes @-> 33 | (uint32_t @-> 34 | (ocaml_bytes @-> 35 | (uint32_t @-> 36 | (ocaml_bytes @-> 37 | (ocaml_bytes @-> (returning uint32_t)))))))) 38 | end -------------------------------------------------------------------------------- /raw/lib/Hacl_HPKE_Curve64_CP256_SHA512_bindings.ml: -------------------------------------------------------------------------------- 1 | open Ctypes 2 | module Bindings(F:Cstubs.FOREIGN) = 3 | struct 4 | open F 5 | let hacl_HPKE_Curve64_CP256_SHA512_setupBaseI = 6 | foreign "Hacl_HPKE_Curve64_CP256_SHA512_setupBaseI" 7 | (ocaml_bytes @-> 8 | (ocaml_bytes @-> 9 | (ocaml_bytes @-> 10 | (ocaml_bytes @-> 11 | (ocaml_bytes @-> 12 | (uint32_t @-> (ocaml_bytes @-> (returning uint32_t)))))))) 13 | let hacl_HPKE_Curve64_CP256_SHA512_setupBaseR = 14 | foreign "Hacl_HPKE_Curve64_CP256_SHA512_setupBaseR" 15 | (ocaml_bytes @-> 16 | (ocaml_bytes @-> 17 | (ocaml_bytes @-> 18 | (ocaml_bytes @-> 19 | (uint32_t @-> (ocaml_bytes @-> (returning uint32_t))))))) 20 | let hacl_HPKE_Curve64_CP256_SHA512_sealBase = 21 | foreign "Hacl_HPKE_Curve64_CP256_SHA512_sealBase" 22 | (ocaml_bytes @-> 23 | (ocaml_bytes @-> 24 | (uint32_t @-> 25 | (ocaml_bytes @-> 26 | (uint32_t @-> 27 | (ocaml_bytes @-> 28 | (ocaml_bytes @-> (returning uint32_t)))))))) 29 | let hacl_HPKE_Curve64_CP256_SHA512_openBase = 30 | foreign "Hacl_HPKE_Curve64_CP256_SHA512_openBase" 31 | (ocaml_bytes @-> 32 | (ocaml_bytes @-> 33 | (uint32_t @-> 34 | (ocaml_bytes @-> 35 | (uint32_t @-> 36 | (ocaml_bytes @-> 37 | (ocaml_bytes @-> (returning uint32_t)))))))) 38 | end -------------------------------------------------------------------------------- /raw/EverCrypt_Cipher.c: -------------------------------------------------------------------------------- 1 | /* MIT License 2 | * 3 | * Copyright (c) 2016-2020 INRIA, CMU and Microsoft Corporation 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | */ 23 | 24 | 25 | #include "EverCrypt_Cipher.h" 26 | 27 | #include "internal/Hacl_Chacha20.h" 28 | 29 | void 30 | EverCrypt_Cipher_chacha20( 31 | uint32_t len, 32 | uint8_t *dst, 33 | uint8_t *src, 34 | uint8_t *key, 35 | uint8_t *iv, 36 | uint32_t ctr 37 | ) 38 | { 39 | uint32_t ctx[16U] = { 0U }; 40 | Hacl_Impl_Chacha20_chacha20_init(ctx, key, iv, ctr); 41 | Hacl_Impl_Chacha20_chacha20_update(ctx, len, dst, src); 42 | } 43 | 44 | -------------------------------------------------------------------------------- /raw/Hacl_Kremlib.c: -------------------------------------------------------------------------------- 1 | /* MIT License 2 | * 3 | * Copyright (c) 2016-2020 INRIA, CMU and Microsoft Corporation 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | */ 23 | 24 | 25 | #include "internal/Hacl_Kremlib.h" 26 | 27 | 28 | 29 | static uint32_t max_uint32 = (uint32_t)4294967295U; 30 | 31 | static uint32_t resize_ratio = (uint32_t)2U; 32 | 33 | uint32_t LowStar_Vector_new_capacity(uint32_t cap) 34 | { 35 | if (cap >= max_uint32 / resize_ratio) 36 | { 37 | return max_uint32; 38 | } 39 | if (cap == (uint32_t)0U) 40 | { 41 | return (uint32_t)1U; 42 | } 43 | return cap * resize_ratio; 44 | } 45 | 46 | -------------------------------------------------------------------------------- /raw/Makefile.basic: -------------------------------------------------------------------------------- 1 | # A basic Makefile that KreMLin copies in the output directory; this is not 2 | # guaranteed to work and will only work well for very simple projects. This 3 | # Makefile uses: 4 | # - the custom C files passed to your krml invocation 5 | # - the custom C flags passed to your krml invocation 6 | # - the -o option passed to your krml invocation 7 | 8 | include Makefile.include 9 | 10 | ifeq (,$(KREMLIN_HOME)) 11 | $(error please define KREMLIN_HOME to point to the root of your KReMLin git checkout) 12 | endif 13 | 14 | CFLAGS += -I. -I $(KREMLIN_HOME)/include -I $(KREMLIN_HOME)/kremlib/dist/minimal 15 | CFLAGS += -Wall -Wextra -Werror -std=c11 -Wno-unused-variable \ 16 | -Wno-unknown-warning-option -Wno-unused-but-set-variable \ 17 | -Wno-unused-parameter -Wno-infinite-recursion \ 18 | -g -fwrapv -D_BSD_SOURCE -D_DEFAULT_SOURCE 19 | ifeq ($(OS),Windows_NT) 20 | CFLAGS += -D__USE_MINGW_ANSI_STDIO 21 | else 22 | CFLAGS += -fPIC 23 | endif 24 | CFLAGS += $(USER_CFLAGS) 25 | 26 | SOURCES += $(ALL_C_FILES) $(USER_C_FILES) 27 | ifneq (,$(BLACKLIST)) 28 | SOURCES := $(filter-out $(BLACKLIST),$(SOURCES)) 29 | endif 30 | OBJS += $(patsubst %.c,%.o,$(SOURCES)) 31 | 32 | all: $(USER_TARGET) 33 | 34 | $(USER_TARGET): $(OBJS) 35 | 36 | AR ?= ar 37 | 38 | %.a: 39 | $(AR) cr $@ $^ 40 | 41 | %.exe: 42 | $(CC) $(CFLAGS) -o $@ $^ $(KREMLIN_HOME)/kremlib/dist/generic/libkremlib.a 43 | 44 | %.so: 45 | $(CC) $(CFLAGS) -shared -o $@ $^ 46 | 47 | %.d: %.c 48 | @set -e; rm -f $@; \ 49 | $(CC) -MM $(CFLAGS) $< > $@.$$$$; \ 50 | sed 's,\($(notdir $*)\)\.o[ :]*,$(dir $@)\1.o $@ : ,g' < $@.$$$$ > $@; \ 51 | rm -f $@.$$$$ 52 | 53 | include $(patsubst %.c,%.d,$(SOURCES)) 54 | 55 | clean: 56 | rm -rf *.o *.d $(USER_TARGET) 57 | -------------------------------------------------------------------------------- /kremlin/kremlib/dist/minimal/Makefile.basic: -------------------------------------------------------------------------------- 1 | # A basic Makefile that KreMLin copies in the output directory; this is not 2 | # guaranteed to work and will only work well for very simple projects. This 3 | # Makefile uses: 4 | # - the custom C files passed to your krml invocation 5 | # - the custom C flags passed to your krml invocation 6 | # - the -o option passed to your krml invocation 7 | 8 | include Makefile.include 9 | 10 | ifeq (,$(KREMLIN_HOME)) 11 | $(error please define KREMLIN_HOME to point to the root of your KReMLin git checkout) 12 | endif 13 | 14 | CFLAGS += -I. -I $(KREMLIN_HOME)/include -I $(KREMLIN_HOME)/kremlib/dist/minimal 15 | CFLAGS += -Wall -Wextra -Werror -std=c11 -Wno-unused-variable \ 16 | -Wno-unknown-warning-option -Wno-unused-but-set-variable \ 17 | -Wno-unused-parameter -Wno-infinite-recursion \ 18 | -g -fwrapv -D_BSD_SOURCE -D_DEFAULT_SOURCE 19 | ifeq ($(OS),Windows_NT) 20 | CFLAGS += -D__USE_MINGW_ANSI_STDIO 21 | else 22 | CFLAGS += -fPIC 23 | endif 24 | CFLAGS += $(USER_CFLAGS) 25 | 26 | SOURCES += $(ALL_C_FILES) $(USER_C_FILES) 27 | ifneq (,$(BLACKLIST)) 28 | SOURCES := $(filter-out $(BLACKLIST),$(SOURCES)) 29 | endif 30 | OBJS += $(patsubst %.c,%.o,$(SOURCES)) 31 | 32 | all: $(USER_TARGET) 33 | 34 | $(USER_TARGET): $(OBJS) 35 | 36 | AR ?= ar 37 | 38 | %.a: 39 | $(AR) cr $@ $^ 40 | 41 | %.exe: 42 | $(CC) $(CFLAGS) -o $@ $^ $(KREMLIN_HOME)/kremlib/dist/generic/libkremlib.a 43 | 44 | %.so: 45 | $(CC) $(CFLAGS) -shared -o $@ $^ 46 | 47 | %.d: %.c 48 | @set -e; rm -f $@; \ 49 | $(CC) -MM $(CFLAGS) $< > $@.$$$$; \ 50 | sed 's,\($(notdir $*)\)\.o[ :]*,$(dir $@)\1.o $@ : ,g' < $@.$$$$ > $@; \ 51 | rm -f $@.$$$$ 52 | 53 | include $(patsubst %.c,%.d,$(SOURCES)) 54 | 55 | clean: 56 | rm -rf *.o *.d $(USER_TARGET) 57 | -------------------------------------------------------------------------------- /raw/Lib_RandomBuffer_System.c: -------------------------------------------------------------------------------- 1 | #include "Lib_RandomBuffer_System.h" 2 | 3 | #if (defined(_WIN32) || defined(_WIN64)) 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | bool read_random_bytes(uint32_t len, uint8_t *buf) { 11 | HCRYPTPROV ctxt; 12 | if (!(CryptAcquireContext(&ctxt, NULL, NULL, PROV_RSA_FULL, 13 | CRYPT_VERIFYCONTEXT))) { 14 | DWORD error = GetLastError(); 15 | /* printf("Cannot acquire crypto context: 0x%lx\n", error); */ 16 | return false; 17 | } 18 | bool pass = true; 19 | if (!(CryptGenRandom(ctxt, (uint64_t)len, buf))) { 20 | /* printf("Cannot read random bytes\n"); */ 21 | pass = false; 22 | } 23 | CryptReleaseContext(ctxt, 0); 24 | return pass; 25 | } 26 | 27 | #else 28 | 29 | /* assume POSIX here */ 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | 36 | bool read_random_bytes(uint32_t len, uint8_t *buf) { 37 | #ifdef SYS_getrandom 38 | ssize_t res = syscall(SYS_getrandom, buf, (size_t)len, 0); 39 | if (res == -1) { 40 | return false; 41 | } 42 | #else // !defined(SYS_getrandom) 43 | int fd = open("/dev/urandom", O_RDONLY); 44 | if (fd == -1) { 45 | return false; 46 | } 47 | ssize_t res = read(fd, buf, (uint64_t)len); 48 | close(fd); 49 | #endif // defined(SYS_getrandom) 50 | return ((size_t)res == (size_t)len); 51 | } 52 | 53 | #endif 54 | 55 | // WARNING: this function is deprecated 56 | bool Lib_RandomBuffer_System_randombytes(uint8_t *x, uint32_t len) { 57 | return read_random_bytes(len, x); 58 | } 59 | 60 | void Lib_RandomBuffer_System_crypto_random(uint8_t *x, uint32_t len) { 61 | while(!read_random_bytes(len, x)) {} 62 | } 63 | -------------------------------------------------------------------------------- /raw/Lib_Memzero0.h: -------------------------------------------------------------------------------- 1 | /* MIT License 2 | * 3 | * Copyright (c) 2016-2020 INRIA, CMU and Microsoft Corporation 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | */ 23 | 24 | 25 | #ifndef __Lib_Memzero0_H 26 | #define __Lib_Memzero0_H 27 | 28 | #if defined(__cplusplus) 29 | extern "C" { 30 | #endif 31 | 32 | #include "evercrypt_targetconfig.h" 33 | #include "libintvector.h" 34 | #include "kremlin/internal/types.h" 35 | #include "kremlin/lowstar_endianness.h" 36 | #include 37 | #include "kremlin/internal/target.h" 38 | 39 | 40 | 41 | 42 | extern void Lib_Memzero0_memzero(void *x0, uint64_t x1); 43 | 44 | #if defined(__cplusplus) 45 | } 46 | #endif 47 | 48 | #define __Lib_Memzero0_H_DEFINED 49 | #endif 50 | -------------------------------------------------------------------------------- /raw/Lib_Memzero0.c: -------------------------------------------------------------------------------- 1 | #if __has_include("config.h") 2 | #include "config.h" 3 | #endif 4 | 5 | #ifdef _WIN32 6 | #include 7 | #endif 8 | 9 | #if (defined(__APPLE__) && defined(__MACH__)) || defined(__linux__) 10 | #define __STDC_WANT_LIB_EXT1__ 1 11 | #include 12 | #endif 13 | 14 | #ifdef __FreeBSD__ 15 | #include 16 | #endif 17 | 18 | #include 19 | #include 20 | #include 21 | #include 22 | 23 | #include "Lib_Memzero0.h" 24 | #include "kremlin/internal/target.h" 25 | 26 | /* The F* formalization talks about the number of elements in the array. The C 27 | implementation wants a number of bytes in the array. KreMLin is aware of this 28 | and inserts a sizeof multiplication. */ 29 | void Lib_Memzero0_memzero(void *dst, uint64_t len) { 30 | /* This is safe: kremlin checks at run-time (if needed) that all object sizes 31 | fit within a size_t, so the size we receive has been checked at 32 | allocation-time, possibly via KRML_CHECK_SIZE, to fit in a size_t. */ 33 | size_t len_ = (size_t) len; 34 | 35 | #ifdef _WIN32 36 | SecureZeroMemory(dst, len); 37 | #elif defined(__APPLE__) && defined(__MACH__) 38 | memset_s(dst, len_, 0, len_); 39 | #elif (defined(__linux__) && !defined(LINUX_NO_EXPLICIT_BZERO)) || defined(__FreeBSD__) 40 | explicit_bzero(dst, len_); 41 | #elif defined(__NetBSD__) 42 | explicit_memset(dst, 0, len_); 43 | #else 44 | /* Default implementation for platforms with no particular support. */ 45 | #warning "Your platform does not support any safe implementation of memzero -- consider a pull request!" 46 | volatile unsigned char *volatile dst_ = (volatile unsigned char *volatile) dst; 47 | size_t i = 0U; 48 | while (i < len) 49 | dst_[i++] = 0U; 50 | #endif 51 | } 52 | -------------------------------------------------------------------------------- /raw/lib/EverCrypt_CTR_bindings.ml: -------------------------------------------------------------------------------- 1 | open Ctypes 2 | module Bindings(F:Cstubs.FOREIGN) = 3 | struct 4 | open F 5 | module Hacl_Spec_applied = (Hacl_Spec_bindings.Bindings)(Hacl_Spec_stubs) 6 | open Hacl_Spec_applied 7 | module EverCrypt_Error_applied = 8 | (EverCrypt_Error_bindings.Bindings)(EverCrypt_Error_stubs) 9 | open EverCrypt_Error_applied 10 | type everCrypt_CTR_state_s = [ `everCrypt_CTR_state_s ] structure 11 | let (everCrypt_CTR_state_s : [ `everCrypt_CTR_state_s ] structure typ) = 12 | structure "EverCrypt_CTR_state_s_s" 13 | let everCrypt_CTR_xor8 = 14 | foreign "EverCrypt_CTR_xor8" 15 | (uint8_t @-> (uint8_t @-> (returning uint8_t))) 16 | let everCrypt_CTR_alg_of_state = 17 | foreign "EverCrypt_CTR_alg_of_state" 18 | ((ptr everCrypt_CTR_state_s) @-> 19 | (returning spec_Agile_Cipher_cipher_alg)) 20 | let everCrypt_CTR_create_in = 21 | foreign "EverCrypt_CTR_create_in" 22 | (spec_Agile_Cipher_cipher_alg @-> 23 | ((ptr (ptr everCrypt_CTR_state_s)) @-> 24 | (ocaml_bytes @-> 25 | (ocaml_bytes @-> 26 | (uint32_t @-> 27 | (uint32_t @-> (returning everCrypt_Error_error_code))))))) 28 | let everCrypt_CTR_init = 29 | foreign "EverCrypt_CTR_init" 30 | ((ptr everCrypt_CTR_state_s) @-> 31 | (ocaml_bytes @-> 32 | (ocaml_bytes @-> (uint32_t @-> (uint32_t @-> (returning void)))))) 33 | let everCrypt_CTR_update_block = 34 | foreign "EverCrypt_CTR_update_block" 35 | ((ptr everCrypt_CTR_state_s) @-> 36 | (ocaml_bytes @-> (ocaml_bytes @-> (returning void)))) 37 | let everCrypt_CTR_free = 38 | foreign "EverCrypt_CTR_free" 39 | ((ptr everCrypt_CTR_state_s) @-> (returning void)) 40 | end -------------------------------------------------------------------------------- /raw/internal/Hacl_Kremlib.h: -------------------------------------------------------------------------------- 1 | /* MIT License 2 | * 3 | * Copyright (c) 2016-2020 INRIA, CMU and Microsoft Corporation 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | */ 23 | 24 | 25 | #ifndef __internal_Hacl_Kremlib_H 26 | #define __internal_Hacl_Kremlib_H 27 | 28 | #if defined(__cplusplus) 29 | extern "C" { 30 | #endif 31 | 32 | #include "evercrypt_targetconfig.h" 33 | #include "libintvector.h" 34 | #include "kremlin/internal/types.h" 35 | #include "kremlin/lowstar_endianness.h" 36 | #include 37 | #include "kremlin/internal/target.h" 38 | 39 | 40 | #include "../Hacl_Kremlib.h" 41 | 42 | uint32_t LowStar_Vector_new_capacity(uint32_t cap); 43 | 44 | #if defined(__cplusplus) 45 | } 46 | #endif 47 | 48 | #define __internal_Hacl_Kremlib_H_DEFINED 49 | #endif 50 | -------------------------------------------------------------------------------- /raw/internal/Hacl_Frodo_KEM.h: -------------------------------------------------------------------------------- 1 | /* MIT License 2 | * 3 | * Copyright (c) 2016-2020 INRIA, CMU and Microsoft Corporation 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | */ 23 | 24 | 25 | #ifndef __internal_Hacl_Frodo_KEM_H 26 | #define __internal_Hacl_Frodo_KEM_H 27 | 28 | #if defined(__cplusplus) 29 | extern "C" { 30 | #endif 31 | 32 | #include "evercrypt_targetconfig.h" 33 | #include "libintvector.h" 34 | #include "kremlin/internal/types.h" 35 | #include "kremlin/lowstar_endianness.h" 36 | #include 37 | #include "kremlin/internal/target.h" 38 | 39 | 40 | #include "internal/Hacl_Kremlib.h" 41 | #include "../Hacl_Frodo_KEM.h" 42 | 43 | void randombytes_(uint32_t len, uint8_t *res); 44 | 45 | #if defined(__cplusplus) 46 | } 47 | #endif 48 | 49 | #define __internal_Hacl_Frodo_KEM_H_DEFINED 50 | #endif 51 | -------------------------------------------------------------------------------- /raw/EverCrypt_Cipher.h: -------------------------------------------------------------------------------- 1 | /* MIT License 2 | * 3 | * Copyright (c) 2016-2020 INRIA, CMU and Microsoft Corporation 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | */ 23 | 24 | 25 | #ifndef __EverCrypt_Cipher_H 26 | #define __EverCrypt_Cipher_H 27 | 28 | #if defined(__cplusplus) 29 | extern "C" { 30 | #endif 31 | 32 | #include "evercrypt_targetconfig.h" 33 | #include "libintvector.h" 34 | #include "kremlin/internal/types.h" 35 | #include "kremlin/lowstar_endianness.h" 36 | #include 37 | #include "kremlin/internal/target.h" 38 | 39 | 40 | 41 | 42 | void 43 | EverCrypt_Cipher_chacha20( 44 | uint32_t len, 45 | uint8_t *dst, 46 | uint8_t *src, 47 | uint8_t *key, 48 | uint8_t *iv, 49 | uint32_t ctr 50 | ); 51 | 52 | #if defined(__cplusplus) 53 | } 54 | #endif 55 | 56 | #define __EverCrypt_Cipher_H_DEFINED 57 | #endif 58 | -------------------------------------------------------------------------------- /raw/Hacl_AES128.h: -------------------------------------------------------------------------------- 1 | /* MIT License 2 | * 3 | * Copyright (c) 2016-2020 INRIA, CMU and Microsoft Corporation 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | */ 23 | 24 | 25 | #ifndef __Hacl_AES128_H 26 | #define __Hacl_AES128_H 27 | 28 | #if defined(__cplusplus) 29 | extern "C" { 30 | #endif 31 | 32 | #include "evercrypt_targetconfig.h" 33 | #include "libintvector.h" 34 | #include "kremlin/internal/types.h" 35 | #include "kremlin/lowstar_endianness.h" 36 | #include 37 | #include "kremlin/internal/target.h" 38 | 39 | 40 | 41 | 42 | extern void Hacl_AES128_aes128_key_expansion(uint8_t *key, uint8_t *expanded_key); 43 | 44 | extern void 45 | Hacl_AES128_aes128_encrypt_block(uint16_t *cipher, uint16_t *plain, uint8_t *expanded_key); 46 | 47 | #if defined(__cplusplus) 48 | } 49 | #endif 50 | 51 | #define __Hacl_AES128_H_DEFINED 52 | #endif 53 | -------------------------------------------------------------------------------- /raw/EverCrypt_StaticConfig.h: -------------------------------------------------------------------------------- 1 | /* MIT License 2 | * 3 | * Copyright (c) 2016-2020 INRIA, CMU and Microsoft Corporation 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | */ 23 | 24 | 25 | #ifndef __EverCrypt_StaticConfig_H 26 | #define __EverCrypt_StaticConfig_H 27 | 28 | #if defined(__cplusplus) 29 | extern "C" { 30 | #endif 31 | 32 | #include "evercrypt_targetconfig.h" 33 | #include "libintvector.h" 34 | #include "kremlin/internal/types.h" 35 | #include "kremlin/lowstar_endianness.h" 36 | #include 37 | #include "kremlin/internal/target.h" 38 | 39 | 40 | 41 | 42 | extern bool EverCrypt_StaticConfig_hacl; 43 | 44 | extern bool EverCrypt_StaticConfig_vale; 45 | 46 | extern bool EverCrypt_StaticConfig_openssl; 47 | 48 | extern bool EverCrypt_StaticConfig_bcrypt; 49 | 50 | #if defined(__cplusplus) 51 | } 52 | #endif 53 | 54 | #define __EverCrypt_StaticConfig_H_DEFINED 55 | #endif 56 | -------------------------------------------------------------------------------- /kremlin/kremlib/dist/minimal/fstar_uint128_struct_endianness.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) INRIA and Microsoft Corporation. All rights reserved. 2 | Licensed under the Apache 2.0 License. */ 3 | 4 | #ifndef FSTAR_UINT128_STRUCT_ENDIANNESS_H 5 | #define FSTAR_UINT128_STRUCT_ENDIANNESS_H 6 | 7 | /* Hand-written implementation of endianness-related uint128 functions 8 | * for the extracted uint128 implementation */ 9 | 10 | /* Access 64-bit fields within the int128. */ 11 | #define HIGH64_OF(x) ((x)->high) 12 | #define LOW64_OF(x) ((x)->low) 13 | 14 | /* A series of definitions written using pointers. */ 15 | 16 | inline static void load128_le_(uint8_t *b, uint128_t *r) { 17 | LOW64_OF(r) = load64_le(b); 18 | HIGH64_OF(r) = load64_le(b + 8); 19 | } 20 | 21 | inline static void store128_le_(uint8_t *b, uint128_t *n) { 22 | store64_le(b, LOW64_OF(n)); 23 | store64_le(b + 8, HIGH64_OF(n)); 24 | } 25 | 26 | inline static void load128_be_(uint8_t *b, uint128_t *r) { 27 | HIGH64_OF(r) = load64_be(b); 28 | LOW64_OF(r) = load64_be(b + 8); 29 | } 30 | 31 | inline static void store128_be_(uint8_t *b, uint128_t *n) { 32 | store64_be(b, HIGH64_OF(n)); 33 | store64_be(b + 8, LOW64_OF(n)); 34 | } 35 | 36 | #ifndef KRML_NOSTRUCT_PASSING 37 | 38 | inline static uint128_t load128_le(uint8_t *b) { 39 | uint128_t r; 40 | load128_le_(b, &r); 41 | return r; 42 | } 43 | 44 | inline static void store128_le(uint8_t *b, uint128_t n) { 45 | store128_le_(b, &n); 46 | } 47 | 48 | inline static uint128_t load128_be(uint8_t *b) { 49 | uint128_t r; 50 | load128_be_(b, &r); 51 | return r; 52 | } 53 | 54 | inline static void store128_be(uint8_t *b, uint128_t n) { 55 | store128_be_(b, &n); 56 | } 57 | 58 | #else /* !defined(KRML_STRUCT_PASSING) */ 59 | 60 | # define print128 print128_ 61 | # define load128_le load128_le_ 62 | # define store128_le store128_le_ 63 | # define load128_be load128_be_ 64 | # define store128_be store128_be_ 65 | 66 | #endif /* KRML_STRUCT_PASSING */ 67 | 68 | #endif 69 | -------------------------------------------------------------------------------- /raw/Hacl_HMAC_Blake2s_128.h: -------------------------------------------------------------------------------- 1 | /* MIT License 2 | * 3 | * Copyright (c) 2016-2020 INRIA, CMU and Microsoft Corporation 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | */ 23 | 24 | 25 | #ifndef __Hacl_HMAC_Blake2s_128_H 26 | #define __Hacl_HMAC_Blake2s_128_H 27 | 28 | #if defined(__cplusplus) 29 | extern "C" { 30 | #endif 31 | 32 | #include "evercrypt_targetconfig.h" 33 | #include "libintvector.h" 34 | #include "kremlin/internal/types.h" 35 | #include "kremlin/lowstar_endianness.h" 36 | #include 37 | #include "kremlin/internal/target.h" 38 | 39 | 40 | #include "Hacl_Impl_Blake2_Constants.h" 41 | 42 | void 43 | Hacl_HMAC_Blake2s_128_compute_blake2s_128( 44 | uint8_t *dst, 45 | uint8_t *key, 46 | uint32_t key_len, 47 | uint8_t *data, 48 | uint32_t data_len 49 | ); 50 | 51 | #if defined(__cplusplus) 52 | } 53 | #endif 54 | 55 | #define __Hacl_HMAC_Blake2s_128_H_DEFINED 56 | #endif 57 | -------------------------------------------------------------------------------- /raw/EverCrypt_Poly1305.h: -------------------------------------------------------------------------------- 1 | /* MIT License 2 | * 3 | * Copyright (c) 2016-2020 INRIA, CMU and Microsoft Corporation 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | */ 23 | 24 | 25 | #ifndef __EverCrypt_Poly1305_H 26 | #define __EverCrypt_Poly1305_H 27 | 28 | #if defined(__cplusplus) 29 | extern "C" { 30 | #endif 31 | 32 | #include "evercrypt_targetconfig.h" 33 | #include "libintvector.h" 34 | #include "kremlin/internal/types.h" 35 | #include "kremlin/lowstar_endianness.h" 36 | #include 37 | #include "kremlin/internal/target.h" 38 | 39 | 40 | #include "Hacl_Poly1305_32.h" 41 | #include "Hacl_Poly1305_256.h" 42 | #include "Hacl_Poly1305_128.h" 43 | #include "EverCrypt_AutoConfig2.h" 44 | 45 | void EverCrypt_Poly1305_poly1305(uint8_t *dst, uint8_t *src, uint32_t len, uint8_t *key); 46 | 47 | #if defined(__cplusplus) 48 | } 49 | #endif 50 | 51 | #define __EverCrypt_Poly1305_H_DEFINED 52 | #endif 53 | -------------------------------------------------------------------------------- /raw/Hacl_Spec.c: -------------------------------------------------------------------------------- 1 | /* MIT License 2 | * 3 | * Copyright (c) 2016-2020 INRIA, CMU and Microsoft Corporation 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | */ 23 | 24 | 25 | #include "internal/Hacl_Spec.h" 26 | 27 | 28 | 29 | Spec_Agile_Cipher_cipher_alg 30 | Spec_Cipher_Expansion_cipher_alg_of_impl(Spec_Cipher_Expansion_impl i) 31 | { 32 | switch (i) 33 | { 34 | case Spec_Cipher_Expansion_Hacl_CHACHA20: 35 | { 36 | return Spec_Agile_Cipher_CHACHA20; 37 | } 38 | case Spec_Cipher_Expansion_Vale_AES128: 39 | { 40 | return Spec_Agile_Cipher_AES128; 41 | } 42 | case Spec_Cipher_Expansion_Vale_AES256: 43 | { 44 | return Spec_Agile_Cipher_AES256; 45 | } 46 | default: 47 | { 48 | KRML_HOST_EPRINTF("KreMLin incomplete match at %s:%d\n", __FILE__, __LINE__); 49 | KRML_HOST_EXIT(253U); 50 | } 51 | } 52 | } 53 | 54 | -------------------------------------------------------------------------------- /raw/internal/Hacl_Hash_MD5.h: -------------------------------------------------------------------------------- 1 | /* MIT License 2 | * 3 | * Copyright (c) 2016-2020 INRIA, CMU and Microsoft Corporation 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | */ 23 | 24 | 25 | #ifndef __internal_Hacl_Hash_MD5_H 26 | #define __internal_Hacl_Hash_MD5_H 27 | 28 | #if defined(__cplusplus) 29 | extern "C" { 30 | #endif 31 | 32 | #include "evercrypt_targetconfig.h" 33 | #include "libintvector.h" 34 | #include "kremlin/internal/types.h" 35 | #include "kremlin/lowstar_endianness.h" 36 | #include 37 | #include "kremlin/internal/target.h" 38 | 39 | 40 | #include "../Hacl_Hash_MD5.h" 41 | 42 | void Hacl_Hash_Core_MD5_legacy_init(uint32_t *s); 43 | 44 | void Hacl_Hash_Core_MD5_legacy_update(uint32_t *abcd, uint8_t *x); 45 | 46 | void Hacl_Hash_Core_MD5_legacy_finish(uint32_t *s, uint8_t *dst); 47 | 48 | #if defined(__cplusplus) 49 | } 50 | #endif 51 | 52 | #define __internal_Hacl_Hash_MD5_H_DEFINED 53 | #endif 54 | -------------------------------------------------------------------------------- /raw/internal/Hacl_Hash_SHA1.h: -------------------------------------------------------------------------------- 1 | /* MIT License 2 | * 3 | * Copyright (c) 2016-2020 INRIA, CMU and Microsoft Corporation 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | */ 23 | 24 | 25 | #ifndef __internal_Hacl_Hash_SHA1_H 26 | #define __internal_Hacl_Hash_SHA1_H 27 | 28 | #if defined(__cplusplus) 29 | extern "C" { 30 | #endif 31 | 32 | #include "evercrypt_targetconfig.h" 33 | #include "libintvector.h" 34 | #include "kremlin/internal/types.h" 35 | #include "kremlin/lowstar_endianness.h" 36 | #include 37 | #include "kremlin/internal/target.h" 38 | 39 | 40 | #include "../Hacl_Hash_SHA1.h" 41 | 42 | void Hacl_Hash_Core_SHA1_legacy_init(uint32_t *s); 43 | 44 | void Hacl_Hash_Core_SHA1_legacy_update(uint32_t *h, uint8_t *l); 45 | 46 | void Hacl_Hash_Core_SHA1_legacy_finish(uint32_t *s, uint8_t *dst); 47 | 48 | #if defined(__cplusplus) 49 | } 50 | #endif 51 | 52 | #define __internal_Hacl_Hash_SHA1_H_DEFINED 53 | #endif 54 | -------------------------------------------------------------------------------- /raw/Hacl_HMAC_Blake2b_256.h: -------------------------------------------------------------------------------- 1 | /* MIT License 2 | * 3 | * Copyright (c) 2016-2020 INRIA, CMU and Microsoft Corporation 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | */ 23 | 24 | 25 | #ifndef __Hacl_HMAC_Blake2b_256_H 26 | #define __Hacl_HMAC_Blake2b_256_H 27 | 28 | #if defined(__cplusplus) 29 | extern "C" { 30 | #endif 31 | 32 | #include "evercrypt_targetconfig.h" 33 | #include "libintvector.h" 34 | #include "kremlin/internal/types.h" 35 | #include "kremlin/lowstar_endianness.h" 36 | #include 37 | #include "kremlin/internal/target.h" 38 | 39 | 40 | #include "Hacl_Kremlib.h" 41 | #include "Hacl_Impl_Blake2_Constants.h" 42 | 43 | void 44 | Hacl_HMAC_Blake2b_256_compute_blake2b_256( 45 | uint8_t *dst, 46 | uint8_t *key, 47 | uint32_t key_len, 48 | uint8_t *data, 49 | uint32_t data_len 50 | ); 51 | 52 | #if defined(__cplusplus) 53 | } 54 | #endif 55 | 56 | #define __Hacl_HMAC_Blake2b_256_H_DEFINED 57 | #endif 58 | -------------------------------------------------------------------------------- /raw/Lib_RandomBuffer_System.h: -------------------------------------------------------------------------------- 1 | /* MIT License 2 | * 3 | * Copyright (c) 2016-2020 INRIA, CMU and Microsoft Corporation 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | */ 23 | 24 | 25 | #ifndef __Lib_RandomBuffer_System_H 26 | #define __Lib_RandomBuffer_System_H 27 | 28 | #if defined(__cplusplus) 29 | extern "C" { 30 | #endif 31 | 32 | #include "evercrypt_targetconfig.h" 33 | #include "libintvector.h" 34 | #include "kremlin/internal/types.h" 35 | #include "kremlin/lowstar_endianness.h" 36 | #include 37 | #include "kremlin/internal/target.h" 38 | 39 | 40 | 41 | 42 | KRML_DEPRECATED("random_crypto") 43 | 44 | extern bool Lib_RandomBuffer_System_randombytes(uint8_t *buf, uint32_t len); 45 | 46 | extern void *Lib_RandomBuffer_System_entropy_p; 47 | 48 | extern void Lib_RandomBuffer_System_crypto_random(uint8_t *buf, uint32_t len); 49 | 50 | #if defined(__cplusplus) 51 | } 52 | #endif 53 | 54 | #define __Lib_RandomBuffer_System_H_DEFINED 55 | #endif 56 | -------------------------------------------------------------------------------- /raw/Hacl_Curve25519_51.h: -------------------------------------------------------------------------------- 1 | /* MIT License 2 | * 3 | * Copyright (c) 2016-2020 INRIA, CMU and Microsoft Corporation 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | */ 23 | 24 | 25 | #ifndef __Hacl_Curve25519_51_H 26 | #define __Hacl_Curve25519_51_H 27 | 28 | #if defined(__cplusplus) 29 | extern "C" { 30 | #endif 31 | 32 | #include "evercrypt_targetconfig.h" 33 | #include "libintvector.h" 34 | #include "kremlin/internal/types.h" 35 | #include "kremlin/lowstar_endianness.h" 36 | #include 37 | #include "kremlin/internal/target.h" 38 | 39 | 40 | #include "Hacl_Kremlib.h" 41 | #include "Hacl_Bignum25519_51.h" 42 | 43 | void Hacl_Curve25519_51_scalarmult(uint8_t *out, uint8_t *priv, uint8_t *pub); 44 | 45 | void Hacl_Curve25519_51_secret_to_public(uint8_t *pub, uint8_t *priv); 46 | 47 | bool Hacl_Curve25519_51_ecdh(uint8_t *out, uint8_t *priv, uint8_t *pub); 48 | 49 | #if defined(__cplusplus) 50 | } 51 | #endif 52 | 53 | #define __Hacl_Curve25519_51_H_DEFINED 54 | #endif 55 | -------------------------------------------------------------------------------- /raw/Hacl_Curve25519_64.h: -------------------------------------------------------------------------------- 1 | /* MIT License 2 | * 3 | * Copyright (c) 2016-2020 INRIA, CMU and Microsoft Corporation 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | */ 23 | 24 | 25 | #ifndef __Hacl_Curve25519_64_H 26 | #define __Hacl_Curve25519_64_H 27 | 28 | #if defined(__cplusplus) 29 | extern "C" { 30 | #endif 31 | 32 | #include "evercrypt_targetconfig.h" 33 | #include "libintvector.h" 34 | #include "curve25519-inline.h" 35 | #include "kremlin/internal/types.h" 36 | #include "kremlin/lowstar_endianness.h" 37 | #include 38 | #include "kremlin/internal/target.h" 39 | 40 | 41 | #include "Hacl_Kremlib.h" 42 | 43 | void Hacl_Curve25519_64_scalarmult(uint8_t *out, uint8_t *priv, uint8_t *pub); 44 | 45 | void Hacl_Curve25519_64_secret_to_public(uint8_t *pub, uint8_t *priv); 46 | 47 | bool Hacl_Curve25519_64_ecdh(uint8_t *out, uint8_t *priv, uint8_t *pub); 48 | 49 | #if defined(__cplusplus) 50 | } 51 | #endif 52 | 53 | #define __Hacl_Curve25519_64_H_DEFINED 54 | #endif 55 | -------------------------------------------------------------------------------- /raw/Hacl_Curve25519_64_Slow.h: -------------------------------------------------------------------------------- 1 | /* MIT License 2 | * 3 | * Copyright (c) 2016-2020 INRIA, CMU and Microsoft Corporation 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | */ 23 | 24 | 25 | #ifndef __Hacl_Curve25519_64_Slow_H 26 | #define __Hacl_Curve25519_64_Slow_H 27 | 28 | #if defined(__cplusplus) 29 | extern "C" { 30 | #endif 31 | 32 | #include "evercrypt_targetconfig.h" 33 | #include "libintvector.h" 34 | #include "kremlin/internal/types.h" 35 | #include "kremlin/lowstar_endianness.h" 36 | #include 37 | #include "kremlin/internal/target.h" 38 | 39 | 40 | #include "Hacl_Kremlib.h" 41 | #include "Hacl_Bignum_Base.h" 42 | 43 | void Hacl_Curve25519_64_Slow_scalarmult(uint8_t *out, uint8_t *priv, uint8_t *pub); 44 | 45 | void Hacl_Curve25519_64_Slow_secret_to_public(uint8_t *pub, uint8_t *priv); 46 | 47 | bool Hacl_Curve25519_64_Slow_ecdh(uint8_t *out, uint8_t *priv, uint8_t *pub); 48 | 49 | #if defined(__cplusplus) 50 | } 51 | #endif 52 | 53 | #define __Hacl_Curve25519_64_Slow_H_DEFINED 54 | #endif 55 | -------------------------------------------------------------------------------- /raw/internal/Hacl_Poly1305_128.h: -------------------------------------------------------------------------------- 1 | /* MIT License 2 | * 3 | * Copyright (c) 2016-2020 INRIA, CMU and Microsoft Corporation 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | */ 23 | 24 | 25 | #ifndef __internal_Hacl_Poly1305_128_H 26 | #define __internal_Hacl_Poly1305_128_H 27 | 28 | #if defined(__cplusplus) 29 | extern "C" { 30 | #endif 31 | 32 | #include "evercrypt_targetconfig.h" 33 | #include "libintvector.h" 34 | #include "kremlin/internal/types.h" 35 | #include "kremlin/lowstar_endianness.h" 36 | #include 37 | #include "kremlin/internal/target.h" 38 | 39 | 40 | #include "../Hacl_Poly1305_128.h" 41 | 42 | void 43 | Hacl_Impl_Poly1305_Field32xN_128_load_acc2(Lib_IntVector_Intrinsics_vec128 *acc, uint8_t *b); 44 | 45 | void 46 | Hacl_Impl_Poly1305_Field32xN_128_fmul_r2_normalize( 47 | Lib_IntVector_Intrinsics_vec128 *out, 48 | Lib_IntVector_Intrinsics_vec128 *p 49 | ); 50 | 51 | #if defined(__cplusplus) 52 | } 53 | #endif 54 | 55 | #define __internal_Hacl_Poly1305_128_H_DEFINED 56 | #endif 57 | -------------------------------------------------------------------------------- /raw/internal/Hacl_Poly1305_256.h: -------------------------------------------------------------------------------- 1 | /* MIT License 2 | * 3 | * Copyright (c) 2016-2020 INRIA, CMU and Microsoft Corporation 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | */ 23 | 24 | 25 | #ifndef __internal_Hacl_Poly1305_256_H 26 | #define __internal_Hacl_Poly1305_256_H 27 | 28 | #if defined(__cplusplus) 29 | extern "C" { 30 | #endif 31 | 32 | #include "evercrypt_targetconfig.h" 33 | #include "libintvector.h" 34 | #include "kremlin/internal/types.h" 35 | #include "kremlin/lowstar_endianness.h" 36 | #include 37 | #include "kremlin/internal/target.h" 38 | 39 | 40 | #include "../Hacl_Poly1305_256.h" 41 | 42 | void 43 | Hacl_Impl_Poly1305_Field32xN_256_load_acc4(Lib_IntVector_Intrinsics_vec256 *acc, uint8_t *b); 44 | 45 | void 46 | Hacl_Impl_Poly1305_Field32xN_256_fmul_r4_normalize( 47 | Lib_IntVector_Intrinsics_vec256 *out, 48 | Lib_IntVector_Intrinsics_vec256 *p 49 | ); 50 | 51 | #if defined(__cplusplus) 52 | } 53 | #endif 54 | 55 | #define __internal_Hacl_Poly1305_256_H_DEFINED 56 | #endif 57 | -------------------------------------------------------------------------------- /raw/Hacl_Hash_Base.h: -------------------------------------------------------------------------------- 1 | /* MIT License 2 | * 3 | * Copyright (c) 2016-2020 INRIA, CMU and Microsoft Corporation 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | */ 23 | 24 | 25 | #ifndef __Hacl_Hash_Base_H 26 | #define __Hacl_Hash_Base_H 27 | 28 | #if defined(__cplusplus) 29 | extern "C" { 30 | #endif 31 | 32 | #include "evercrypt_targetconfig.h" 33 | #include "libintvector.h" 34 | #include "kremlin/internal/types.h" 35 | #include "kremlin/lowstar_endianness.h" 36 | #include 37 | #include "kremlin/internal/target.h" 38 | 39 | 40 | #include "Hacl_Spec.h" 41 | 42 | uint32_t Hacl_Hash_Definitions_word_len(Spec_Hash_Definitions_hash_alg a); 43 | 44 | uint32_t Hacl_Hash_Definitions_block_len(Spec_Hash_Definitions_hash_alg a); 45 | 46 | uint32_t Hacl_Hash_Definitions_hash_word_len(Spec_Hash_Definitions_hash_alg a); 47 | 48 | uint32_t Hacl_Hash_Definitions_hash_len(Spec_Hash_Definitions_hash_alg a); 49 | 50 | #if defined(__cplusplus) 51 | } 52 | #endif 53 | 54 | #define __Hacl_Hash_Base_H_DEFINED 55 | #endif 56 | -------------------------------------------------------------------------------- /raw/Hacl_Hash_MD5.h: -------------------------------------------------------------------------------- 1 | /* MIT License 2 | * 3 | * Copyright (c) 2016-2020 INRIA, CMU and Microsoft Corporation 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | */ 23 | 24 | 25 | #ifndef __Hacl_Hash_MD5_H 26 | #define __Hacl_Hash_MD5_H 27 | 28 | #if defined(__cplusplus) 29 | extern "C" { 30 | #endif 31 | 32 | #include "evercrypt_targetconfig.h" 33 | #include "libintvector.h" 34 | #include "kremlin/internal/types.h" 35 | #include "kremlin/lowstar_endianness.h" 36 | #include 37 | #include "kremlin/internal/target.h" 38 | 39 | 40 | #include "Hacl_Kremlib.h" 41 | 42 | void Hacl_Hash_MD5_legacy_update_multi(uint32_t *s, uint8_t *blocks, uint32_t n_blocks); 43 | 44 | void 45 | Hacl_Hash_MD5_legacy_update_last( 46 | uint32_t *s, 47 | uint64_t prev_len, 48 | uint8_t *input, 49 | uint32_t input_len 50 | ); 51 | 52 | void Hacl_Hash_MD5_legacy_hash(uint8_t *input, uint32_t input_len, uint8_t *dst); 53 | 54 | #if defined(__cplusplus) 55 | } 56 | #endif 57 | 58 | #define __Hacl_Hash_MD5_H_DEFINED 59 | #endif 60 | -------------------------------------------------------------------------------- /raw/Hacl_Hash_SHA1.h: -------------------------------------------------------------------------------- 1 | /* MIT License 2 | * 3 | * Copyright (c) 2016-2020 INRIA, CMU and Microsoft Corporation 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | */ 23 | 24 | 25 | #ifndef __Hacl_Hash_SHA1_H 26 | #define __Hacl_Hash_SHA1_H 27 | 28 | #if defined(__cplusplus) 29 | extern "C" { 30 | #endif 31 | 32 | #include "evercrypt_targetconfig.h" 33 | #include "libintvector.h" 34 | #include "kremlin/internal/types.h" 35 | #include "kremlin/lowstar_endianness.h" 36 | #include 37 | #include "kremlin/internal/target.h" 38 | 39 | 40 | #include "Hacl_Kremlib.h" 41 | 42 | void Hacl_Hash_SHA1_legacy_update_multi(uint32_t *s, uint8_t *blocks, uint32_t n_blocks); 43 | 44 | void 45 | Hacl_Hash_SHA1_legacy_update_last( 46 | uint32_t *s, 47 | uint64_t prev_len, 48 | uint8_t *input, 49 | uint32_t input_len 50 | ); 51 | 52 | void Hacl_Hash_SHA1_legacy_hash(uint8_t *input, uint32_t input_len, uint8_t *dst); 53 | 54 | #if defined(__cplusplus) 55 | } 56 | #endif 57 | 58 | #define __Hacl_Hash_SHA1_H_DEFINED 59 | #endif 60 | -------------------------------------------------------------------------------- /raw/internal/Hacl_Curve25519_51.h: -------------------------------------------------------------------------------- 1 | /* MIT License 2 | * 3 | * Copyright (c) 2016-2020 INRIA, CMU and Microsoft Corporation 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | */ 23 | 24 | 25 | #ifndef __internal_Hacl_Curve25519_51_H 26 | #define __internal_Hacl_Curve25519_51_H 27 | 28 | #if defined(__cplusplus) 29 | extern "C" { 30 | #endif 31 | 32 | #include "evercrypt_targetconfig.h" 33 | #include "libintvector.h" 34 | #include "kremlin/internal/types.h" 35 | #include "kremlin/lowstar_endianness.h" 36 | #include 37 | #include "kremlin/internal/target.h" 38 | 39 | 40 | #include "internal/Hacl_Kremlib.h" 41 | #include "../Hacl_Curve25519_51.h" 42 | 43 | void 44 | Hacl_Curve25519_51_fsquare_times( 45 | uint64_t *o, 46 | uint64_t *inp, 47 | FStar_UInt128_uint128 *tmp, 48 | uint32_t n 49 | ); 50 | 51 | void Hacl_Curve25519_51_finv(uint64_t *o, uint64_t *i, FStar_UInt128_uint128 *tmp); 52 | 53 | #if defined(__cplusplus) 54 | } 55 | #endif 56 | 57 | #define __internal_Hacl_Curve25519_51_H_DEFINED 58 | #endif 59 | -------------------------------------------------------------------------------- /raw/Hacl_Chacha20.h: -------------------------------------------------------------------------------- 1 | /* MIT License 2 | * 3 | * Copyright (c) 2016-2020 INRIA, CMU and Microsoft Corporation 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | */ 23 | 24 | 25 | #ifndef __Hacl_Chacha20_H 26 | #define __Hacl_Chacha20_H 27 | 28 | #if defined(__cplusplus) 29 | extern "C" { 30 | #endif 31 | 32 | #include "evercrypt_targetconfig.h" 33 | #include "libintvector.h" 34 | #include "kremlin/internal/types.h" 35 | #include "kremlin/lowstar_endianness.h" 36 | #include 37 | #include "kremlin/internal/target.h" 38 | 39 | 40 | #include "Hacl_Kremlib.h" 41 | 42 | void 43 | Hacl_Chacha20_chacha20_encrypt( 44 | uint32_t len, 45 | uint8_t *out, 46 | uint8_t *text, 47 | uint8_t *key, 48 | uint8_t *n, 49 | uint32_t ctr 50 | ); 51 | 52 | void 53 | Hacl_Chacha20_chacha20_decrypt( 54 | uint32_t len, 55 | uint8_t *out, 56 | uint8_t *cipher, 57 | uint8_t *key, 58 | uint8_t *n, 59 | uint32_t ctr 60 | ); 61 | 62 | #if defined(__cplusplus) 63 | } 64 | #endif 65 | 66 | #define __Hacl_Chacha20_H_DEFINED 67 | #endif 68 | -------------------------------------------------------------------------------- /raw/EverCrypt_Ed25519.c: -------------------------------------------------------------------------------- 1 | /* MIT License 2 | * 3 | * Copyright (c) 2016-2020 INRIA, CMU and Microsoft Corporation 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | */ 23 | 24 | 25 | #include "EverCrypt_Ed25519.h" 26 | 27 | 28 | 29 | void EverCrypt_Ed25519_sign(uint8_t *signature, uint8_t *secret, uint32_t len, uint8_t *msg) 30 | { 31 | Hacl_Ed25519_sign(signature, secret, len, msg); 32 | } 33 | 34 | bool EverCrypt_Ed25519_verify(uint8_t *pubkey, uint32_t len, uint8_t *msg, uint8_t *signature) 35 | { 36 | return Hacl_Ed25519_verify(pubkey, len, msg, signature); 37 | } 38 | 39 | void EverCrypt_Ed25519_secret_to_public(uint8_t *output, uint8_t *secret) 40 | { 41 | Hacl_Ed25519_secret_to_public(output, secret); 42 | } 43 | 44 | void EverCrypt_Ed25519_expand_keys(uint8_t *ks, uint8_t *secret) 45 | { 46 | Hacl_Ed25519_expand_keys(ks, secret); 47 | } 48 | 49 | void 50 | EverCrypt_Ed25519_sign_expanded(uint8_t *signature, uint8_t *ks, uint32_t len, uint8_t *msg) 51 | { 52 | Hacl_Ed25519_sign_expanded(signature, ks, len, msg); 53 | } 54 | 55 | -------------------------------------------------------------------------------- /raw/EverCrypt_Curve25519.h: -------------------------------------------------------------------------------- 1 | /* MIT License 2 | * 3 | * Copyright (c) 2016-2020 INRIA, CMU and Microsoft Corporation 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | */ 23 | 24 | 25 | #ifndef __EverCrypt_Curve25519_H 26 | #define __EverCrypt_Curve25519_H 27 | 28 | #if defined(__cplusplus) 29 | extern "C" { 30 | #endif 31 | 32 | #include "evercrypt_targetconfig.h" 33 | #include "libintvector.h" 34 | #include "kremlin/internal/types.h" 35 | #include "kremlin/lowstar_endianness.h" 36 | #include 37 | #include "kremlin/internal/target.h" 38 | 39 | 40 | #include "Hacl_Curve25519_64.h" 41 | #include "Hacl_Curve25519_51.h" 42 | #include "EverCrypt_AutoConfig2.h" 43 | 44 | void EverCrypt_Curve25519_secret_to_public(uint8_t *pub, uint8_t *priv); 45 | 46 | void EverCrypt_Curve25519_scalarmult(uint8_t *shared, uint8_t *my_priv, uint8_t *their_pub); 47 | 48 | bool EverCrypt_Curve25519_ecdh(uint8_t *shared, uint8_t *my_priv, uint8_t *their_pub); 49 | 50 | #if defined(__cplusplus) 51 | } 52 | #endif 53 | 54 | #define __EverCrypt_Curve25519_H_DEFINED 55 | #endif 56 | -------------------------------------------------------------------------------- /raw/Lib_PrintBuffer.h: -------------------------------------------------------------------------------- 1 | /* MIT License 2 | * 3 | * Copyright (c) 2016-2020 INRIA, CMU and Microsoft Corporation 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining a copy 6 | * of this software and associated documentation files (the "Software"), to deal 7 | * in the Software without restriction, including without limitation the rights 8 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | * copies of the Software, and to permit persons to whom the Software is 10 | * furnished to do so, subject to the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be included in all 13 | * copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | * SOFTWARE. 22 | */ 23 | 24 | 25 | #ifndef __Lib_PrintBuffer_H 26 | #define __Lib_PrintBuffer_H 27 | 28 | #if defined(__cplusplus) 29 | extern "C" { 30 | #endif 31 | 32 | #include "evercrypt_targetconfig.h" 33 | #include "libintvector.h" 34 | #include "kremlin/internal/types.h" 35 | #include "kremlin/lowstar_endianness.h" 36 | #include 37 | #include "kremlin/internal/target.h" 38 | 39 | 40 | 41 | 42 | extern void Lib_PrintBuffer_print_bytes(uint32_t len, uint8_t *buf); 43 | 44 | extern void Lib_PrintBuffer_print_compare(uint32_t len, uint8_t *buf0, uint8_t *buf1); 45 | 46 | extern void 47 | Lib_PrintBuffer_print_compare_display(uint32_t len, const uint8_t *buf0, const uint8_t *buf1); 48 | 49 | extern bool 50 | Lib_PrintBuffer_result_compare_display(uint32_t len, const uint8_t *buf0, const uint8_t *buf1); 51 | 52 | #if defined(__cplusplus) 53 | } 54 | #endif 55 | 56 | #define __Lib_PrintBuffer_H_DEFINED 57 | #endif 58 | --------------------------------------------------------------------------------