[x509] Parse certificate chain from RKPD into individual certificate

This cl also adjusts the order of the certificates to place the
leaf certificate at the beginning, ensuring consistency with the
certificate order from RKP.

The new test is added to busytown config at cl/584885373.

Bug: 309780089
Test: virtualizationservice_test
Change-Id: Ic3cfdd174483d0905d741c40fef730c652c078c4
diff --git a/vm_payload/include/vm_payload.h b/vm_payload/include/vm_payload.h
index 78cd80d..3483e1d 100644
--- a/vm_payload/include/vm_payload.h
+++ b/vm_payload/include/vm_payload.h
@@ -224,8 +224,8 @@
  * Gets the number of certificates in the certificate chain.
  *
  * The certificate chain consists of a sequence of DER-encoded X.509 certificates that form
- * the attestation key's certificate chain. It starts with a root certificate and ends with a
- * leaf certificate covering the attested public key.
+ * the attestation key's certificate chain. It starts with a leaf certificate covering the attested
+ * public key and ends with a root certificate.
  *
  * \param result A pointer to the attestation result obtained from `AVmPayload_requestAttestation`
  *               when the attestation succeeds.
@@ -240,8 +240,8 @@
  * attestation result.
  *
  * The certificate chain consists of a sequence of DER-encoded X.509 certificates that form
- * the attestation key's certificate chain. It starts with a root certificate and ends with a
- * leaf certificate covering the attested public key.
+ * the attestation key's certificate chain. It starts with a leaf certificate covering the attested
+ * public key and ends with a root certificate.
  *
  * \param result A pointer to the attestation result obtained from `AVmPayload_requestAttestation`
  *               when the attestation succeeds.