@reaperhulk You never use the result of buflen. I am not entirely certain that DSA_size will always get this right and for ECDSA it's documented as the maximum signature size for the key.