lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Sorry to take so long to answer...

> So, the first question I have is: do you folks plan to use a
> kernel-provided randomness source like 'arc4random()' (under
> *BSD) or 'getrandom()' (under Linux)?

No. As already discussed in the list, these functions are quite new
and non portable.


> The second question is: would you approve if FreeBSD package of
> Lua was to patch 'luai_makeseed' into 'arc4random()'? I'm asking
> this because I've been using such a patch locally for a while,
> but FreeBSD Lua maintainers would like your approval before
> adding it to the ports collection.

Sure. But I would implement them a little differently:

1) The best option seems to be Daurnimator's suggestion. I guess you
could solve the problem with the include like this:

    -D__BSD_VISIBLE  -DLUA_USER_H='<stdlib.h>'  \
    -D'luai_makeseed()=cast(unsigned int, arc4random())'

2) Otherwise, you could put your patch in luaconf.h, which has a place
specifically for them:

 /*
 ** Local configuration. You can use this space to add your redefinitions
 ** without modifying the main part of the file.
 */
 
+/* Explain your changes here */
+#if defined(LUA_CORE)
+
+#define __BSD_VISIBLE          1
+#include <stdlib.h>
+#define luai_makeseed()                cast(unsigned int, arc4random())
+
+#endif


-- Roberto