Add clang-tidy support for the OPK Linux port

Bug: 256230932
Change-Id: I4f46e285376101ff129c1fca5c80a259c70cc0c7
This commit is contained in:
Ian Benz
2023-04-04 15:38:26 +00:00
committed by Robert Shih
parent 44e21cb9c2
commit b9d857649e
10 changed files with 27 additions and 38 deletions

View File

@@ -207,7 +207,9 @@ OEMCryptoResult OemCertificate::GetPublicCertificate(
return OEMCrypto_ERROR_SHORT_BUFFER;
}
*public_cert_length = cert_data.size();
memcpy(public_cert, cert_data.data(), cert_data.size());
if (public_cert != nullptr) {
memcpy(public_cert, cert_data.data(), cert_data.size());
}
return OEMCrypto_SUCCESS;
}

View File

@@ -92,7 +92,7 @@ bool ParseRsaPrivateKeyInfo(const uint8_t* buffer, size_t length,
}
ScopedBio bio;
// Check allowed scheme type.
if (!memcmp("SIGN", buffer, 4)) {
if (memcmp("SIGN", buffer, 4) == 0) {
uint32_t allowed_schemes_bno;
memcpy(&allowed_schemes_bno, reinterpret_cast<const uint8_t*>(&buffer[4]),
4);
@@ -811,7 +811,9 @@ OEMCryptoResult RsaPublicKey::EncryptOaep(const uint8_t* message,
return OEMCrypto_ERROR_SHORT_BUFFER;
}
*enc_message_length = enc_size;
memcpy(enc_message, encrypt_buffer.data(), enc_size);
if (enc_message != nullptr) {
memcpy(enc_message, encrypt_buffer.data(), enc_size);
}
return OEMCrypto_SUCCESS;
}