Importing C libraries
Posted: Tue May 12, 2009 4:02 am
I need to use the SHA1 function in libssl.so. The function has the following syntax:
With the explanation
SHA1() computes the SHA-1 message digest of the n bytes at d and places it in md (which must have space for SHA_DIGEST_LENGTH == 20 bytes of output). If md is NULL, the digest is placed in a static array.
So I was like okay, well I can't find a newLisp NULL, but I think nil should do it...
Tried
Which crashes with a segfault if I try to do that again.
So then I was like, okay, maybe I can store it in a variable:
And reading *resultant* gives me
Interesting. Anything else gives me segmentation faults. How can I get these two languages to work with each other, or is the answer "write a glue library"?
Code: Select all
unsigned char *SHA1(const unsigned char *d, unsigned long n,
unsigned char *md);
SHA1() computes the SHA-1 message digest of the n bytes at d and places it in md (which must have space for SHA_DIGEST_LENGTH == 20 bytes of output). If md is NULL, the digest is placed in a static array.
So I was like okay, well I can't find a newLisp NULL, but I think nil should do it...
Tried
Code: Select all
(SHA1 etc (length etc) nil)
So then I was like, okay, maybe I can store it in a variable:
Code: Select all
(SHA1 etc (length etc) *resultant*)
Code: Select all
?