Commit graph

39 commits

Author SHA1 Message Date
Robert Shih
6c3e15b8ac rkp_factory_extraction_tool: log description when binder fails
Service specific error will be part of the description if applicable.

Bug: 312671886
Test: adb shell rkp_factory_extraction_tool
Change-Id: I071cf8bd892c3731de052dafb69a7d2029bf8b03
2023-12-18 20:09:14 -08:00
chuanchuan.gao
8ef6d1a6be Add parameter for serial number property to rkp tool
[Description]
1.Add patch to modify rkp_factory_extraction_tool, so
 that it can meet TV customer's factory product line.
2.Introduce a new input parameter, serialno_prop,
to the function jsonEncodeCsrWithBuild.
3.Use the new property of serialno_prop if it is set,
otherwise defaults to "ro.serialno".

Test:
1.build pass
2.AC on/off pass
3.run "rkp_factory_extraction_tool
--output_format build+csr
--serialno_prop $(customer_prop) > csr.json" pass
4.run "rkp_factory_extraction_tool
--output_format build+csr > csr.json" pass
5.VtsHalRemotelyProvisionedComponentTargetTest pass
6.libkeymint_remote_prov_support_test pass
7.VtsAidlKeyMintTargetTest pass

Bug: 313811996
Change-Id: I261f7ae1b3b4c3e2776ec4013c77b7be355477cf
2023-12-07 18:21:15 +08:00
Vikram Gaur
016d24c813 Skip test case for AVF since those are not supported.
BUG: 308586759
Test: atest librkp_support_test
Change-Id: Iba47f0cc4284fa684e4e72667e9e553841087475
2023-11-15 00:01:17 +00:00
Seth Moore
891d4c5741 Revert "Static link libcrypto into rkp_factory_extraction_tool"
Revert submission 2706393-static-link-hwtrust

Reason for revert: This seems to be causing CFI failures.

Reverted changes: /q/submissionid:2706393-static-link-hwtrust

Change-Id: I5b301341ee869ace00a1314e65fbdc5e34863b64
2023-11-08 19:42:48 +00:00
Seth Moore
9b0fb4573a Static link libcrypto into rkp_factory_extraction_tool
We publish a prebuilt rkp_factory_extraction_tool online, so we should
only dynamically load the libraries that we cannot avoid (e.g. libdl)

Test: built and ran tool
Change-Id: Id109e12dde841797169f0a4e54fa2ede558da252
2023-08-11 13:34:39 -07:00
Seth Moore
ab493724db Move rkp_factory_extraction_tool dist dir to "rkp"
We will be publishing more tools for partners, and they should live
together. With that in mind, move the rkp_factory_extraction_tool dist
to "rkp/" instead of "rkp_factory_extraction_tool/".

Test: Built it
Change-Id: Ic86fe555a75dfe12a4cae1b4be48c33bae95ecbb
2023-08-02 13:00:53 -07:00
Robert Shih
d3c1f7c202 rkp_factory_extraction_tool: append drm CSRs
Bug: 286556950
Test: rkp_factory_extraction_tool
Change-Id: I9fe2898c53012c6cd640e4504ca4d882481ea2a9
2023-07-12 15:55:13 -07:00
Robert Shih
5b2d983609 Export rkp_factory_extraction_tool on ci
Bug: 288957546
Test: TreeHugger
Change-Id: I1ef20e1e89dbec6d9b4807652b9fd8e009903aaf
2023-06-29 19:18:40 +00:00
Seth Moore
dff09d0b47 Enable self-testing by default in rkp factory tool
This way, we run the self test when extracting a CSR on the factory
line by default. This will ensure that devices producing bad payloads
will be more likely to be caught earlier in the manufacturing flow.

Test: ran tool devices with V2 and V3 HALs
Bug: 284098419
Change-Id: I79b50da7f86da50ebcfe18caf06046f1a39c6e81
2023-05-31 10:37:55 -07:00
Devin Moore
b3ccacb208 Remove libvintf from credstore
This library is expensive and getting info from it should be delegated
to service manager.

Test: showmap $(pidof credstore) # before and after
Bug: 280829178
Change-Id: I26524e2c519a869b4cd5bd44b16f92cc8e29f50d
2023-05-24 18:31:22 +00:00
Andrew Scull
d7f7a9872f Delete unused IProvisionerService interface
Remove the obsolete and unused IProvisionerService AIDL interface.

Test: TH
Change-Id: I1c7a159bbeb9d56c4740ee2ce9052ebbda891572
2023-05-05 06:18:11 +00:00
Tri Vo
180cf9d109 Merge changes I0049d5ba,I28ebc5a2
* changes:
  identity: Replace RemotelyProvisionedKey with librkp_support
  Add helper library to get remotely provisioned key
2023-03-10 01:34:15 +00:00
Seth Moore
7fc83abf6e Fix CSR format for RKPv3
The data format changed a bit, and the fingerprint needs to be included
at the end of the CSRv3 data. Make sure to include that, else the RKP
server rejects the payload.

Test: run tool + upload output
Test: rkp_factory_extraction_lib_test
Change-Id: I5a13b21e65c64f19b9417a7d1e169710867e7a8f
2023-03-10 00:57:31 +00:00
Tri Vo
a9ebcd24e1 Add helper library to get remotely provisioned key
The code is mostly from credstore. The intention here is that we replace
that code with a common library.

Test: librkp_support_test
Change-Id: I28ebc5a253c037277dad6d39b761b4e8aa4347e8
2023-03-09 16:09:03 -08:00
Jerome Gaillard
b66eb7acb6 Merge "Revert "Change extraction tool to vendor_available"" 2022-11-18 22:24:53 +00:00
Jerome Gaillard
b6afaffa84 Revert "Change extraction tool to vendor_available"
This reverts commit 6de73ed814.

Reason for revert: Broken target in internal master branch

Bug: 259617955
Change-Id: I357d75a62895677f508bd60ffc00c059d3353889
2022-11-18 16:32:17 +00:00
Treehugger Robot
d839925a9d Merge "Change extraction tool to vendor_available" 2022-11-17 19:33:29 +00:00
Max Bires
6de73ed814 Change extraction tool to vendor_available
Remove the vendor entry in Android.bp and replace it with a
vendor_available=true clause. This will allow OEMs building devices with
a newer system image but older vendor to still incorporate the latest
changes to the tool.

Bug: 253979894
Test: Image builds
Change-Id: I4995ffef26a037fa27514383f8c32c37e1ffe087
2022-11-11 14:49:07 -08:00
Seth Moore
cd6e918fbd Add dependencies on newly-split RKP HAL
Bug: 254112961
Test: vts_treble_vintf_vendor_test
Merged-In: I5506757aaebdf37d42bf7ac0a68e83f2d3c12049
Change-Id: I5506757aaebdf37d42bf7ac0a68e83f2d3c12049
2022-11-09 10:52:39 -08:00
Tri Vo
ee773a25a9 rkp_factory_extraction_tool: Add support for IRPC v3
Bug: 235265072
Test: rkp_factory_extraction_tool -self_test
Change-Id: Ie776411a32d446b53cb3dfe73a24f60e1eab6506
2022-10-27 10:34:58 -07:00
Seth Moore
047567847c Add self test to rkp_factory_extraction_tool
Self test mode gets a test CSR and validates it.

Test: rkp_factory_extraction_tool --self_test
Test: atest VtsHalRemotelyProvisionedComponentTargetTest
Bug: 239839050
Change-Id: Ib4b0221ffcf56b60ded1ac2a1f85eddb77729cbf
2022-09-16 16:05:09 -07:00
Seth Moore
b84a1fb6c5 rkp_factory_extraction_tool now validates DeviceInfo
This way, partners doing testing can see if they are getting bad device
info before they try to upload it to the backend.

This also acts as a check on the factory line, in case a device is
misprovisioned or defective, it can be discoverd earlier in the
manufacturing process (as CSRs tend to be uploaded at the very end).

Test: atest VtsHalRemotelyProvisionedComponentTargetTest
Test: rkp_factory_extraction_tool
Bug: 239838563
Change-Id: I8da97a9740cccb3263d21b07ba9d678513a337c8
2022-09-15 16:06:27 -07:00
Seth Moore
708da93266 Split rkp_factory_extraction_tool into a library + binary
This way, we can unit test the library in preparation for up-coming
changes that will verify the outputs. This will serve as an extra
layer of checking for factory lines, where they want to be extra
sure that a device is outputing correct information at various stages
of the pipe.

Bug: 239838563
Test: rkp_factory_extraction_lib_test
Change-Id: I018194673820d2b31c18d30057aa533cb4fe090e
2022-08-29 13:50:58 -07:00
Tommy Chiu
ce82be8efc rkp_factory_extraction_tool: Add instance name in the JSON output
Since we maybe have more than 1 RKP instances on the device, add the
instance name in JSON for better visibility.

Bug: 223509807
Test: libkeymint_remote_prov_support_test

Change-Id: I1657ecb3abba886f2f7682997e72e428f3d6993e
2022-03-10 12:20:21 +08:00
Max Bires
d0f7b356ba Modifying extraction tool to support P256.
This change alters the behavior of the factory extraction tool to query
the underlying IRPC HAL implementation for which ECC curve it supports.
The tool then chooses the correct corresponding production EEK chain
based on that to pass back into the HAL implementation for CSR
generation.

Bug: 215445120
Test: run the extraction tool
Change-Id: Ic80e38ec4c30eff970926ed269693ee1167b168c
2022-03-01 19:43:36 -08:00
Keith Mok
b9462c13bb Fix EINTR received in getrandom
When EINTR received in getrandom,
we should just continue the loop

Bug: 206003134
Test: Manual
Change-Id: Ibdf8050d272ca85355d40b4770b97bad3b9da82c
2021-11-12 22:42:53 +00:00
Jiyong Park
2624b3c19b Merge "Remove ndk_platform backend. Use the ndk backend." 2021-08-03 11:18:25 +00:00
Seth Moore
9a4bc972c0 Print device keys in test mode
When using the rkp_factory_extraction_tool in test mode, a fake device
key is generated on the fly. This makes verifying the output difficult
as the key is permanently lost.

In test mode, print out the generated keys so that we can test if the
output data is good or not.

Test: Manually tested against backend service tooling not in AOSP
Change-Id: Ibc30044c03f5107990da6d3a03b17aa652d4b1bc
2021-07-27 11:19:46 -07:00
Jiyong Park
0d61dd6c3a Remove ndk_platform backend. Use the ndk backend.
The ndk_platform backend will soon be deprecated because the ndk backend
can serve the same purpose. This is to eliminate the confusion about
having two variants (ndk and ndk_platform) for the same 'ndk' backend.

Bug: 161456198
Test: m
Change-Id: Ibeb4178f99857be75bb5f83a073a2d679058d921
2021-07-27 12:20:26 +09:00
Seth Moore
9ea08f23c2 Fix ill-formed certificate request
1. The MAC tag value was not being included in the uploaded data, so
   it was previosly impossible to verify the keys to sign mac.
2. The device info is supposed to be an array with [Verified,
   Unverified] info. It was previously just the verified info.

Test: Manual. Uploaded sample data to device info service.
Change-Id: I096bc5ded0b38fc56864e75c5e06dfbef62e9a74
Bug: 194492359
2021-07-23 15:48:49 +00:00
Seth Moore
591462547f Optimize dependencies in rkp_factory_extraction_tool
The binary depended on a number of shared libs, but now uses static
linking where possible.

Stop linking to libvintf, which may not be available in a factory
image (it's not vendor-available).

Mark rkp_factory_extraction_tool as a vendor binary, allowing it to
be included in factory images.

Bug: 191301285
Test: Manually run tool on device
Change-Id: I1747f809ffd2d3d605c9f4ee81e9f40cc3a189c4
2021-07-02 10:30:16 -07:00
Seth Moore
e44aad2e67 Add JSON output to the RKP factory tool
The JSON format is suitable for uploading as test data. It also
includes the build fingerprint, which is required by the backend
to associate the CSR with a particular device family.

Bug: 191301285
Test: Manually run the tool with various --output_format flags
Change-Id: I1d787271c52a25df2d16a6d88dd7b278407ff4b7
Merged-In: I1d787271c52a25df2d16a6d88dd7b278407ff4b7
2021-07-01 10:18:42 -07:00
Seth Moore
5a40fa7e78 Generate random challenge in RKP factory tool
The challenge was previously hard-coded to an empty string previously.
Though it's not necessarily required for remote key provisioning
certificate signing requests, go ahead and include good randomness
(via getrandom) into the csr.

Bug: 191301285
Test: Manually run rkp_factory_extraction_tool
Change-Id: I68e7d86259c67d40ecbb0c9e4ecac22954757dd3
Merged-In: I68e7d86259c67d40ecbb0c9e4ecac22954757dd3
2021-06-25 10:47:34 -07:00
Seth Moore
01688560f9 Add prod GEEK to rkp_factory_extraction_tool
The production Google Endpoint Encryption Key has been generated, so
include it in the tooling that is used at the factory to encrypt the
Boot Certificate Chain.

Keep test mode support around, gating it behind a flag.

Test: librkp_factory_extraction_test
Bug: 191301285
Change-Id: I62d6251610aab10b91661eda3ae801f1bb6ff5dc
Merged-In: I62d6251610aab10b91661eda3ae801f1bb6ff5dc
2021-06-25 10:47:18 -07:00
Seth Moore
6dfb02a3f9 Remove duplicate generateEekChain routine
Reduce duplicated code, hooray. Also, we'll be adding the real EEK to
the support library, so prepare for that by linking it now.

Bug: 191301285
Test: Manually run rkp_factory_extraction_tool
Change-Id: I7e1695e3a512be01e24f681aa0a369d3482ad383
Merged-In: I7e1695e3a512be01e24f681aa0a369d3482ad383
2021-06-25 10:46:56 -07:00
Seth Moore
7c05fd841e Remove provisioner_cli tool
This tool has been made obsolete by rkp_factory_extraction_tool

Test: n/a -- nothing uses this tool
Change-Id: Ic15ff9e526809dd7dae0d9f17b79fd7ff87f61c7
2021-06-16 15:13:00 -07:00
Max Bires
f60987eab4 Adding the factory extraction binary
This binary gets added to the system image under
/bin/rkp_factory_extraction_tool. The purpose of this tool is to query
every IRemotelyProvisionedComponent interface in the device manifest and
print out a CertificateRequest to stdout for each interface.

The CertificateRequest will contain no keys to sign and a semantically
useless challenge, since this tool is just for key upload. The items of
value will be the DeviceInfo CBOR blob which will get associated with
the encrypted device public key once it is uploaded to the backing
servers and decrypted.

The tool will fail if it is unable to successfully query an
IRemotelyProvisionedComponent interface that is specified in the device
manifest file.

Test: Build and run
Change-Id: Ia82787749be5963567019f6523075100208aa101
2021-04-20 17:05:39 -07:00
Bob Badour
4c7858c848 [LSC] Add LOCAL_LICENSE_KINDS to system/security
Added SPDX-license-identifier-Apache-2.0 to:
  fsverity_init/Android.bp
  identity/Android.bp
  keystore/tests/Android.bp
  keystore2/Android.bp
  keystore2/aaid/Android.bp
  keystore2/aidl/Android.bp
  keystore2/apc_compat/Android.bp
  keystore2/selinux/Android.bp
  keystore2/src/crypto/Android.bp
  keystore2/src/km_compat/Android.bp
  ondevice-signing/Android.bp
  provisioner/Android.bp

Added SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD to:
  Android.bp
  keystore/Android.bp

Added SPDX-license-identifier-BSD to:
  keystore-engine/Android.bp

Bug: 68860345
Bug: 151177513
Bug: 151953481

Test: m all

Exempt-From-Owner-Approval: janitorial work
Change-Id: Ic9e19695bd19c3f127dfd545df60e4c9df89af77
2021-02-14 10:37:25 -08:00
Wedson Almeida Filho
ba42dac790 Add provisioner CLI and its interface.
Change-Id: If7682c037232844568ba88a0ed38e26924e1c10e
2020-11-12 15:21:12 +00:00