x509: Correctly use a signed integer so errors can be checked.