Janis Danisevskis | aaba4af | 2021-11-18 14:25:07 -0800 | [diff] [blame^] | 1 | // Copyright 2021, The Android Open Source Project |
| 2 | // |
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | // you may not use this file except in compliance with the License. |
| 5 | // You may obtain a copy of the License at |
| 6 | // |
| 7 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | // |
| 9 | // Unless required by applicable law or agreed to in writing, software |
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | // See the License for the specific language governing permissions and |
| 13 | // limitations under the License. |
| 14 | |
| 15 | //! This module provides `ResidentHal`, an implementation of a IDiceDevice HAL Interface. |
| 16 | //! While the name implies that the DICE secrets are memory resident, the residency |
| 17 | //! is augmented by the implementation of the traits `DiceArtifacts` and |
| 18 | //! `UpdatableDiceArtifacts`. The implementation outsources all operations that |
| 19 | //! involve the DICE secrets to a short lived child process. By implementing |
| 20 | //! `UpdatableDiceArtifacts` accordingly, integrators can limit the exposure of |
| 21 | //! the resident DICE secrets to user space memory. E.g., an implementation might only |
| 22 | //! hold a path to a securefs file allowing the child to read and update the kernel state |
| 23 | //! through this path directly. |
| 24 | //! |
| 25 | //! ## Important Safety Note. |
| 26 | //! The module is not safe to use in multi threaded processes. It uses fork and runs |
| 27 | //! code that is not async signal safe in the child. Implementing a HAL service without |
| 28 | //! starting a thread pool is safe, but no secondary thread must be created. |
| 29 | |
| 30 | use crate::error_vendor::map_or_log_err; |
| 31 | use android_hardware_security_dice::aidl::android::hardware::security::dice::{ |
| 32 | Bcc::Bcc, BccHandover::BccHandover, IDiceDevice::BnDiceDevice, IDiceDevice::IDiceDevice, |
| 33 | InputValues::InputValues as BinderInputValues, Signature::Signature, |
| 34 | }; |
| 35 | use anyhow::{Context, Result}; |
| 36 | use binder::public_api::{BinderFeatures, Result as BinderResult, Strong}; |
| 37 | use dice::{ContextImpl, OpenDiceCborContext}; |
| 38 | use diced_open_dice_cbor as dice; |
| 39 | use diced_utils as utils; |
| 40 | use nix::sys::wait::{waitpid, WaitStatus}; |
| 41 | use nix::unistd::{ |
| 42 | close, fork, pipe as nix_pipe, read as nix_read, write as nix_write, ForkResult, |
| 43 | }; |
| 44 | use serde::{de::DeserializeOwned, Deserialize, Serialize}; |
| 45 | use std::convert::TryInto; |
| 46 | use std::io::{Read, Write}; |
| 47 | use std::os::unix::io::RawFd; |
| 48 | use std::sync::{Arc, RwLock}; |
| 49 | use utils::ResidentArtifacts; |
| 50 | pub use utils::{DiceArtifacts, UpdatableDiceArtifacts}; |
| 51 | |
| 52 | /// PipeReader is a simple wrapper around raw pipe file descriptors. |
| 53 | /// It takes ownership of the file descriptor and closes it on drop. It provides `read_all`, which |
| 54 | /// reads from the pipe into an expending vector, until no more data can be read. |
| 55 | struct PipeReader(RawFd); |
| 56 | |
| 57 | impl Read for PipeReader { |
| 58 | fn read(&mut self, buf: &mut [u8]) -> std::io::Result<usize> { |
| 59 | let bytes = nix_read(self.0, buf)?; |
| 60 | Ok(bytes) |
| 61 | } |
| 62 | } |
| 63 | |
| 64 | impl Drop for PipeReader { |
| 65 | fn drop(&mut self) { |
| 66 | close(self.0).expect("Failed to close reader pipe fd."); |
| 67 | } |
| 68 | } |
| 69 | |
| 70 | /// PipeWriter is a simple wrapper around raw pipe file descriptors. |
| 71 | /// It takes ownership of the file descriptor and closes it on drop. It provides `write`, which |
| 72 | /// writes the given buffer into the pipe, returning the number of bytes written. |
| 73 | struct PipeWriter(RawFd); |
| 74 | |
| 75 | impl Write for PipeWriter { |
| 76 | fn write(&mut self, buf: &[u8]) -> std::io::Result<usize> { |
| 77 | let written = nix_write(self.0, buf)?; |
| 78 | Ok(written) |
| 79 | } |
| 80 | |
| 81 | fn flush(&mut self) -> std::io::Result<()> { |
| 82 | // Flush is a NO-OP. |
| 83 | Ok(()) |
| 84 | } |
| 85 | } |
| 86 | |
| 87 | impl Drop for PipeWriter { |
| 88 | fn drop(&mut self) { |
| 89 | close(self.0).expect("Failed to close writer pipe fd."); |
| 90 | } |
| 91 | } |
| 92 | |
| 93 | fn pipe() -> Result<(PipeReader, PipeWriter), nix::Error> { |
| 94 | let (read_fd, write_fd) = nix_pipe()?; |
| 95 | Ok((PipeReader(read_fd), PipeWriter(write_fd))) |
| 96 | } |
| 97 | |
| 98 | #[derive(Debug, Clone, Serialize, Deserialize, Eq, PartialEq, thiserror::Error)] |
| 99 | enum RunForkedError { |
| 100 | #[error("RunForkedError::String({0:?})")] |
| 101 | String(String), |
| 102 | } |
| 103 | |
| 104 | /// Run the given closure in a new process. |
| 105 | /// Safety: The function runs code that is not async-signal-safe in the child after forking. |
| 106 | /// This means, that this function must not be called by a multi threaded process. |
| 107 | fn run_forked<F, R>(f: F) -> Result<R> |
| 108 | where |
| 109 | R: Serialize + DeserializeOwned, |
| 110 | F: FnOnce() -> Result<R>, |
| 111 | { |
| 112 | let (reader, writer) = pipe().expect("Failed to create pipe."); |
| 113 | |
| 114 | match unsafe { fork() } { |
| 115 | Ok(ForkResult::Parent { child, .. }) => { |
| 116 | drop(writer); |
| 117 | let status = waitpid(child, None).expect("Failed while waiting for child."); |
| 118 | if let WaitStatus::Exited(_, 0) = status { |
| 119 | // Child exited successfully. |
| 120 | // Read the result from the pipe. |
| 121 | // Deserialize the result and return it. |
| 122 | let result: Result<R, RunForkedError> = |
| 123 | serde_cbor::from_reader(reader).expect("Failed to deserialize result."); |
| 124 | |
| 125 | result.context("In run_forked:") |
| 126 | } else { |
| 127 | panic!("Child did not exit as expected {:?}", status); |
| 128 | } |
| 129 | } |
| 130 | Ok(ForkResult::Child) => { |
| 131 | // Run the closure. |
| 132 | let result = f() |
| 133 | .map_err(|err| RunForkedError::String(format! {"Nested anyhow error {:?}", err})); |
| 134 | |
| 135 | // Serialize the result of the closure. |
| 136 | serde_cbor::to_writer(writer, &result).expect("Result serialization failed"); |
| 137 | |
| 138 | // Set exit status to `0`. |
| 139 | std::process::exit(0); |
| 140 | } |
| 141 | Err(errno) => { |
| 142 | panic!("Failed to fork: {:?}", errno); |
| 143 | } |
| 144 | } |
| 145 | } |
| 146 | |
| 147 | /// A DiceHal backend implementation. |
| 148 | /// All functions, except `demote`, derive effective dice artifacts starting from |
| 149 | /// this node and iterating through `input_values` in ascending order. |
| 150 | pub trait DiceHalImpl { |
| 151 | /// Signs the message using the effective dice artifacts and Ed25519Pure. |
| 152 | fn sign(&self, input_values: &[BinderInputValues], message: &[u8]) -> Result<Signature>; |
| 153 | /// Returns the effective attestation chain. |
| 154 | fn get_attestation_chain(&self, input_values: &[BinderInputValues]) -> Result<Bcc>; |
| 155 | /// Returns the effective dice artifacts. |
| 156 | fn derive(&self, input_values: &[BinderInputValues]) -> Result<BccHandover>; |
| 157 | /// This demotes the implementation itself. I.e. a resident node would replace its resident |
| 158 | /// artifacts with the effective artifacts derived using `input_values`. A proxy node would |
| 159 | /// simply call `demote` on its parent node. This is not reversible and changes |
| 160 | /// the effective dice artifacts of all clients. |
| 161 | fn demote(&self, input_values: &[BinderInputValues]) -> Result<()>; |
| 162 | } |
| 163 | |
| 164 | /// The ResidentHal implements a IDiceDevice backend with memory resident DICE secrets. |
| 165 | pub struct ResidentHal<T: UpdatableDiceArtifacts + Serialize + DeserializeOwned + Clone + Send> { |
| 166 | artifacts: RwLock<T>, |
| 167 | } |
| 168 | |
| 169 | impl<T: UpdatableDiceArtifacts + Serialize + DeserializeOwned + Clone + Send> ResidentHal<T> { |
| 170 | /// Creates a new Resident node with the given dice secrets and certificate chain. |
| 171 | /// ## Safety |
| 172 | /// It is not safe to use implementations of ResidentHal in multi threaded environments. |
| 173 | /// If using this library to implement a HAL service make sure not to start a thread pool. |
| 174 | pub unsafe fn new(artifacts: T) -> Result<Self> { |
| 175 | Ok(ResidentHal { artifacts: RwLock::new(artifacts) }) |
| 176 | } |
| 177 | |
| 178 | fn with_effective_artifacts<R, F>(&self, input_values: &[BinderInputValues], f: F) -> Result<R> |
| 179 | where |
| 180 | R: Serialize + DeserializeOwned, |
| 181 | F: FnOnce(ResidentArtifacts) -> Result<R>, |
| 182 | { |
| 183 | let artifacts = self.artifacts.read().unwrap().clone(); |
| 184 | |
| 185 | // Safety: run_forked must not be be called by a multi threaded process. |
| 186 | // This requirement is propagated to the public interface of this module through |
| 187 | // `ResidentHal::new` |
| 188 | run_forked(move || { |
| 189 | let artifacts = artifacts.with_artifacts(|a| ResidentArtifacts::new_from(a))?; |
| 190 | let input_values: Vec<utils::InputValues> = |
| 191 | input_values.iter().map(|v| v.try_into()).collect::<Result<_>>()?; |
| 192 | let artifacts = artifacts |
| 193 | .execute_steps(input_values.iter().map(|v| v as &dyn dice::InputValues)) |
| 194 | .context("In ResidentHal::get_effective_artifacts:")?; |
| 195 | f(artifacts) |
| 196 | }) |
| 197 | } |
| 198 | } |
| 199 | |
| 200 | impl<T: UpdatableDiceArtifacts + Serialize + DeserializeOwned + Clone + Send> DiceHalImpl |
| 201 | for ResidentHal<T> |
| 202 | { |
| 203 | fn sign(&self, input_values: &[BinderInputValues], message: &[u8]) -> Result<Signature> { |
| 204 | let signature: Vec<u8> = self |
| 205 | .with_effective_artifacts(input_values, |artifacts| { |
| 206 | let (cdi_attest, _, _) = artifacts.into_tuple(); |
| 207 | let mut dice = OpenDiceCborContext::new(); |
| 208 | let seed = dice |
| 209 | .derive_cdi_private_key_seed(cdi_attest[..].try_into().with_context(|| { |
| 210 | format!( |
| 211 | "In ResidentHal::sign: Failed to convert cdi_attest (length: {}).", |
| 212 | cdi_attest.len() |
| 213 | ) |
| 214 | })?) |
| 215 | .context("In ResidentHal::sign: Failed to derive seed from cdi_attest.")?; |
| 216 | let (_public_key, private_key) = dice |
| 217 | .keypair_from_seed(seed[..].try_into().with_context(|| { |
| 218 | format!( |
| 219 | "In ResidentHal::sign: Failed to convert seed (length: {}).", |
| 220 | seed.len() |
| 221 | ) |
| 222 | })?) |
| 223 | .context("In ResidentHal::sign: Failed to derive keypair from seed.")?; |
| 224 | dice.sign( |
| 225 | message, |
| 226 | private_key[..].try_into().with_context(|| { |
| 227 | format!( |
| 228 | "In ResidentHal::sign: Failed to convert private_key (length: {}).", |
| 229 | private_key.len() |
| 230 | ) |
| 231 | })?, |
| 232 | ) |
| 233 | .context("In ResidentHal::sign: Failed to sign.") |
| 234 | }) |
| 235 | .context("In ResidentHal::sign:")?; |
| 236 | Ok(Signature { data: signature }) |
| 237 | } |
| 238 | |
| 239 | fn get_attestation_chain(&self, input_values: &[BinderInputValues]) -> Result<Bcc> { |
| 240 | let bcc = self |
| 241 | .with_effective_artifacts(input_values, |artifacts| { |
| 242 | let (_, _, bcc) = artifacts.into_tuple(); |
| 243 | Ok(bcc) |
| 244 | }) |
| 245 | .context("In ResidentHal::get_attestation_chain: Failed to get effective_artifacts.")?; |
| 246 | |
| 247 | Ok(Bcc { data: bcc }) |
| 248 | } |
| 249 | |
| 250 | fn derive(&self, input_values: &[BinderInputValues]) -> Result<BccHandover> { |
| 251 | let (cdi_attest, cdi_seal, bcc): (Vec<u8>, Vec<u8>, Vec<u8>) = self |
| 252 | .with_effective_artifacts(input_values, |artifacts| { |
| 253 | let (cdi_attest, cdi_seal, bcc) = artifacts.into_tuple(); |
| 254 | Ok((cdi_attest[..].to_vec(), cdi_seal[..].to_vec(), bcc)) |
| 255 | })?; |
| 256 | |
| 257 | utils::make_bcc_handover( |
| 258 | &cdi_attest |
| 259 | .as_slice() |
| 260 | .try_into() |
| 261 | .context("In ResidentHal::derive: Trying to convert cdi_attest to sized array.")?, |
| 262 | &cdi_seal |
| 263 | .as_slice() |
| 264 | .try_into() |
| 265 | .context("In ResidentHal::derive: Trying to convert cdi_seal to sized array.")?, |
| 266 | &bcc, |
| 267 | ) |
| 268 | .context("In ResidentHal::derive: Trying to construct BccHandover.") |
| 269 | } |
| 270 | |
| 271 | fn demote(&self, input_values: &[BinderInputValues]) -> Result<()> { |
| 272 | let mut artifacts = self.artifacts.write().unwrap(); |
| 273 | |
| 274 | let artifacts_clone = (*artifacts).clone(); |
| 275 | |
| 276 | // Safety: run_forked may not be called from a multi threaded process. |
| 277 | // This requirement is propagated to the public interface of this module through |
| 278 | // `ResidentHal::new` |
| 279 | *artifacts = run_forked(|| { |
| 280 | let new_artifacts = |
| 281 | artifacts_clone.with_artifacts(|a| ResidentArtifacts::new_from(a))?; |
| 282 | let input_values: Vec<utils::InputValues> = |
| 283 | input_values.iter().map(|v| v.try_into()).collect::<Result<_>>()?; |
| 284 | |
| 285 | let new_artifacts = new_artifacts |
| 286 | .execute_steps(input_values.iter().map(|v| v as &dyn dice::InputValues)) |
| 287 | .context("In ResidentHal::get_effective_artifacts:")?; |
| 288 | artifacts_clone.update(&new_artifacts) |
| 289 | })?; |
| 290 | |
| 291 | Ok(()) |
| 292 | } |
| 293 | } |
| 294 | |
| 295 | /// Implements android.hardware.security.dice.IDiceDevice. Forwards public API calls |
| 296 | /// to the given DiceHalImpl backend. |
| 297 | pub struct DiceDevice { |
| 298 | hal_impl: Arc<dyn DiceHalImpl + Sync + Send>, |
| 299 | } |
| 300 | |
| 301 | impl DiceDevice { |
| 302 | /// Constructs an instance of DiceDevice, wraps it with a BnDiceDevice object and |
| 303 | /// returns a strong pointer to the binder. The result can be used to register |
| 304 | /// the service with service manager. |
| 305 | pub fn new_as_binder( |
| 306 | hal_impl: Arc<dyn DiceHalImpl + Sync + Send>, |
| 307 | ) -> Result<Strong<dyn IDiceDevice>> { |
| 308 | let result = BnDiceDevice::new_binder(DiceDevice { hal_impl }, BinderFeatures::default()); |
| 309 | Ok(result) |
| 310 | } |
| 311 | } |
| 312 | |
| 313 | impl binder::Interface for DiceDevice {} |
| 314 | |
| 315 | impl IDiceDevice for DiceDevice { |
| 316 | fn sign(&self, input_values: &[BinderInputValues], message: &[u8]) -> BinderResult<Signature> { |
| 317 | map_or_log_err(self.hal_impl.sign(input_values, message), Ok) |
| 318 | } |
| 319 | fn getAttestationChain(&self, input_values: &[BinderInputValues]) -> BinderResult<Bcc> { |
| 320 | map_or_log_err(self.hal_impl.get_attestation_chain(input_values), Ok) |
| 321 | } |
| 322 | fn derive(&self, input_values: &[BinderInputValues]) -> BinderResult<BccHandover> { |
| 323 | map_or_log_err(self.hal_impl.derive(input_values), Ok) |
| 324 | } |
| 325 | fn demote(&self, input_values: &[BinderInputValues]) -> BinderResult<()> { |
| 326 | map_or_log_err(self.hal_impl.demote(input_values), Ok) |
| 327 | } |
| 328 | } |
| 329 | |
| 330 | #[cfg(test)] |
| 331 | mod test { |
| 332 | use super::*; |
| 333 | use android_hardware_security_dice::aidl::android::hardware::security::dice::{ |
| 334 | BccHandover::BccHandover, Config::Config as BinderConfig, |
| 335 | InputValues::InputValues as BinderInputValues, Mode::Mode as BinderMode, |
| 336 | }; |
| 337 | use anyhow::{Context, Result}; |
| 338 | use diced_open_dice_cbor as dice; |
| 339 | use diced_sample_inputs; |
| 340 | use diced_utils as utils; |
| 341 | |
| 342 | #[derive(Debug, Serialize, Deserialize, Clone)] |
| 343 | struct InsecureSerializableArtifacts { |
| 344 | cdi_attest: [u8; dice::CDI_SIZE], |
| 345 | cdi_seal: [u8; dice::CDI_SIZE], |
| 346 | bcc: Vec<u8>, |
| 347 | } |
| 348 | |
| 349 | impl DiceArtifacts for InsecureSerializableArtifacts { |
| 350 | fn cdi_attest(&self) -> &[u8; dice::CDI_SIZE] { |
| 351 | &self.cdi_attest |
| 352 | } |
| 353 | fn cdi_seal(&self) -> &[u8; dice::CDI_SIZE] { |
| 354 | &self.cdi_seal |
| 355 | } |
| 356 | fn bcc(&self) -> Vec<u8> { |
| 357 | self.bcc.clone() |
| 358 | } |
| 359 | } |
| 360 | |
| 361 | impl UpdatableDiceArtifacts for InsecureSerializableArtifacts { |
| 362 | fn with_artifacts<F, T>(&self, f: F) -> Result<T> |
| 363 | where |
| 364 | F: FnOnce(&dyn DiceArtifacts) -> Result<T>, |
| 365 | { |
| 366 | f(self) |
| 367 | } |
| 368 | fn update(self, new_artifacts: &impl DiceArtifacts) -> Result<Self> { |
| 369 | Ok(Self { |
| 370 | cdi_attest: *new_artifacts.cdi_attest(), |
| 371 | cdi_seal: *new_artifacts.cdi_seal(), |
| 372 | bcc: new_artifacts.bcc(), |
| 373 | }) |
| 374 | } |
| 375 | } |
| 376 | |
| 377 | fn make_input_values( |
| 378 | code: &str, |
| 379 | config_name: &str, |
| 380 | authority: &str, |
| 381 | ) -> Result<BinderInputValues> { |
| 382 | let mut dice_ctx = dice::OpenDiceCborContext::new(); |
| 383 | Ok(BinderInputValues { |
| 384 | codeHash: dice_ctx |
| 385 | .hash(code.as_bytes()) |
| 386 | .context("In make_input_values: code hash failed.")?, |
| 387 | config: BinderConfig { |
| 388 | desc: dice::bcc::format_config_descriptor(Some(config_name), None, true) |
| 389 | .context("In make_input_values: Failed to format config descriptor.")?, |
| 390 | }, |
| 391 | authorityHash: dice_ctx |
| 392 | .hash(authority.as_bytes()) |
| 393 | .context("In make_input_values: authority hash failed.")?, |
| 394 | authorityDescriptor: None, |
| 395 | mode: BinderMode::NORMAL, |
| 396 | hidden: vec![0; dice::HIDDEN_SIZE], |
| 397 | }) |
| 398 | } |
| 399 | |
| 400 | /// Test the resident artifact batched derivation in process. |
| 401 | #[test] |
| 402 | fn derive_with_resident_artifacts() -> Result<()> { |
| 403 | let (cdi_attest, cdi_seal, bcc) = diced_sample_inputs::make_sample_bcc_and_cdis()?; |
| 404 | |
| 405 | let artifacts = |
| 406 | ResidentArtifacts::new(cdi_attest[..].try_into()?, cdi_seal[..].try_into()?, &bcc)?; |
| 407 | |
| 408 | let input_values = &[ |
| 409 | make_input_values("component 1 code", "component 1", "component 1 authority")?, |
| 410 | make_input_values("component 2 code", "component 2", "component 2 authority")?, |
| 411 | make_input_values("component 3 code", "component 3", "component 3 authority")?, |
| 412 | ]; |
| 413 | |
| 414 | let input_values: Vec<utils::InputValues> = |
| 415 | input_values.iter().map(|v| v.try_into()).collect::<Result<_>>()?; |
| 416 | |
| 417 | let new_artifacts = |
| 418 | artifacts.execute_steps(input_values.iter().map(|v| v as &dyn dice::InputValues))?; |
| 419 | |
| 420 | let result = utils::make_bcc_handover( |
| 421 | new_artifacts.cdi_attest(), |
| 422 | new_artifacts.cdi_seal(), |
| 423 | &new_artifacts.bcc(), |
| 424 | )?; |
| 425 | |
| 426 | assert_eq!(result, make_derive_test_vector()); |
| 427 | Ok(()) |
| 428 | } |
| 429 | |
| 430 | /// Test the ResidentHal hal implementation which performs the derivation in a separate |
| 431 | /// process and returns the result through a pipe. This test compares the result against |
| 432 | /// the same test vector as the in process test above. |
| 433 | #[test] |
| 434 | fn derive_with_insecure_artifacts() -> Result<()> { |
| 435 | let (cdi_attest, cdi_seal, bcc) = diced_sample_inputs::make_sample_bcc_and_cdis()?; |
| 436 | |
| 437 | // Safety: ResidentHal can only be used in single threaded environments. |
| 438 | // On-device Rust tests run each test in a separate process. |
| 439 | let hal_impl = unsafe { |
| 440 | ResidentHal::new(InsecureSerializableArtifacts { |
| 441 | cdi_attest: cdi_attest[..].try_into()?, |
| 442 | cdi_seal: cdi_seal[..].try_into()?, |
| 443 | bcc, |
| 444 | }) |
| 445 | } |
| 446 | .expect("Failed to create ResidentHal."); |
| 447 | |
| 448 | let bcc_handover = hal_impl |
| 449 | .derive(&[ |
| 450 | make_input_values("component 1 code", "component 1", "component 1 authority")?, |
| 451 | make_input_values("component 2 code", "component 2", "component 2 authority")?, |
| 452 | make_input_values("component 3 code", "component 3", "component 3 authority")?, |
| 453 | ]) |
| 454 | .expect("Failed to derive artifacts."); |
| 455 | |
| 456 | assert_eq!(bcc_handover, make_derive_test_vector()); |
| 457 | Ok(()) |
| 458 | } |
| 459 | |
| 460 | /// Demoting the implementation two steps and then performing one step of child derivation |
| 461 | /// must yield the same outcome as three derivations with the same input values. |
| 462 | #[test] |
| 463 | fn demote() -> Result<()> { |
| 464 | let (cdi_attest, cdi_seal, bcc) = diced_sample_inputs::make_sample_bcc_and_cdis()?; |
| 465 | |
| 466 | // Safety: ResidentHal can only be used in single threaded environments. |
| 467 | // On-device Rust tests run each test in a separate process. |
| 468 | let hal_impl = unsafe { |
| 469 | ResidentHal::new(InsecureSerializableArtifacts { |
| 470 | cdi_attest: cdi_attest[..].try_into()?, |
| 471 | cdi_seal: cdi_seal[..].try_into()?, |
| 472 | bcc, |
| 473 | }) |
| 474 | } |
| 475 | .expect("Failed to create ResidentHal."); |
| 476 | |
| 477 | hal_impl |
| 478 | .demote(&[ |
| 479 | make_input_values("component 1 code", "component 1", "component 1 authority")?, |
| 480 | make_input_values("component 2 code", "component 2", "component 2 authority")?, |
| 481 | ]) |
| 482 | .expect("Failed to demote implementation."); |
| 483 | |
| 484 | let bcc_handover = hal_impl |
| 485 | .derive(&[make_input_values( |
| 486 | "component 3 code", |
| 487 | "component 3", |
| 488 | "component 3 authority", |
| 489 | )?]) |
| 490 | .expect("Failed to derive artifacts."); |
| 491 | |
| 492 | assert_eq!(bcc_handover, make_derive_test_vector()); |
| 493 | Ok(()) |
| 494 | } |
| 495 | |
| 496 | fn make_derive_test_vector() -> BccHandover { |
| 497 | utils::make_bcc_handover( |
| 498 | &[ |
| 499 | // cdi_attest |
| 500 | 0x8f, 0xdf, 0x93, 0x67, 0xd7, 0x0e, 0xf8, 0xb8, 0xd2, 0x9c, 0x30, 0xeb, 0x4e, 0x9b, |
| 501 | 0x71, 0x5f, 0x9a, 0x5b, 0x67, 0xa6, 0x29, 0xe0, 0x00, 0x9b, 0x4d, 0xe6, 0x95, 0xcf, |
| 502 | 0xf9, 0xed, 0x5e, 0x9b, |
| 503 | ], |
| 504 | &[ |
| 505 | // cdi_seal |
| 506 | 0x15, 0x3e, 0xd6, 0x30, 0x5a, 0x8d, 0x4b, 0x6f, 0x07, 0x3f, 0x5d, 0x89, 0xc5, 0x6e, |
| 507 | 0x30, 0xba, 0x05, 0x56, 0xfc, 0x66, 0xf4, 0xae, 0xce, 0x7f, 0x81, 0xb9, 0xc5, 0x21, |
| 508 | 0x9b, 0x49, 0x3d, 0xe1, |
| 509 | ], |
| 510 | &[ |
| 511 | // bcc |
| 512 | 0x87, 0xa5, 0x01, 0x01, 0x03, 0x27, 0x04, 0x02, 0x20, 0x06, 0x21, 0x58, 0x20, 0x3e, |
| 513 | 0x85, 0xe5, 0x72, 0x75, 0x55, 0xe5, 0x1e, 0xe7, 0xf3, 0x35, 0x94, 0x8e, 0xbb, 0xbd, |
| 514 | 0x74, 0x1e, 0x1d, 0xca, 0x49, 0x9c, 0x97, 0x39, 0x77, 0x06, 0xd3, 0xc8, 0x6e, 0x8b, |
| 515 | 0xd7, 0x33, 0xf9, 0x84, 0x43, 0xa1, 0x01, 0x27, 0xa0, 0x59, 0x01, 0x8a, 0xa9, 0x01, |
| 516 | 0x78, 0x28, 0x34, 0x32, 0x64, 0x38, 0x38, 0x36, 0x34, 0x66, 0x39, 0x37, 0x62, 0x36, |
| 517 | 0x35, 0x34, 0x37, 0x61, 0x35, 0x30, 0x63, 0x31, 0x65, 0x30, 0x61, 0x37, 0x34, 0x39, |
| 518 | 0x66, 0x38, 0x65, 0x66, 0x38, 0x62, 0x38, 0x31, 0x65, 0x63, 0x36, 0x32, 0x61, 0x66, |
| 519 | 0x02, 0x78, 0x28, 0x31, 0x66, 0x36, 0x39, 0x36, 0x66, 0x30, 0x37, 0x32, 0x35, 0x32, |
| 520 | 0x66, 0x32, 0x39, 0x65, 0x39, 0x33, 0x66, 0x65, 0x34, 0x64, 0x65, 0x31, 0x39, 0x65, |
| 521 | 0x65, 0x33, 0x32, 0x63, 0x64, 0x38, 0x31, 0x64, 0x63, 0x34, 0x30, 0x34, 0x65, 0x37, |
| 522 | 0x36, 0x3a, 0x00, 0x47, 0x44, 0x50, 0x58, 0x40, 0x16, 0x48, 0xf2, 0x55, 0x53, 0x23, |
| 523 | 0xdd, 0x15, 0x2e, 0x83, 0x38, 0xc3, 0x64, 0x38, 0x63, 0x26, 0x0f, 0xcf, 0x5b, 0xd1, |
| 524 | 0x3a, 0xd3, 0x40, 0x3e, 0x23, 0xf8, 0x34, 0x4c, 0x6d, 0xa2, 0xbe, 0x25, 0x1c, 0xb0, |
| 525 | 0x29, 0xe8, 0xc3, 0xfb, 0xb8, 0x80, 0xdc, 0xb1, 0xd2, 0xb3, 0x91, 0x4d, 0xd3, 0xfb, |
| 526 | 0x01, 0x0f, 0xe4, 0xe9, 0x46, 0xa2, 0xc0, 0x26, 0x57, 0x5a, 0xba, 0x30, 0xf7, 0x15, |
| 527 | 0x98, 0x14, 0x3a, 0x00, 0x47, 0x44, 0x53, 0x56, 0xa3, 0x3a, 0x00, 0x01, 0x11, 0x71, |
| 528 | 0x63, 0x41, 0x42, 0x4c, 0x3a, 0x00, 0x01, 0x11, 0x72, 0x01, 0x3a, 0x00, 0x01, 0x11, |
| 529 | 0x73, 0xf6, 0x3a, 0x00, 0x47, 0x44, 0x52, 0x58, 0x40, 0x47, 0xae, 0x42, 0x27, 0x4c, |
| 530 | 0xcb, 0x65, 0x4d, 0xee, 0x74, 0x2d, 0x05, 0x78, 0x2a, 0x08, 0x2a, 0xa5, 0xf0, 0xcf, |
| 531 | 0xea, 0x3e, 0x60, 0xee, 0x97, 0x11, 0x4b, 0x5b, 0xe6, 0x05, 0x0c, 0xe8, 0x90, 0xf5, |
| 532 | 0x22, 0xc4, 0xc6, 0x67, 0x7a, 0x22, 0x27, 0x17, 0xb3, 0x79, 0xcc, 0x37, 0x64, 0x5e, |
| 533 | 0x19, 0x4f, 0x96, 0x37, 0x67, 0x3c, 0xd0, 0xc5, 0xed, 0x0f, 0xdd, 0xe7, 0x2e, 0x4f, |
| 534 | 0x70, 0x97, 0x30, 0x3a, 0x00, 0x47, 0x44, 0x54, 0x58, 0x40, 0xf9, 0x00, 0x9d, 0xc2, |
| 535 | 0x59, 0x09, 0xe0, 0xb6, 0x98, 0xbd, 0xe3, 0x97, 0x4a, 0xcb, 0x3c, 0xe7, 0x6b, 0x24, |
| 536 | 0xc3, 0xe4, 0x98, 0xdd, 0xa9, 0x6a, 0x41, 0x59, 0x15, 0xb1, 0x23, 0xe6, 0xc8, 0xdf, |
| 537 | 0xfb, 0x52, 0xb4, 0x52, 0xc1, 0xb9, 0x61, 0xdd, 0xbc, 0x5b, 0x37, 0x0e, 0x12, 0x12, |
| 538 | 0xb2, 0xfd, 0xc1, 0x09, 0xb0, 0xcf, 0x33, 0x81, 0x4c, 0xc6, 0x29, 0x1b, 0x99, 0xea, |
| 539 | 0xae, 0xfd, 0xaa, 0x0d, 0x3a, 0x00, 0x47, 0x44, 0x56, 0x41, 0x01, 0x3a, 0x00, 0x47, |
| 540 | 0x44, 0x57, 0x58, 0x2d, 0xa5, 0x01, 0x01, 0x03, 0x27, 0x04, 0x81, 0x02, 0x20, 0x06, |
| 541 | 0x21, 0x58, 0x20, 0xb1, 0x02, 0xcc, 0x2c, 0xb2, 0x6a, 0x3b, 0xe9, 0xc1, 0xd3, 0x95, |
| 542 | 0x10, 0xa0, 0xe1, 0xff, 0x51, 0xde, 0x57, 0xd5, 0x65, 0x28, 0xfd, 0x7f, 0xeb, 0xd4, |
| 543 | 0xca, 0x15, 0xf3, 0xca, 0xdf, 0x37, 0x88, 0x3a, 0x00, 0x47, 0x44, 0x58, 0x41, 0x20, |
| 544 | 0x58, 0x40, 0x58, 0xd8, 0x03, 0x24, 0x53, 0x60, 0x57, 0xa9, 0x09, 0xfa, 0xab, 0xdc, |
| 545 | 0x57, 0x1e, 0xf0, 0xe5, 0x1e, 0x51, 0x6f, 0x9e, 0xa3, 0x42, 0xe6, 0x6a, 0x8c, 0xaa, |
| 546 | 0xad, 0x08, 0x48, 0xde, 0x7f, 0x4f, 0x6e, 0x2f, 0x7f, 0x39, 0x6c, 0xa1, 0xf8, 0x42, |
| 547 | 0x71, 0xfe, 0x17, 0x3d, 0xca, 0x31, 0x83, 0x92, 0xed, 0xbb, 0x40, 0xb8, 0x10, 0xe0, |
| 548 | 0xf2, 0x5a, 0x99, 0x53, 0x38, 0x46, 0x33, 0x97, 0x78, 0x05, 0x84, 0x43, 0xa1, 0x01, |
| 549 | 0x27, 0xa0, 0x59, 0x01, 0x8a, 0xa9, 0x01, 0x78, 0x28, 0x31, 0x66, 0x36, 0x39, 0x36, |
| 550 | 0x66, 0x30, 0x37, 0x32, 0x35, 0x32, 0x66, 0x32, 0x39, 0x65, 0x39, 0x33, 0x66, 0x65, |
| 551 | 0x34, 0x64, 0x65, 0x31, 0x39, 0x65, 0x65, 0x33, 0x32, 0x63, 0x64, 0x38, 0x31, 0x64, |
| 552 | 0x63, 0x34, 0x30, 0x34, 0x65, 0x37, 0x36, 0x02, 0x78, 0x28, 0x32, 0x35, 0x39, 0x34, |
| 553 | 0x38, 0x39, 0x65, 0x36, 0x39, 0x37, 0x34, 0x38, 0x37, 0x30, 0x35, 0x64, 0x65, 0x33, |
| 554 | 0x65, 0x32, 0x66, 0x34, 0x34, 0x32, 0x36, 0x37, 0x65, 0x61, 0x34, 0x39, 0x33, 0x38, |
| 555 | 0x66, 0x66, 0x36, 0x61, 0x35, 0x37, 0x32, 0x35, 0x3a, 0x00, 0x47, 0x44, 0x50, 0x58, |
| 556 | 0x40, 0xa4, 0x0c, 0xcb, 0xc1, 0xbf, 0xfa, 0xcc, 0xfd, 0xeb, 0xf4, 0xfc, 0x43, 0x83, |
| 557 | 0x7f, 0x46, 0x8d, 0xd8, 0xd8, 0x14, 0xc1, 0x96, 0x14, 0x1f, 0x6e, 0xb3, 0xa0, 0xd9, |
| 558 | 0x56, 0xb3, 0xbf, 0x2f, 0xfa, 0x88, 0x70, 0x11, 0x07, 0x39, 0xa4, 0xd2, 0xa9, 0x6b, |
| 559 | 0x18, 0x28, 0xe8, 0x29, 0x20, 0x49, 0x0f, 0xbb, 0x8d, 0x08, 0x8c, 0xc6, 0x54, 0xe9, |
| 560 | 0x71, 0xd2, 0x7e, 0xa4, 0xfe, 0x58, 0x7f, 0xd3, 0xc7, 0x3a, 0x00, 0x47, 0x44, 0x53, |
| 561 | 0x56, 0xa3, 0x3a, 0x00, 0x01, 0x11, 0x71, 0x63, 0x41, 0x56, 0x42, 0x3a, 0x00, 0x01, |
| 562 | 0x11, 0x72, 0x01, 0x3a, 0x00, 0x01, 0x11, 0x73, 0xf6, 0x3a, 0x00, 0x47, 0x44, 0x52, |
| 563 | 0x58, 0x40, 0x93, 0x17, 0xe1, 0x11, 0x27, 0x59, 0xd0, 0xef, 0x75, 0x0b, 0x2b, 0x1c, |
| 564 | 0x0f, 0x5f, 0x52, 0xc3, 0x29, 0x23, 0xb5, 0x2a, 0xe6, 0x12, 0x72, 0x6f, 0x39, 0x86, |
| 565 | 0x65, 0x2d, 0xf2, 0xe4, 0xe7, 0xd0, 0xaf, 0x0e, 0xa7, 0x99, 0x16, 0x89, 0x97, 0x21, |
| 566 | 0xf7, 0xdc, 0x89, 0xdc, 0xde, 0xbb, 0x94, 0x88, 0x1f, 0xda, 0xe2, 0xf3, 0xe0, 0x54, |
| 567 | 0xf9, 0x0e, 0x29, 0xb1, 0xbd, 0xe1, 0x0c, 0x0b, 0xd7, 0xf6, 0x3a, 0x00, 0x47, 0x44, |
| 568 | 0x54, 0x58, 0x40, 0xb2, 0x69, 0x05, 0x48, 0x56, 0xb5, 0xfa, 0x55, 0x6f, 0xac, 0x56, |
| 569 | 0xd9, 0x02, 0x35, 0x2b, 0xaa, 0x4c, 0xba, 0x28, 0xdd, 0x82, 0x3a, 0x86, 0xf5, 0xd4, |
| 570 | 0xc2, 0xf1, 0xf9, 0x35, 0x7d, 0xe4, 0x43, 0x13, 0xbf, 0xfe, 0xd3, 0x36, 0xd8, 0x1c, |
| 571 | 0x12, 0x78, 0x5c, 0x9c, 0x3e, 0xf6, 0x66, 0xef, 0xab, 0x3d, 0x0f, 0x89, 0xa4, 0x6f, |
| 572 | 0xc9, 0x72, 0xee, 0x73, 0x43, 0x02, 0x8a, 0xef, 0xbc, 0x05, 0x98, 0x3a, 0x00, 0x47, |
| 573 | 0x44, 0x56, 0x41, 0x01, 0x3a, 0x00, 0x47, 0x44, 0x57, 0x58, 0x2d, 0xa5, 0x01, 0x01, |
| 574 | 0x03, 0x27, 0x04, 0x81, 0x02, 0x20, 0x06, 0x21, 0x58, 0x20, 0x96, 0x6d, 0x96, 0x42, |
| 575 | 0xda, 0x64, 0x51, 0xad, 0xfa, 0x00, 0xbc, 0xbc, 0x95, 0x8a, 0xb0, 0xb9, 0x76, 0x01, |
| 576 | 0xe6, 0xbd, 0xc0, 0x26, 0x79, 0x26, 0xfc, 0x0f, 0x1d, 0x87, 0x65, 0xf1, 0xf3, 0x99, |
| 577 | 0x3a, 0x00, 0x47, 0x44, 0x58, 0x41, 0x20, 0x58, 0x40, 0x10, 0x7f, 0x77, 0xad, 0x70, |
| 578 | 0xbd, 0x52, 0x81, 0x28, 0x8d, 0x24, 0x81, 0xb4, 0x3f, 0x21, 0x68, 0x9f, 0xc3, 0x80, |
| 579 | 0x68, 0x86, 0x55, 0xfb, 0x2e, 0x6d, 0x96, 0xe1, 0xe1, 0xb7, 0x28, 0x8d, 0x63, 0x85, |
| 580 | 0xba, 0x2a, 0x01, 0x33, 0x87, 0x60, 0x63, 0xbb, 0x16, 0x3f, 0x2f, 0x3d, 0xf4, 0x2d, |
| 581 | 0x48, 0x5b, 0x87, 0xed, 0xda, 0x34, 0xeb, 0x9c, 0x4d, 0x14, 0xac, 0x65, 0xf4, 0xfa, |
| 582 | 0xef, 0x45, 0x0b, 0x84, 0x43, 0xa1, 0x01, 0x27, 0xa0, 0x59, 0x01, 0x8f, 0xa9, 0x01, |
| 583 | 0x78, 0x28, 0x32, 0x35, 0x39, 0x34, 0x38, 0x39, 0x65, 0x36, 0x39, 0x37, 0x34, 0x38, |
| 584 | 0x37, 0x30, 0x35, 0x64, 0x65, 0x33, 0x65, 0x32, 0x66, 0x34, 0x34, 0x32, 0x36, 0x37, |
| 585 | 0x65, 0x61, 0x34, 0x39, 0x33, 0x38, 0x66, 0x66, 0x36, 0x61, 0x35, 0x37, 0x32, 0x35, |
| 586 | 0x02, 0x78, 0x28, 0x35, 0x64, 0x34, 0x65, 0x64, 0x37, 0x66, 0x34, 0x31, 0x37, 0x61, |
| 587 | 0x39, 0x35, 0x34, 0x61, 0x31, 0x38, 0x31, 0x34, 0x30, 0x37, 0x62, 0x35, 0x38, 0x38, |
| 588 | 0x35, 0x61, 0x66, 0x64, 0x37, 0x32, 0x61, 0x35, 0x62, 0x66, 0x34, 0x30, 0x64, 0x61, |
| 589 | 0x36, 0x3a, 0x00, 0x47, 0x44, 0x50, 0x58, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 590 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 591 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 592 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 593 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 594 | 0x00, 0x00, 0x3a, 0x00, 0x47, 0x44, 0x53, 0x58, 0x1a, 0xa3, 0x3a, 0x00, 0x01, 0x11, |
| 595 | 0x71, 0x67, 0x41, 0x6e, 0x64, 0x72, 0x6f, 0x69, 0x64, 0x3a, 0x00, 0x01, 0x11, 0x72, |
| 596 | 0x0c, 0x3a, 0x00, 0x01, 0x11, 0x73, 0xf6, 0x3a, 0x00, 0x47, 0x44, 0x52, 0x58, 0x40, |
| 597 | 0x26, 0x1a, 0xbd, 0x26, 0xd8, 0x37, 0x8f, 0x4a, 0xf2, 0x9e, 0x49, 0x4d, 0x93, 0x23, |
| 598 | 0xc4, 0x6e, 0x02, 0xda, 0xe0, 0x00, 0x02, 0xe7, 0xed, 0x29, 0xdf, 0x2b, 0xb3, 0x69, |
| 599 | 0xf3, 0x55, 0x0e, 0x4c, 0x22, 0xdc, 0xcf, 0xf5, 0x92, 0xc9, 0xfa, 0x78, 0x98, 0xf1, |
| 600 | 0x0e, 0x55, 0x5f, 0xf4, 0x45, 0xed, 0xc0, 0x0a, 0x72, 0x2a, 0x7a, 0x3a, 0xd2, 0xb1, |
| 601 | 0xf7, 0x76, 0xfe, 0x2a, 0x6b, 0x7b, 0x2a, 0x53, 0x3a, 0x00, 0x47, 0x44, 0x54, 0x58, |
| 602 | 0x40, 0x04, 0x25, 0x5d, 0x60, 0x5f, 0x5c, 0x45, 0x0d, 0xf2, 0x9a, 0x6e, 0x99, 0x30, |
| 603 | 0x03, 0xb8, 0xd6, 0xe1, 0x99, 0x71, 0x1b, 0xf8, 0x44, 0xfa, 0xb5, 0x31, 0x79, 0x1c, |
| 604 | 0x37, 0x68, 0x4e, 0x1d, 0xc0, 0x24, 0x74, 0x68, 0xf8, 0x80, 0x20, 0x3e, 0x44, 0xb1, |
| 605 | 0x43, 0xd2, 0x9c, 0xfc, 0x12, 0x9e, 0x77, 0x0a, 0xde, 0x29, 0x24, 0xff, 0x2e, 0xfa, |
| 606 | 0xc7, 0x10, 0xd5, 0x73, 0xd4, 0xc6, 0xdf, 0x62, 0x9f, 0x3a, 0x00, 0x47, 0x44, 0x56, |
| 607 | 0x41, 0x01, 0x3a, 0x00, 0x47, 0x44, 0x57, 0x58, 0x2d, 0xa5, 0x01, 0x01, 0x03, 0x27, |
| 608 | 0x04, 0x81, 0x02, 0x20, 0x06, 0x21, 0x58, 0x20, 0xdb, 0xe7, 0x5b, 0x3f, 0xa3, 0x42, |
| 609 | 0xb0, 0x9c, 0xf8, 0x40, 0x8c, 0xb0, 0x9c, 0xf0, 0x0a, 0xaf, 0xdf, 0x6f, 0xe5, 0x09, |
| 610 | 0x21, 0x11, 0x92, 0xe1, 0xf8, 0xc5, 0x09, 0x02, 0x3d, 0x1f, 0xb7, 0xc5, 0x3a, 0x00, |
| 611 | 0x47, 0x44, 0x58, 0x41, 0x20, 0x58, 0x40, 0xc4, 0xc1, 0xd7, 0x1c, 0x2d, 0x26, 0x89, |
| 612 | 0x22, 0xcf, 0xa6, 0x99, 0x77, 0x30, 0x84, 0x86, 0x27, 0x59, 0x8f, 0xd8, 0x08, 0x75, |
| 613 | 0xe0, 0xb2, 0xef, 0xf9, 0xfa, 0xa5, 0x40, 0x8c, 0xd3, 0xeb, 0xbb, 0xda, 0xf2, 0xc8, |
| 614 | 0xae, 0x41, 0x22, 0x50, 0x9c, 0xe8, 0xb2, 0x9c, 0x9b, 0x3f, 0x8a, 0x78, 0x76, 0xab, |
| 615 | 0xd0, 0xbe, 0xfc, 0xe4, 0x79, 0xcb, 0x1b, 0x2b, 0xaa, 0x4d, 0xdd, 0x15, 0x61, 0x42, |
| 616 | 0x06, 0x84, 0x43, 0xa1, 0x01, 0x27, 0xa0, 0x59, 0x01, 0x8d, 0xa9, 0x01, 0x78, 0x28, |
| 617 | 0x35, 0x64, 0x34, 0x65, 0x64, 0x37, 0x66, 0x34, 0x31, 0x37, 0x61, 0x39, 0x35, 0x34, |
| 618 | 0x61, 0x31, 0x38, 0x31, 0x34, 0x30, 0x37, 0x62, 0x35, 0x38, 0x38, 0x35, 0x61, 0x66, |
| 619 | 0x64, 0x37, 0x32, 0x61, 0x35, 0x62, 0x66, 0x34, 0x30, 0x64, 0x61, 0x36, 0x02, 0x78, |
| 620 | 0x28, 0x36, 0x39, 0x62, 0x31, 0x37, 0x36, 0x37, 0x35, 0x38, 0x61, 0x36, 0x66, 0x34, |
| 621 | 0x34, 0x62, 0x35, 0x65, 0x38, 0x39, 0x39, 0x63, 0x64, 0x65, 0x33, 0x63, 0x66, 0x34, |
| 622 | 0x35, 0x31, 0x39, 0x61, 0x39, 0x33, 0x35, 0x62, 0x63, 0x39, 0x66, 0x65, 0x34, 0x3a, |
| 623 | 0x00, 0x47, 0x44, 0x50, 0x58, 0x40, 0x31, 0x0d, 0x31, 0xfa, 0x78, 0x58, 0x33, 0xf2, |
| 624 | 0xf8, 0x58, 0x6b, 0xe9, 0x68, 0x32, 0x44, 0xd0, 0xfc, 0x2d, 0xe1, 0xfc, 0xe1, 0xc2, |
| 625 | 0x4e, 0x2b, 0xa8, 0x2c, 0xa1, 0xc1, 0x48, 0xc6, 0xaa, 0x91, 0x89, 0x4f, 0xb7, 0x9c, |
| 626 | 0x40, 0x74, 0x21, 0x36, 0x31, 0x45, 0x09, 0xdf, 0x0c, 0xb4, 0xf9, 0x9a, 0x59, 0xae, |
| 627 | 0x4f, 0x21, 0x10, 0xc1, 0x38, 0xa8, 0xa2, 0xbe, 0xc6, 0x36, 0xf0, 0x56, 0x58, 0xdb, |
| 628 | 0x3a, 0x00, 0x47, 0x44, 0x53, 0x58, 0x18, 0xa2, 0x3a, 0x00, 0x01, 0x11, 0x71, 0x6b, |
| 629 | 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x20, 0x31, 0x3a, 0x00, 0x01, |
| 630 | 0x11, 0x73, 0xf6, 0x3a, 0x00, 0x47, 0x44, 0x52, 0x58, 0x40, 0xce, 0x8a, 0x30, 0x4e, |
| 631 | 0x31, 0x53, 0xea, 0xdd, 0x2f, 0xbd, 0x15, 0xbc, 0x6b, 0x0f, 0xe7, 0x43, 0x50, 0xef, |
| 632 | 0x65, 0xec, 0x4e, 0x21, 0x64, 0x6e, 0x41, 0x22, 0xac, 0x87, 0xda, 0xf1, 0xf2, 0x80, |
| 633 | 0xc6, 0x8a, 0xd8, 0x7b, 0xe8, 0xe2, 0x9b, 0x87, 0x21, 0x5e, 0x26, 0x23, 0x11, 0x89, |
| 634 | 0x86, 0x57, 0x2d, 0x47, 0x73, 0x3f, 0x47, 0x87, 0xfa, 0x58, 0x5c, 0x78, 0x7b, 0xa3, |
| 635 | 0xfc, 0x2b, 0x6c, 0xed, 0x3a, 0x00, 0x47, 0x44, 0x54, 0x58, 0x40, 0xd8, 0x40, 0xa0, |
| 636 | 0x60, 0x45, 0x28, 0x5d, 0xd4, 0xc1, 0x08, 0x3c, 0xbc, 0x91, 0xf4, 0xa6, 0xa4, 0xde, |
| 637 | 0xd3, 0x3d, 0xbb, 0x24, 0x46, 0xa3, 0x58, 0x49, 0x57, 0x4d, 0x2e, 0x6d, 0x7a, 0x78, |
| 638 | 0x4b, 0x9d, 0x28, 0x9a, 0x4e, 0xf1, 0x23, 0x06, 0x35, 0xff, 0x8e, 0x1e, 0xb3, 0x02, |
| 639 | 0x63, 0x62, 0x9a, 0x50, 0x6d, 0x18, 0x70, 0x8e, 0xe3, 0x2e, 0x29, 0xb4, 0x22, 0x71, |
| 640 | 0x31, 0x39, 0x65, 0xd5, 0xb5, 0x3a, 0x00, 0x47, 0x44, 0x56, 0x41, 0x01, 0x3a, 0x00, |
| 641 | 0x47, 0x44, 0x57, 0x58, 0x2d, 0xa5, 0x01, 0x01, 0x03, 0x27, 0x04, 0x81, 0x02, 0x20, |
| 642 | 0x06, 0x21, 0x58, 0x20, 0x51, 0x3c, 0x4b, 0x56, 0x0b, 0x49, 0x0b, 0xee, 0xc5, 0x71, |
| 643 | 0xd4, 0xe7, 0xbc, 0x44, 0x27, 0x4f, 0x4e, 0x67, 0xfc, 0x3a, 0xb9, 0x47, 0x8c, 0x6f, |
| 644 | 0x24, 0x29, 0xf8, 0xb8, 0x2f, 0xa7, 0xb3, 0x4d, 0x3a, 0x00, 0x47, 0x44, 0x58, 0x41, |
| 645 | 0x20, 0x58, 0x40, 0x4e, 0x6d, 0x0e, 0x2b, 0x1d, 0x44, 0x99, 0xb6, 0x63, 0x07, 0x86, |
| 646 | 0x1a, 0xce, 0x4b, 0xdc, 0xd1, 0x3a, 0xdc, 0xbf, 0xaa, 0xb3, 0x06, 0xd9, 0xb5, 0x5c, |
| 647 | 0x75, 0xf0, 0x14, 0x63, 0xa9, 0x1e, 0x7c, 0x56, 0x62, 0x2c, 0xa5, 0xda, 0xc9, 0x81, |
| 648 | 0xcb, 0x3d, 0x63, 0x32, 0x6b, 0x76, 0x81, 0xd2, 0x93, 0xeb, 0xac, 0xfe, 0x0c, 0x87, |
| 649 | 0x66, 0x9e, 0x87, 0x82, 0xb4, 0x81, 0x6e, 0x33, 0xf1, 0x08, 0x01, 0x84, 0x43, 0xa1, |
| 650 | 0x01, 0x27, 0xa0, 0x59, 0x01, 0x8d, 0xa9, 0x01, 0x78, 0x28, 0x36, 0x39, 0x62, 0x31, |
| 651 | 0x37, 0x36, 0x37, 0x35, 0x38, 0x61, 0x36, 0x66, 0x34, 0x34, 0x62, 0x35, 0x65, 0x38, |
| 652 | 0x39, 0x39, 0x63, 0x64, 0x65, 0x33, 0x63, 0x66, 0x34, 0x35, 0x31, 0x39, 0x61, 0x39, |
| 653 | 0x33, 0x35, 0x62, 0x63, 0x39, 0x66, 0x65, 0x34, 0x02, 0x78, 0x28, 0x32, 0x39, 0x65, |
| 654 | 0x34, 0x62, 0x61, 0x63, 0x33, 0x30, 0x31, 0x65, 0x66, 0x36, 0x35, 0x61, 0x38, 0x31, |
| 655 | 0x31, 0x62, 0x39, 0x39, 0x62, 0x30, 0x33, 0x64, 0x65, 0x39, 0x35, 0x34, 0x65, 0x61, |
| 656 | 0x37, 0x36, 0x61, 0x38, 0x39, 0x31, 0x37, 0x38, 0x35, 0x3a, 0x00, 0x47, 0x44, 0x50, |
| 657 | 0x58, 0x40, 0xa4, 0x03, 0xe3, 0xde, 0x44, 0x96, 0xed, 0x31, 0x41, 0xa0, 0xba, 0x59, |
| 658 | 0xee, 0x2b, 0x03, 0x65, 0xcb, 0x63, 0x14, 0x78, 0xbe, 0xad, 0x24, 0x33, 0xb8, 0x6b, |
| 659 | 0x52, 0xd8, 0xab, 0xd5, 0x79, 0x84, 0x98, 0x6c, 0xc2, 0x66, 0xeb, 0x6c, 0x24, 0xa6, |
| 660 | 0xfa, 0x32, 0xa8, 0x16, 0xb8, 0x64, 0x37, 0x2b, 0xd4, 0xc0, 0xc4, 0xc2, 0x63, 0x25, |
| 661 | 0x10, 0xce, 0x47, 0xe3, 0x49, 0xad, 0x41, 0xf5, 0xc8, 0xf6, 0x3a, 0x00, 0x47, 0x44, |
| 662 | 0x53, 0x58, 0x18, 0xa2, 0x3a, 0x00, 0x01, 0x11, 0x71, 0x6b, 0x63, 0x6f, 0x6d, 0x70, |
| 663 | 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x20, 0x32, 0x3a, 0x00, 0x01, 0x11, 0x73, 0xf6, 0x3a, |
| 664 | 0x00, 0x47, 0x44, 0x52, 0x58, 0x40, 0xc7, 0x50, 0x09, 0xd0, 0xe0, 0xdd, 0x80, 0x77, |
| 665 | 0xae, 0xa7, 0xc8, 0x88, 0x1e, 0x88, 0xd0, 0xc7, 0x0d, 0x7c, 0x49, 0xc5, 0xb5, 0x64, |
| 666 | 0x32, 0x28, 0x2c, 0x48, 0x94, 0xc0, 0xd6, 0x7d, 0x9c, 0x86, 0xda, 0xf7, 0x98, 0xc7, |
| 667 | 0xae, 0xa4, 0x0e, 0x61, 0xc8, 0xb0, 0x8b, 0x8a, 0xe4, 0xad, 0xcf, 0xcf, 0x6d, 0x60, |
| 668 | 0x60, 0x31, 0xdd, 0xa7, 0x24, 0x9b, 0x27, 0x16, 0x31, 0x90, 0x80, 0x70, 0xc3, 0xba, |
| 669 | 0x3a, 0x00, 0x47, 0x44, 0x54, 0x58, 0x40, 0xf8, 0x86, 0xc6, 0x94, 0xf9, 0x3f, 0x66, |
| 670 | 0x3c, 0x43, 0x01, 0x29, 0x27, 0x8d, 0x3c, 0xb2, 0x11, 0xf2, 0x04, 0xb6, 0x67, 0x4f, |
| 671 | 0x5f, 0x90, 0xcb, 0xc6, 0x73, 0xe6, 0x25, 0x14, 0x63, 0xa7, 0x95, 0x11, 0x0e, 0xa0, |
| 672 | 0x1d, 0x3f, 0x6a, 0x58, 0x0a, 0x53, 0xaa, 0x68, 0x3b, 0x92, 0x64, 0x2b, 0x2e, 0x79, |
| 673 | 0x80, 0x70, 0x0e, 0x41, 0xf5, 0xe9, 0x2a, 0x36, 0x0a, 0xa4, 0xe8, 0xb4, 0xe5, 0xdd, |
| 674 | 0xa6, 0x3a, 0x00, 0x47, 0x44, 0x56, 0x41, 0x01, 0x3a, 0x00, 0x47, 0x44, 0x57, 0x58, |
| 675 | 0x2d, 0xa5, 0x01, 0x01, 0x03, 0x27, 0x04, 0x81, 0x02, 0x20, 0x06, 0x21, 0x58, 0x20, |
| 676 | 0x9e, 0x04, 0x11, 0x24, 0x34, 0xba, 0x40, 0xed, 0x86, 0xe9, 0x48, 0x70, 0x3b, 0xe7, |
| 677 | 0x76, 0xfa, 0xc5, 0xf6, 0x6d, 0xab, 0x86, 0x12, 0x00, 0xbe, 0xc7, 0x00, 0x69, 0x0e, |
| 678 | 0x97, 0x97, 0xa6, 0x12, 0x3a, 0x00, 0x47, 0x44, 0x58, 0x41, 0x20, 0x58, 0x40, 0xb7, |
| 679 | 0x31, 0xd5, 0x4c, 0x7d, 0xf5, 0xd7, 0xb8, 0xb4, 0x4f, 0x93, 0x47, 0x2c, 0x3d, 0x50, |
| 680 | 0xcc, 0xad, 0x28, 0x23, 0x68, 0xcf, 0xc2, 0x90, 0xd7, 0x02, 0x00, 0xd8, 0xf1, 0x00, |
| 681 | 0x14, 0x03, 0x90, 0x9e, 0x0b, 0x91, 0xa7, 0x22, 0x28, 0xfe, 0x55, 0x42, 0x30, 0x93, |
| 682 | 0x05, 0x66, 0xcd, 0xce, 0xb8, 0x48, 0x07, 0x56, 0x54, 0x67, 0xa5, 0xd7, 0xe3, 0x16, |
| 683 | 0xd6, 0x75, 0x7c, 0x94, 0x98, 0x1b, 0x0b, 0x84, 0x43, 0xa1, 0x01, 0x27, 0xa0, 0x59, |
| 684 | 0x01, 0x8d, 0xa9, 0x01, 0x78, 0x28, 0x32, 0x39, 0x65, 0x34, 0x62, 0x61, 0x63, 0x33, |
| 685 | 0x30, 0x31, 0x65, 0x66, 0x36, 0x35, 0x61, 0x38, 0x31, 0x31, 0x62, 0x39, 0x39, 0x62, |
| 686 | 0x30, 0x33, 0x64, 0x65, 0x39, 0x35, 0x34, 0x65, 0x61, 0x37, 0x36, 0x61, 0x38, 0x39, |
| 687 | 0x31, 0x37, 0x38, 0x35, 0x02, 0x78, 0x28, 0x31, 0x38, 0x37, 0x36, 0x63, 0x61, 0x63, |
| 688 | 0x34, 0x32, 0x33, 0x39, 0x35, 0x37, 0x66, 0x33, 0x62, 0x66, 0x62, 0x32, 0x62, 0x32, |
| 689 | 0x63, 0x39, 0x33, 0x37, 0x64, 0x31, 0x34, 0x62, 0x62, 0x38, 0x30, 0x64, 0x30, 0x36, |
| 690 | 0x37, 0x33, 0x65, 0x66, 0x66, 0x3a, 0x00, 0x47, 0x44, 0x50, 0x58, 0x40, 0xf4, 0x7d, |
| 691 | 0x11, 0x21, 0xc1, 0x19, 0x57, 0x23, 0x08, 0x6e, 0x5f, 0xe4, 0x55, 0xc5, 0x08, 0x16, |
| 692 | 0x40, 0x5f, 0x2a, 0x6f, 0x04, 0x1e, 0x6f, 0x22, 0xde, 0x53, 0xbd, 0x37, 0xe2, 0xfb, |
| 693 | 0xb4, 0x0b, 0x65, 0xf4, 0xdc, 0xc9, 0xf4, 0xce, 0x2d, 0x82, 0x2a, 0xbc, 0xaf, 0x37, |
| 694 | 0x80, 0x0b, 0x7f, 0xff, 0x3a, 0x98, 0x9c, 0xa7, 0x70, 0x4f, 0xbc, 0x59, 0x4f, 0x4e, |
| 695 | 0xb1, 0x6d, 0xdf, 0x60, 0x39, 0x11, 0x3a, 0x00, 0x47, 0x44, 0x53, 0x58, 0x18, 0xa2, |
| 696 | 0x3a, 0x00, 0x01, 0x11, 0x71, 0x6b, 0x63, 0x6f, 0x6d, 0x70, 0x6f, 0x6e, 0x65, 0x6e, |
| 697 | 0x74, 0x20, 0x33, 0x3a, 0x00, 0x01, 0x11, 0x73, 0xf6, 0x3a, 0x00, 0x47, 0x44, 0x52, |
| 698 | 0x58, 0x40, 0xa4, 0xd5, 0x6f, 0xc8, 0xd6, 0xc7, 0xe4, 0x22, 0xb4, 0x7a, 0x26, 0x49, |
| 699 | 0xd5, 0xb4, 0xc1, 0xc6, 0x1b, 0xfa, 0x14, 0x8c, 0x49, 0x72, 0x2f, 0xfe, 0xbc, 0xc1, |
| 700 | 0xc8, 0xc6, 0x65, 0x62, 0x86, 0xf7, 0xf2, 0x74, 0x45, 0x9b, 0x1a, 0xa0, 0x2b, 0xc4, |
| 701 | 0x27, 0x13, 0xc5, 0xc3, 0xe5, 0x28, 0xc2, 0x16, 0xcd, 0x90, 0x6d, 0xa0, 0xf7, 0x27, |
| 702 | 0x04, 0xa8, 0xa2, 0x62, 0xaa, 0x2c, 0x0c, 0x75, 0xd5, 0x9d, 0x3a, 0x00, 0x47, 0x44, |
| 703 | 0x54, 0x58, 0x40, 0x1d, 0x92, 0x34, 0xfb, 0xfe, 0x74, 0xb7, 0xce, 0x3a, 0x95, 0x45, |
| 704 | 0xe5, 0x3e, 0x1f, 0x5f, 0x18, 0x53, 0x5f, 0xe1, 0x85, 0xb0, 0x1d, 0xe3, 0x8d, 0x53, |
| 705 | 0x77, 0xdc, 0x86, 0x32, 0x3d, 0x9b, 0xf9, 0xa5, 0x51, 0x17, 0x51, 0x9a, 0xd8, 0xa6, |
| 706 | 0x7d, 0x45, 0x98, 0x47, 0xa2, 0x73, 0x54, 0x66, 0x28, 0x66, 0x92, 0x1d, 0x28, 0x8a, |
| 707 | 0xe7, 0x5d, 0xb8, 0x96, 0x4b, 0x6a, 0x9d, 0xee, 0xc2, 0xe9, 0x20, 0x3a, 0x00, 0x47, |
| 708 | 0x44, 0x56, 0x41, 0x01, 0x3a, 0x00, 0x47, 0x44, 0x57, 0x58, 0x2d, 0xa5, 0x01, 0x01, |
| 709 | 0x03, 0x27, 0x04, 0x81, 0x02, 0x20, 0x06, 0x21, 0x58, 0x20, 0x4d, 0xf5, 0x61, 0x1e, |
| 710 | 0xa6, 0x64, 0x74, 0x0b, 0x6c, 0x99, 0x8b, 0x6d, 0x34, 0x42, 0x21, 0xdd, 0x82, 0x26, |
| 711 | 0x13, 0xb4, 0xf0, 0xbc, 0x9a, 0x0b, 0xf6, 0x56, 0xbd, 0x5d, 0xea, 0xd5, 0x07, 0x7a, |
| 712 | 0x3a, 0x00, 0x47, 0x44, 0x58, 0x41, 0x20, 0x58, 0x40, 0x40, 0x4d, 0x09, 0x0d, 0x80, |
| 713 | 0xba, 0x12, 0x94, 0x05, 0xfb, 0x1a, 0x23, 0xa3, 0xcb, 0x28, 0x6f, 0xd7, 0x29, 0x95, |
| 714 | 0xda, 0x83, 0x07, 0x3c, 0xbe, 0x7c, 0x37, 0xeb, 0x9c, 0xb2, 0x77, 0x10, 0x3f, 0x6a, |
| 715 | 0x41, 0x80, 0xce, 0x56, 0xb7, 0x55, 0x22, 0x81, 0x77, 0x2d, 0x3c, 0xf8, 0x16, 0x38, |
| 716 | 0x49, 0xcc, 0x9a, 0xe8, 0x3a, 0x03, 0x33, 0x4c, 0xe6, 0x87, 0x72, 0xf6, 0x5a, 0x4a, |
| 717 | 0x3f, 0x4e, 0x0a, |
| 718 | ], |
| 719 | ) |
| 720 | .unwrap() |
| 721 | } |
| 722 | } |