keystone2: Fix check of i2d_re_X509_tbs call
We store the result of our call to i2d_re_X509_tbs() in a signed
variable, so our check for negative error values will work.
Test: TreeHugger
Change-Id: I8824c1c703d9c1d238004f9e5ee7f46a9ae2ddce
diff --git a/keystore2/src/crypto/certificate_utils.cpp b/keystore2/src/crypto/certificate_utils.cpp
index 56dd3f4..500600f 100644
--- a/keystore2/src/crypto/certificate_utils.cpp
+++ b/keystore2/src/crypto/certificate_utils.cpp
@@ -537,7 +537,7 @@
}
uint8_t* cert_buf = nullptr;
- size_t buf_len = i2d_re_X509_tbs(certificate, &cert_buf);
+ int buf_len = i2d_re_X509_tbs(certificate, &cert_buf);
if (buf_len < 0) {
return CertUtilsError::Encoding;
}