I don't see the problem? It returns 0, and then in the buffers it returns the signed message.

I also don't see how returning something other than 0 would cause a crash.