Hi!
ML doesn't include the full stdlib. There are multiple reasons for this, but one is that DryOS already has a stdlib, so we can use that in some cases and avoid having to package our own. Your module requests (via imports) functions that magiclantern does not provide as exports. You can fix this in various ways, some easier than others.
We provide malloc() via a macro in src/mem.h. If you include that header in your libsodium module it should fix that problem. That will get you free() as well. You'll be able to do similar with some of the other calls.
Some you'll need to modify the library. We don't provide explicit_bzero(), for example, but we do provide bzero32() - probably this is good enough for your needs. Change libsodium to use bzero32(), if you agree with me; I don't know exactly what you're doing so only you can really tell. File ops are normally prefixed with FIO_ in DryOS, so we have FIO_ReadFile() that *probably* does something similar to read(), but you'll need to check the semantics are the same before modifying libsodium.
Fcntl may be a bigger problem. This is POSIX I think. DryOS is not POSIX and probably doesn't support fcntl. I suspect you'll need to work out how to remove usage from libsodium (or maybe they have a non-POSIX variant for embedded usage?).
The compiled size of libsodium is relatively large, larger than ML itself. You may find this is too large to load into memory on the cam. Since you probably don't need or want to support every option available, you might want to cut down the library so it only supports the crypto that you've chosen to use.
You can test these things in Qemu, hopefully you are doing this already. It's faster and safer than using a physical cam!