In (see the note "MISSING"):
int secp256k1_ecdsa_sign(const unsigned char *msg32, unsigned char *signature, int *signaturelen, const unsigned char *seckey, const unsigned char *nonce) {
..... if (ret) { ret = secp256k1_ecdsa_sig_sign(&sig, &sec, &msg, &non, NULL); } if (ret) { // MISSING "ret = " secp256k1_ecdsa_sig_serialize(signature, signaturelen, &sig); } ... return ret; }