diff options
author | Eran Messeri <eranm@google.com> | 2017-12-28 21:19:50 +0000 |
---|---|---|
committer | Eran Messeri <eranm@google.com> | 2017-12-28 22:14:52 +0000 |
commit | abaf4d88d8ef3061de05da7034fc28b2ba880e71 (patch) | |
tree | 2f63fb722e4499042119e75ad0eea642657368bf /keystore/include | |
parent | cb9267dc53cb715c09ef276562dbe88b0d999a8d (diff) | |
download | security-abaf4d88d8ef3061de05da7034fc28b2ba880e71.tar.gz |
Fix version code handling in attestation records
The version code is one of the fields included in the attestationApplicationId field
of the attestation record (tag 709).
It was converted to a 64-bit integer (returned by getLongVersionCode) in
Change-ID Ibfffe235bbfcf358b3741abd3f7197fdb063d3f3.
This broke the KeyAttestation test as the Signature array size (the 4 bytes
read after the 4 bytes that used to be the int32 indicating version code)
gets incorrectly read as zero, causing the omission of any signature info
in the attestation record produced.
This fixes the broken functionality by changing the field type in the native
code to int64_t, and the integer value in the attestation record to match.
Bug: 71021326
Test: runtest --path cts/tests/tests/keystore/src/android/keystore/cts/KeyAttestationTest.java
Change-Id: I5fe53eb75b544f307c0f419029735ca22fe2b595
Diffstat (limited to 'keystore/include')
-rw-r--r-- | keystore/include/keystore/KeyAttestationPackageInfo.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/keystore/include/keystore/KeyAttestationPackageInfo.h b/keystore/include/keystore/KeyAttestationPackageInfo.h index efc33a6d..92d48632 100644 --- a/keystore/include/keystore/KeyAttestationPackageInfo.h +++ b/keystore/include/keystore/KeyAttestationPackageInfo.h @@ -37,22 +37,22 @@ class KeyAttestationPackageInfo : public Parcelable { SignaturesVector; typedef std::shared_ptr<SignaturesVector> SharedSignaturesVector; - KeyAttestationPackageInfo( - const String16& packageName, int32_t versionCode, SharedSignaturesVector signatures); + KeyAttestationPackageInfo(const String16& packageName, int64_t versionCode, + SharedSignaturesVector signatures); KeyAttestationPackageInfo(); status_t writeToParcel(Parcel*) const override; status_t readFromParcel(const Parcel* parcel) override; const std::unique_ptr<String16>& package_name() const { return packageName_; } - int32_t version_code() const { return versionCode_; } + int64_t version_code() const { return versionCode_; } ConstSignatureIterator sigs_begin() const { return ConstSignatureIterator(signatures_); } ConstSignatureIterator sigs_end() const { return ConstSignatureIterator(); } private: std::unique_ptr<String16> packageName_; - int32_t versionCode_; + int64_t versionCode_; SharedSignaturesVector signatures_; }; |