android_packages_modules_Vi.../microdroid/signature
Jooyung Han 9195c7dd01 Add lib_microdroid_signature_proto with proto-full
This is used by apexd, which is already using proto-full for other proto
files.

Ignore-AOSP-First: The changes of system/apex need to avoid in S

Bug: 184605708
Bug: 181093750
Test: atest MicrodroidTestCase
Merged-In: I341544fdf318c6cae22f643b6c2904def0919f74
Change-Id: I341544fdf318c6cae22f643b6c2904def0919f74
(cherry picked from commit 6fea593206)
2021-04-21 23:19:03 +09:00
..
include/microdroid Add an executable to create a microdroid signature 2021-04-14 23:23:58 +09:00
Android.bp Add lib_microdroid_signature_proto with proto-full 2021-04-21 23:19:03 +09:00
README.md Add an executable to create a microdroid signature 2021-04-14 23:23:58 +09:00
microdroid_signature.proto Add a proto for the microdroid signature partition 2021-04-14 21:27:52 +09:00
mk_microdroid_signature.cc Add an executable to create a microdroid signature 2021-04-14 23:23:58 +09:00
signature.cc Add an executable to create a microdroid signature 2021-04-14 23:23:58 +09:00

README.md

Microdroid Signature

Microdroid Signature contains the signatures of the payloads so that the payloads are verified inside the Guest OS.

  • APEX packages that are passed to microdroid should be listed in the Microroid Signature.

Format

Microdroid Signature is composed of header and body.

offset size description
0 4 Header. unsigned int32: body length(L) in big endian
4 L Body. A protobuf message. schema

How to Create

For testing purpose, use mk_microdroid_signature to create a Microdroid Signature.

$ cat signature_config.json
{
  "apexes": [
    {
      "name": "com.my.hello",
      "path": "hello.apex"
    }
  ]
}
$ adb push signature_config.json hello.apex /data/local/tmp/
$ adb shell 'cd /data/local/tmp; /apex/com.android.virt/bin/mk_microdroid_signature signature_config.json signature

Then, pass the signature as the first partition of the payload disk image.

$ cat payload_cdisk.json
{
  "partitions": [
    {
      "label": "signature",
      "path": "signature"
    },
    {
      "label": "com.my.hello",
      "path": "hello.apex"
    }
  ]
}
$ adb push payload_cdisk.json /data/local/tmp/
$ adb shell 'cd /data/local/tmp; /apex/com.android.virt/bin/mk_cdisk payload_cdisk.json payload.img
$ adb shell 'cd /data/local/tmp; /apex/com.android.virt/bin/crosvm .... --disk=payload.img'

In the future, VirtManager will handle these stuffs.