while true do
      nonce = FFI::MemoryPointer.new(:uchar, 32)
      nonce.put_bytes(0, SecureRandom.random_bytes(32))
      break if secp256k1_ecdsa_sign(data_buf, data.bytesize, sig_buf, sig_size, priv_key, nonce)