hannes changed the topic of #mirage to: https://mirage.io - https://github.com/mirage/mirage-www/wiki/Call-Agenda - this channel is logged at http://irclog.whitequark.org/mirage/ - MirageOS 3.5.0 is released - happy hacking!
_whitelogger has joined #mirage
trn has joined #mirage
trn has quit [Remote host closed the connection]
_whitelogger has joined #mirage
_whitelogger has joined #mirage
sigjuice has quit [Quit: ZNC - http://znc.in]
djs55 has joined #mirage
djs55 has quit [Quit: Leaving.]
_whitelogger has joined #mirage
Haudegen has joined #mirage
pie__ has joined #mirage
Haudegen has quit [Remote host closed the connection]
pie__ has quit [Ping timeout: 255 seconds]
<apache2> a lazy trick for this kind of code is to steal an implementation that runs in a kernel somewhere (like linux or bsd kernel modules) since those are also libc-free
<apache2> usually they are easier to port imho
<apache2> argon2id is available in eg PHP because it's superior to scrypt
<apache2> scrypt is "broken" (the cpu/memory tradeoff thing is not as strong as originally thought, although still quite strong), and there are concerns over side channel stuff in scrypt, although I'm not sure of the specifics, so it would indeed be nice if we had argon2id somewhere in ocaml
<apache2> kakekongen: I've used scrypt-kdf with the xen target, that worked fine
<apache2> not sure why you would get the caml_salsa_core thing, it looks like it does have a mirage-freestanding target https://github.com/abeaumont/ocaml-salsa20-core/blob/master/pkg/META
djs55 has joined #mirage
djs55 has quit [Quit: Leaving.]
<tg> any idea why a program might crash with sigill in libmpir when using nocrypto?
<copy`> tg: Apparently your installed libmpir uses some instructions that your processor doesn't support
<copy`> You could check what instructions is at address 0x00007ffff7f8c8b5
<tg> hm, right, it's vpbroadcastq
<apache2> you need to export a magic environment variable in your shell then reinstall nocrypto
<apache2> export NOCRYPTO_ACCELERATE="false"
<apache2> to have it operate correctly
<copy`> apache2: I believe that's for issues related to nocrypto's aes instructions, but in this case it's libmpir's fault (or nix's fault for installing the library on this particular machine)
<apache2> this is documented at the bottom of the readme
<apache2> ah I see
<apache2> why is it building with libmpir?
<apache2> sounds like the nix people packaged zarith incorrectly
<tg> i installed zarith via opam though
<apache2> or they chose to implement SSE2 feature detection by catching the sigill signal and something turned that off?
<apache2> right, but the question is why you have libmpir and not libgmp I guess
<apache2> also a little bit interesting what hw you're running this on that doesn't have SSE2 :)
<tg> i do have gmp and zarith finds at compile time (and it also requires mpir, just checked)
<tg> still the same with NOCRYPTO_ACCELERATE=false
<apache2> can you build libmpir without SSE2 acceleration?
<tg> it's a core i5 btw
<apache2> maybe writing Michael Raskin <7c6f434c@mail.ru>
<apache2> would give you some answers
<apache2> he's listed as the nixos maintainer of libmpir
<tg> i'll open a nix issue then..
<apache2> ah, looking at zarith that seems to be what pulls in mpir
<apache2> in `configure` it seems to look for GMP, if that fails it looks for MPIR, if that fails it errors out
<tg> ah wait it indeed didnt find the gmp lib for some reason
<apache2> ah
<tg> even though i had it in LIBRARY_PATH
<apache2> also there seems to be a ghetto thing involved here from the opam side called conf-gmp
<apache2> which had hardcoded cases for debian, ubuntu, homebrew, centos, fedora, openbsd, freebsd, alpine, opensuse, and defaults to not requiring anything if your os-distribution string doesn't match any of those
<apache2> so filing a patch with upstream at https://github.com/ocaml/opam-repository/issues to make sure it includes the gmp lib for nixos (or maybe just defaults to "gmp" for all undetected platforms?) might help
<apache2> LIBRARY_PATH? or LD_LIBRARY_PATH?
<apache2> afaict zarith will fail to detect gmp if it can't find gmp.h OR if itcan't link against a library called gmp, ie -lgmp
<tg> the former is what opam seems to use, but same thing if i set the latter as well
<tg> in the libdir there's a libgmp.so
<apache2> try export CPPFLAGS='-I/path/to/that/folder/'
<apache2> and export LDFLAGS="$CPPFLAGS"
<apache2> then reinstalling zarith
<apache2> ah no
<apache2> LDFLAGS='-L/path/to/that/folder/'
<apache2> LIBRARY_PATH sounds correct to me, I think the CPPFLAGS was the missing thing which causes it to not find gmp.h, which makes it try mpir. but i have no idea.
<apache2> mpir being broken on nix seems like a separate issue, if we can make zarith use libgmp we can hopefully avoid having to deal with that problem tonight :)
<apache2> tg: is your gmp.h in that folder?
<tg> well it finds gmp.h but not libgmp
<tg> also tried LDFLAGS
<tg> where is this gmp detection code?
<apache2> in `configure` in the zarith repo
<apache2> opam source zarith
<apache2> ccinc="$CPPFLAGS"
<apache2> cclib="$LDFLAGS"
<apache2> it defines checkinc() that looks for the .h file (ccinc aka CPPFLAGS) and checklib() that tries to link with a given library (cclib aka LDFLAGS)
<apache2> look for the comment that says: # check GMP, MPIR
<apache2> maybe try running that manually and see what happens
<apache2> I get:
<apache2> include gmp.h: found
<apache2> library gmp: found
<tg> i get found + not found
<tg> ah, now it worked
<apache2> what did you change?
<tg> actually it didn't i just misread the line and didnt notice the "not" :)
<apache2> cool so it didn't find the gmp library, but it found gmp.h ?
<apache2> env | fgrep LDFLAGS
<apache2> ?
<tg> argh, it was this sandbox path issue
<tg> OPAM_USER_PATH_RO did not contain all the required nix dirs
<tg> it's a nix bug, they use a wrapper to set this path but incorrectly apparently
<apache2> did you get it working?
<apache2> If you have energy for it, I think submitting a issue/patch to conf-gmp at the opam issues repo to make conf-gmp actually depend on gmp for nixos would be good
<apache2> it sounds like you happen to have gmp installed already?
<tg> yes it works now
<apache2> \o/
<tg> well, it seems there might be some other issue as well, because only one of the libdirs i tried was not in the sandbox, it should've found the other one..
<apache2> o, the joys of running research prototypes in production :)
zkms has quit [Quit: WeeChat 2.3]
zkms has joined #mirage
<tg> anyway.
<tg> i'll report the path & mpir issue to nix then
zkms has quit [Client Quit]
<tg> as for conf-gmp, i wonder if there's any nix support for depexts?
<tg> found some lines mentioning "nixos"
<tg> in the opam repo, so seems there is
zkms has joined #mirage
zkms has quit [Client Quit]
zkms has joined #mirage
<apache2> cool :)
zkms has quit [Quit: zkms]
<tg> ok updated that issue with links to the other issues :)
<tg> apache2: thanks for the help