Skip to content

Commit

Permalink
noasis
Browse files Browse the repository at this point in the history
  • Loading branch information
pqwy committed Oct 27, 2016
1 parent b1ad1e8 commit 8ec1c0f
Show file tree
Hide file tree
Showing 24 changed files with 209 additions and 364 deletions.
25 changes: 6 additions & 19 deletions .gitignore
@@ -1,25 +1,12 @@
rondom

_tags
myocamlbuild.ml
setup.ml
*/META
*/*.mllib
*/*.mldylib
*/*.clib
*/api.odocl

_tags.local
myocamlbuild.ml.local

_build
setup.data
setup.log

*.install
*.native
*.byte
*.docdir

*.prof
*~
\.\#*
\#*#

gmon.out
*.prof
rondom
6 changes: 3 additions & 3 deletions .ocamlinit
Expand Up @@ -2,9 +2,9 @@
#directory "_build/src"
#load "nocrypto.cma"

#require "oUnit"
#directory "_build/tests"
#load "testlib.cma"
(* #require "oUnit" *)
(* #directory "_build/tests" *)
(* #load "testlib.cma" *)

#directory "_build/unix"
#load "nocrypto_entropy_unix.cmo"
Expand Down
4 changes: 3 additions & 1 deletion CHANGES.md
@@ -1,4 +1,6 @@
(trunk):
0.5.4 (??):
* Solo5 support.
* Moved the build to `topkg`.

0.5.3 (2016-03-21):
* Move from Camlp4 to PPX.
Expand Down
File renamed without changes.
47 changes: 0 additions & 47 deletions Makefile

This file was deleted.

36 changes: 25 additions & 11 deletions README.md
Expand Up @@ -2,15 +2,30 @@

## Documentation

Comments in the single interface file, [`nocrypto.mli`][nocrypto-mli]. Also available [online][docs].
Comments in the single interface file, [`nocrypto.mli`][nocrypto-mli].
Also available [online][docs].

The documentation is a work in progress. :)

## Build

```bash
pkg/pkg.ml build
--with-unix BOOL
--with-lwt BOOL
--xen BOOL
--freestanding BOOL`
pkg/pkg.ml test
```

## FAQ

#### RNG seeding

You get something like `Fatal error: exception Uncommon.Boot.Unseeded_generator` and ask yourself: "Is there a simple way to forget about seeding and have the thing working?"
You get something like `Fatal error: exception Uncommon.Boot.Unseeded_generator`
and ask yourself: "Is there a simple way to forget about seeding and have the
thing working?"

```OCaml
(* On pure Unix: *)
Expand All @@ -29,18 +44,17 @@ Program terminated with signal SIGILL, Illegal instruction.
#0 _mm_aeskeygenassist_si128 (__C=<optimized out>, __X=...)
```
`Nocrypto` has CPU acceleration support (`SSE2`+`AES-NI`), but it has no run-time autodetection yet. You
compiled the library with acceleration, but you are using it on a machine that does not support it.

`./configure --disable-modernity` disables non-portable code.
`Nocrypto` has CPU acceleration support (`SSE2`+`AES-NI`), but it has no
run-time autodetection yet. You compiled the library with acceleration, but you
are using it on a machine that does not support it.
`./configure --enable-modernity` enables non-portable code if the build machine supports it.
`pkg/pkg.ml build --accelerate false` force-disables non-portable code.
The flag defaults to `enable`.
`pkg/pkg.ml build --accelerate true` force-enables non-portable code.
A second way to disable this feature is by exporting `$NOCRYPTO_NO_ACCEL`
environment variable during build. This is desirable, for example, when building
via `opam`.
Another way to specify the flags is not the `NOCRYPTO_ACCELERATE` environment
variable. When `--accelerate` is not specified, it maches the capabilities of
the build machine.
[docs]: http://mirleft.github.io/ocaml-nocrypto
[nocrypto-mli]: https://github.com/mirleft/ocaml-nocrypto/blob/master/src/nocrypto.mli
202 changes: 0 additions & 202 deletions _oasis

This file was deleted.

25 changes: 25 additions & 0 deletions _tags
@@ -0,0 +1,25 @@
true: color(always)
true: bin_annot, safe_string
true: warn(A-4-29-33-40-41-42-43-34-44-48)
true: package(bytes), package(cstruct)

<src>: include
<src/*.ml{,i}>: package(zarith), package(sexplib), package(ppx_sexp_conv)
<src/*.cm{x,o}> and not <src/nocrypto.cmx>: for-pack(Nocrypto)
<src/*.cm{,x}a>: link_stubs(src/libnocrypto_stubs)

<unix>: include
<unix/*.ml{,i}>: package(unix), package(bytes)

<lwt>: include
<lwt/*.ml{,i}>: package(lwt.unix), package(cstruct.lwt)

<mirage>: include
<mirage/*.ml{,i}>: package(lwt), package(mirage-entropy)

<**/*.c>: ccopt(--std=c99 -Wall -Wextra -O3)

<bench/*>: use_nocrypto, package(zarith), package(cstruct.unix)
<tests/*>: use_nocrypto, package(zarith), package(oUnit)

<rondom>: -traverse
8 changes: 8 additions & 0 deletions build
@@ -0,0 +1,8 @@
#!/bin/sh

function has { opam config var "${1}:installed"; }

topkg build -- \
--with-lwt $(has 'lwt') \
--xen $(has 'mirage-xen') \
--freestanding $(has 'ocaml-freestanding')

0 comments on commit 8ec1c0f

Please sign in to comment.