make nif thread-safe even on platforms lacking crypto_r function (e.g. freebsd)
library dependencies tested and restored
Merge pull request #2 from snar/nif_locking

Nif locking: thread-safety on platforms lacking crypt_r