-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Description
trying to wrap secp256k1 in lisp and I am getting this message when trying to derive a public child key of a public parent key.
my code looks something like this(I have used cl-autowrap, have not given everthing nice names yet)
(with-context (ctx secp256k1.ffi:+secp256k1-context-sign+)
(secp256k1.ffi:secp256k1-context-set-illegal-callback ctx
(autowrap:callback 'illegal-callback)
'nil)
(autowrap:with-many-alloc ((pubkey 'secp256k1.ffi:secp256k1-pubkey)
(serialized ':unsigned-char 65)
(size-serialized ':unsigned-long 1))
(unless (secp256k1.ffi:secp256k1-ec-pubkey-parse ctx pubkey key_ (length key))
(error "when parsing pubkey"))
(unless (secp256k1.ffi:secp256k1-ec-pubkey-tweak-add ctx pubkey hash_)
(error "error when tweaking pubkey"))
(setf (autowrap:c-aref size-serialized 0 :unsigned-long) 65)
(unless (secp256k1.ffi:secp256k1-ec-pubkey-serialize ctx
serialized
size-serialized
pubkey
secp256k1.ffi:+secp256k1-ec-compressed+)
(error "could not serialize new public key"))
(values (cffi:foreign-array-to-lisp serialized `(:array :unsigned-char
,(autowrap:c-aref size-serialized
0
:unsigned-long)))
(subseq hash 32 64))))
i get the call to my illegal-callback after the call to tweak-add function and before the call to the ec-pubkey-serialize.
Questions:
what does this message mean? do i need to configure the context in some specific way? do I need to have a scratch-space set up? i have tried with one.
I am running my lisp code in SBCL.
Metadata
Metadata
Assignees
Labels
No labels