Add a kind of hacky Frankenstein C version of doing the validation

This is based on bits of code I had lying around from other projects. It can probably be cleaned up and made much more canonical - I'm very out of practice with C so someone is likely to vomit from how bad this is (especially since it's gratuitously not C89).




I'm pretty sure I should malloc a return string and then memcopy output to that before doing BIO_free_all