[cl-plus-ssl-devel] naming RAND_bytes wrapper
Anton Vodonosov
avodonosov at yandex.ru
Sun May 8 00:20:35 UTC 2011
Hello.
In another project I need a secure random number generator, and I want to use OpenSSL's
random number generator. There will be lower layer function - an FFI binding for the RAND_bytes,
and a lispy wrapper. I am not sure how should I name the wrapper.
Here is RAND_bytes:
int RAND_bytes(unsigned char *buf, int num);
(cffi:defcfun ("RAND_bytes" rand-bytes)
:int
(buf :pointer)
(num :int))
It's interface is not lipsy. It will require to provide an FFI buffer,
and to analyze the return code.
It's better to have something like:
(random-bytes count)
;; Returns a SIMPLE-ARRAY with size == COUNT
;; and element type (UNSIGNED-BYTE 8).
;; Signals an ERROR in case of any problems.
The same will apply any other function we would want to export from cl+ssl.
There will be a lower level FFI binding and a lispy counterpart.
I am not sure what naming convention to use:
(original -> FFI binding -> lispy version)
1. RAND_bytes -> rand-bytes -> rand-bytes-lispy
2. RAND_bytes -> cl+ssl-ffi:rand-bytes -> cl+ssl:rand-bytes (use separate package for the low level bindings)
3. RAND_bytes -> rand-bytes -> random-bytes (i.e. for every new function make this decision every time, and joose some similar, but different name from the low-level bindind)
Any suggestions are appreciated.
Best regards,
- Anton
More information about the cl-plus-ssl-devel
mailing list