On Tue, Jun 10, 2014 at 11:38 AM, Niels Möller <[email protected]> wrote:

> Aapo Talvensaari <[email protected]> writes:
>
> > sometimes return longer dst than what was requested. See:
> >
> >
> https://github.com/bungle/lua-resty-nettle/blob/master/lib/resty/nettle/pbkdf2.lua#L21
> >
> > I had to put ":sub(1, len)" to overcome that.
>
> How does ffi_str work? You're aware that the output is binary data, with
> no NUL-termination?
>

:-). It was a bug in my code. I have fixed it now (I had used this function
in many places correctly but here I happened to get it wrong).

ffi.string (ffi_str) is defined as follows:
str = ffi.string(ptr [,len])

If the optional argument len is missing, ptr is converted to a "char *" and
the data is assumed to be zero-terminated. The length of the string is
computed with strlen().

Thanks for getting me back on a right track.


Regards
Aapo
_______________________________________________
nettle-bugs mailing list
[email protected]
http://lists.lysator.liu.se/mailman/listinfo/nettle-bugs

Reply via email to