Janis Danisevskis | 1fe1132 | 2020-08-07 08:44:08 -0700 | [diff] [blame^] | 1 | #![allow(non_snake_case)] |
| 2 | #![allow(missing_docs)] |
| 3 | #![allow(clippy::identity_op)] |
| 4 | #![allow(clippy::excessive_precision)] |
| 5 | #![allow(clippy::too_many_arguments)] |
| 6 | pub use binder::public_api as binder; |
| 7 | pub mod aidl { |
| 8 | pub mod android { |
| 9 | pub mod hardware { |
| 10 | pub mod keymint { |
| 11 | pub mod Algorithm { |
| 12 | #![allow(non_upper_case_globals)] |
| 13 | pub type Algorithm = i32; |
| 14 | pub const RSA: Algorithm = 1; |
| 15 | pub const EC: Algorithm = 3; |
| 16 | pub const AES: Algorithm = 32; |
| 17 | pub const TRIPLE_DES: Algorithm = 33; |
| 18 | pub const HMAC: Algorithm = 128; |
| 19 | pub(crate) mod mangled { pub use super::Algorithm as _7_android_8_hardware_7_keymint_9_Algorithm; } |
| 20 | } |
| 21 | pub mod BeginResult { |
| 22 | pub struct BeginResult { |
| 23 | pub challenge: i64, |
| 24 | pub params: Vec<crate::mangled::_7_android_8_hardware_7_keymint_12_KeyParameter>, |
| 25 | pub operation: Option<Box<dyn crate::mangled::_7_android_8_hardware_7_keymint_17_IKeyMintOperation>>, |
| 26 | } |
| 27 | pub(crate) mod mangled { pub use super::BeginResult as _7_android_8_hardware_7_keymint_11_BeginResult; } |
| 28 | impl Default for BeginResult { |
| 29 | fn default() -> Self { |
| 30 | Self { |
| 31 | challenge: 0, |
| 32 | params: Default::default(), |
| 33 | operation: Default::default(), |
| 34 | } |
| 35 | } |
| 36 | } |
| 37 | impl binder::parcel::Serialize for BeginResult { |
| 38 | fn serialize(&self, parcel: &mut binder::parcel::Parcel) -> binder::Result<()> { |
| 39 | <Self as binder::parcel::SerializeOption>::serialize_option(Some(self), parcel) |
| 40 | } |
| 41 | } |
| 42 | impl binder::parcel::SerializeArray for BeginResult {} |
| 43 | impl binder::parcel::SerializeOption for BeginResult { |
| 44 | fn serialize_option(this: Option<&Self>, parcel: &mut binder::parcel::Parcel) -> binder::Result<()> { |
| 45 | let this = if let Some(this) = this { |
| 46 | parcel.write(&1i32)?; |
| 47 | this |
| 48 | } else { |
| 49 | return parcel.write(&0i32); |
| 50 | }; |
| 51 | let start_pos = parcel.get_data_position(); |
| 52 | parcel.write(&0i32)?; |
| 53 | parcel.write(&this.challenge)?; |
| 54 | parcel.write(&this.params)?; |
| 55 | let __field_ref = this.operation.as_ref().ok_or(binder::StatusCode::UNEXPECTED_NULL)?; |
| 56 | parcel.write(__field_ref)?; |
| 57 | let end_pos = parcel.get_data_position(); |
| 58 | let parcelable_size = (end_pos - start_pos) as i32; |
| 59 | unsafe { parcel.set_data_position(start_pos)?; } |
| 60 | parcel.write(&parcelable_size)?; |
| 61 | unsafe { parcel.set_data_position(end_pos)?; } |
| 62 | Ok(()) |
| 63 | } |
| 64 | } |
| 65 | impl binder::parcel::Deserialize for BeginResult { |
| 66 | fn deserialize(parcel: &binder::parcel::Parcel) -> binder::Result<Self> { |
| 67 | <Self as binder::parcel::DeserializeOption>::deserialize_option(parcel) |
| 68 | .transpose() |
| 69 | .unwrap_or(Err(binder::StatusCode::UNEXPECTED_NULL)) |
| 70 | } |
| 71 | } |
| 72 | impl binder::parcel::DeserializeArray for BeginResult {} |
| 73 | impl binder::parcel::DeserializeOption for BeginResult { |
| 74 | fn deserialize_option(parcel: &binder::parcel::Parcel) -> binder::Result<Option<Self>> { |
| 75 | let status: i32 = parcel.read()?; |
| 76 | if status == 0 { return Ok(None); } |
| 77 | let start_pos = parcel.get_data_position(); |
| 78 | let parcelable_size: i32 = parcel.read()?; |
| 79 | if parcelable_size < 0 { return Err(binder::StatusCode::BAD_VALUE); } |
| 80 | let mut result = Self::default(); |
| 81 | result.challenge = parcel.read()?; |
| 82 | if (parcel.get_data_position() - start_pos) >= parcelable_size { |
| 83 | unsafe { parcel.set_data_position(start_pos + parcelable_size)?; } |
| 84 | return Ok(Some(result)); |
| 85 | } |
| 86 | result.params = parcel.read()?; |
| 87 | if (parcel.get_data_position() - start_pos) >= parcelable_size { |
| 88 | unsafe { parcel.set_data_position(start_pos + parcelable_size)?; } |
| 89 | return Ok(Some(result)); |
| 90 | } |
| 91 | result.operation = Some(parcel.read()?); |
| 92 | if (parcel.get_data_position() - start_pos) >= parcelable_size { |
| 93 | unsafe { parcel.set_data_position(start_pos + parcelable_size)?; } |
| 94 | return Ok(Some(result)); |
| 95 | } |
| 96 | Ok(Some(result)) |
| 97 | } |
| 98 | } |
| 99 | } |
| 100 | pub mod BlockMode { |
| 101 | #![allow(non_upper_case_globals)] |
| 102 | pub type BlockMode = i32; |
| 103 | pub const ECB: BlockMode = 1; |
| 104 | pub const CBC: BlockMode = 2; |
| 105 | pub const CTR: BlockMode = 3; |
| 106 | pub const GCM: BlockMode = 32; |
| 107 | pub(crate) mod mangled { pub use super::BlockMode as _7_android_8_hardware_7_keymint_9_BlockMode; } |
| 108 | } |
| 109 | pub mod Certificate { |
| 110 | pub struct Certificate { |
| 111 | pub encodedCertificate: Vec<u8>, |
| 112 | } |
| 113 | pub(crate) mod mangled { pub use super::Certificate as _7_android_8_hardware_7_keymint_11_Certificate; } |
| 114 | impl Default for Certificate { |
| 115 | fn default() -> Self { |
| 116 | Self { |
| 117 | encodedCertificate: Default::default(), |
| 118 | } |
| 119 | } |
| 120 | } |
| 121 | impl binder::parcel::Serialize for Certificate { |
| 122 | fn serialize(&self, parcel: &mut binder::parcel::Parcel) -> binder::Result<()> { |
| 123 | <Self as binder::parcel::SerializeOption>::serialize_option(Some(self), parcel) |
| 124 | } |
| 125 | } |
| 126 | impl binder::parcel::SerializeArray for Certificate {} |
| 127 | impl binder::parcel::SerializeOption for Certificate { |
| 128 | fn serialize_option(this: Option<&Self>, parcel: &mut binder::parcel::Parcel) -> binder::Result<()> { |
| 129 | let this = if let Some(this) = this { |
| 130 | parcel.write(&1i32)?; |
| 131 | this |
| 132 | } else { |
| 133 | return parcel.write(&0i32); |
| 134 | }; |
| 135 | let start_pos = parcel.get_data_position(); |
| 136 | parcel.write(&0i32)?; |
| 137 | parcel.write(&this.encodedCertificate)?; |
| 138 | let end_pos = parcel.get_data_position(); |
| 139 | let parcelable_size = (end_pos - start_pos) as i32; |
| 140 | unsafe { parcel.set_data_position(start_pos)?; } |
| 141 | parcel.write(&parcelable_size)?; |
| 142 | unsafe { parcel.set_data_position(end_pos)?; } |
| 143 | Ok(()) |
| 144 | } |
| 145 | } |
| 146 | impl binder::parcel::Deserialize for Certificate { |
| 147 | fn deserialize(parcel: &binder::parcel::Parcel) -> binder::Result<Self> { |
| 148 | <Self as binder::parcel::DeserializeOption>::deserialize_option(parcel) |
| 149 | .transpose() |
| 150 | .unwrap_or(Err(binder::StatusCode::UNEXPECTED_NULL)) |
| 151 | } |
| 152 | } |
| 153 | impl binder::parcel::DeserializeArray for Certificate {} |
| 154 | impl binder::parcel::DeserializeOption for Certificate { |
| 155 | fn deserialize_option(parcel: &binder::parcel::Parcel) -> binder::Result<Option<Self>> { |
| 156 | let status: i32 = parcel.read()?; |
| 157 | if status == 0 { return Ok(None); } |
| 158 | let start_pos = parcel.get_data_position(); |
| 159 | let parcelable_size: i32 = parcel.read()?; |
| 160 | if parcelable_size < 0 { return Err(binder::StatusCode::BAD_VALUE); } |
| 161 | let mut result = Self::default(); |
| 162 | result.encodedCertificate = parcel.read()?; |
| 163 | if (parcel.get_data_position() - start_pos) >= parcelable_size { |
| 164 | unsafe { parcel.set_data_position(start_pos + parcelable_size)?; } |
| 165 | return Ok(Some(result)); |
| 166 | } |
| 167 | Ok(Some(result)) |
| 168 | } |
| 169 | } |
| 170 | } |
| 171 | pub mod Constants { |
| 172 | #![allow(non_upper_case_globals)] |
| 173 | pub type Constants = i32; |
| 174 | pub const AUTH_TOKEN_MAC_LENGTH: Constants = 32; |
| 175 | pub(crate) mod mangled { pub use super::Constants as _7_android_8_hardware_7_keymint_9_Constants; } |
| 176 | } |
| 177 | pub mod Digest { |
| 178 | #![allow(non_upper_case_globals)] |
| 179 | pub type Digest = i32; |
| 180 | pub const NONE: Digest = 0; |
| 181 | pub const MD5: Digest = 1; |
| 182 | pub const SHA1: Digest = 2; |
| 183 | pub const SHA_2_224: Digest = 3; |
| 184 | pub const SHA_2_256: Digest = 4; |
| 185 | pub const SHA_2_384: Digest = 5; |
| 186 | pub const SHA_2_512: Digest = 6; |
| 187 | pub(crate) mod mangled { pub use super::Digest as _7_android_8_hardware_7_keymint_6_Digest; } |
| 188 | } |
| 189 | pub mod EcCurve { |
| 190 | #![allow(non_upper_case_globals)] |
| 191 | pub type EcCurve = i32; |
| 192 | pub const P_224: EcCurve = 0; |
| 193 | pub const P_256: EcCurve = 1; |
| 194 | pub const P_384: EcCurve = 2; |
| 195 | pub const P_521: EcCurve = 3; |
| 196 | pub(crate) mod mangled { pub use super::EcCurve as _7_android_8_hardware_7_keymint_7_EcCurve; } |
| 197 | } |
| 198 | pub mod ErrorCode { |
| 199 | #![allow(non_upper_case_globals)] |
| 200 | pub type ErrorCode = i32; |
| 201 | pub const OK: ErrorCode = 0; |
| 202 | pub const ROOT_OF_TRUST_ALREADY_SET: ErrorCode = -1; |
| 203 | pub const UNSUPPORTED_PURPOSE: ErrorCode = -2; |
| 204 | pub const INCOMPATIBLE_PURPOSE: ErrorCode = -3; |
| 205 | pub const UNSUPPORTED_ALGORITHM: ErrorCode = -4; |
| 206 | pub const INCOMPATIBLE_ALGORITHM: ErrorCode = -5; |
| 207 | pub const UNSUPPORTED_KEY_SIZE: ErrorCode = -6; |
| 208 | pub const UNSUPPORTED_BLOCK_MODE: ErrorCode = -7; |
| 209 | pub const INCOMPATIBLE_BLOCK_MODE: ErrorCode = -8; |
| 210 | pub const UNSUPPORTED_MAC_LENGTH: ErrorCode = -9; |
| 211 | pub const UNSUPPORTED_PADDING_MODE: ErrorCode = -10; |
| 212 | pub const INCOMPATIBLE_PADDING_MODE: ErrorCode = -11; |
| 213 | pub const UNSUPPORTED_DIGEST: ErrorCode = -12; |
| 214 | pub const INCOMPATIBLE_DIGEST: ErrorCode = -13; |
| 215 | pub const INVALID_EXPIRATION_TIME: ErrorCode = -14; |
| 216 | pub const INVALID_USER_ID: ErrorCode = -15; |
| 217 | pub const INVALID_AUTHORIZATION_TIMEOUT: ErrorCode = -16; |
| 218 | pub const UNSUPPORTED_KEY_FORMAT: ErrorCode = -17; |
| 219 | pub const INCOMPATIBLE_KEY_FORMAT: ErrorCode = -18; |
| 220 | pub const UNSUPPORTED_KEY_ENCRYPTION_ALGORITHM: ErrorCode = -19; |
| 221 | pub const UNSUPPORTED_KEY_VERIFICATION_ALGORITHM: ErrorCode = -20; |
| 222 | pub const INVALID_INPUT_LENGTH: ErrorCode = -21; |
| 223 | pub const KEY_EXPORT_OPTIONS_INVALID: ErrorCode = -22; |
| 224 | pub const DELEGATION_NOT_ALLOWED: ErrorCode = -23; |
| 225 | pub const KEY_NOT_YET_VALID: ErrorCode = -24; |
| 226 | pub const KEY_EXPIRED: ErrorCode = -25; |
| 227 | pub const KEY_USER_NOT_AUTHENTICATED: ErrorCode = -26; |
| 228 | pub const OUTPUT_PARAMETER_NULL: ErrorCode = -27; |
| 229 | pub const INVALID_OPERATION_HANDLE: ErrorCode = -28; |
| 230 | pub const INSUFFICIENT_BUFFER_SPACE: ErrorCode = -29; |
| 231 | pub const VERIFICATION_FAILED: ErrorCode = -30; |
| 232 | pub const TOO_MANY_OPERATIONS: ErrorCode = -31; |
| 233 | pub const UNEXPECTED_NULL_POINTER: ErrorCode = -32; |
| 234 | pub const INVALID_KEY_BLOB: ErrorCode = -33; |
| 235 | pub const IMPORTED_KEY_NOT_ENCRYPTED: ErrorCode = -34; |
| 236 | pub const IMPORTED_KEY_DECRYPTION_FAILED: ErrorCode = -35; |
| 237 | pub const IMPORTED_KEY_NOT_SIGNED: ErrorCode = -36; |
| 238 | pub const IMPORTED_KEY_VERIFICATION_FAILED: ErrorCode = -37; |
| 239 | pub const INVALID_ARGUMENT: ErrorCode = -38; |
| 240 | pub const UNSUPPORTED_TAG: ErrorCode = -39; |
| 241 | pub const INVALID_TAG: ErrorCode = -40; |
| 242 | pub const MEMORY_ALLOCATION_FAILED: ErrorCode = -41; |
| 243 | pub const IMPORT_PARAMETER_MISMATCH: ErrorCode = -44; |
| 244 | pub const SECURE_HW_ACCESS_DENIED: ErrorCode = -45; |
| 245 | pub const OPERATION_CANCELLED: ErrorCode = -46; |
| 246 | pub const CONCURRENT_ACCESS_CONFLICT: ErrorCode = -47; |
| 247 | pub const SECURE_HW_BUSY: ErrorCode = -48; |
| 248 | pub const SECURE_HW_COMMUNICATION_FAILED: ErrorCode = -49; |
| 249 | pub const UNSUPPORTED_EC_FIELD: ErrorCode = -50; |
| 250 | pub const MISSING_NONCE: ErrorCode = -51; |
| 251 | pub const INVALID_NONCE: ErrorCode = -52; |
| 252 | pub const MISSING_MAC_LENGTH: ErrorCode = -53; |
| 253 | pub const KEY_RATE_LIMIT_EXCEEDED: ErrorCode = -54; |
| 254 | pub const CALLER_NONCE_PROHIBITED: ErrorCode = -55; |
| 255 | pub const KEY_MAX_OPS_EXCEEDED: ErrorCode = -56; |
| 256 | pub const INVALID_MAC_LENGTH: ErrorCode = -57; |
| 257 | pub const MISSING_MIN_MAC_LENGTH: ErrorCode = -58; |
| 258 | pub const UNSUPPORTED_MIN_MAC_LENGTH: ErrorCode = -59; |
| 259 | pub const UNSUPPORTED_KDF: ErrorCode = -60; |
| 260 | pub const UNSUPPORTED_EC_CURVE: ErrorCode = -61; |
| 261 | pub const KEY_REQUIRES_UPGRADE: ErrorCode = -62; |
| 262 | pub const ATTESTATION_CHALLENGE_MISSING: ErrorCode = -63; |
| 263 | pub const KEYMASTER_NOT_CONFIGURED: ErrorCode = -64; |
| 264 | pub const ATTESTATION_APPLICATION_ID_MISSING: ErrorCode = -65; |
| 265 | pub const CANNOT_ATTEST_IDS: ErrorCode = -66; |
| 266 | pub const ROLLBACK_RESISTANCE_UNAVAILABLE: ErrorCode = -67; |
| 267 | pub const HARDWARE_TYPE_UNAVAILABLE: ErrorCode = -68; |
| 268 | pub const PROOF_OF_PRESENCE_REQUIRED: ErrorCode = -69; |
| 269 | pub const CONCURRENT_PROOF_OF_PRESENCE_REQUESTED: ErrorCode = -70; |
| 270 | pub const NO_USER_CONFIRMATION: ErrorCode = -71; |
| 271 | pub const DEVICE_LOCKED: ErrorCode = -72; |
| 272 | pub const EARLY_BOOT_ENDED: ErrorCode = -73; |
| 273 | pub const ATTESTATION_KEYS_NOT_PROVISIONED: ErrorCode = -74; |
| 274 | pub const ATTESTATION_IDS_NOT_PROVISIONED: ErrorCode = -75; |
| 275 | pub const INVALID_OPERATION: ErrorCode = -76; |
| 276 | pub const STORAGE_KEY_UNSUPPORTED: ErrorCode = -77; |
| 277 | pub const UNIMPLEMENTED: ErrorCode = -100; |
| 278 | pub const VERSION_MISMATCH: ErrorCode = -101; |
| 279 | pub const UNKNOWN_ERROR: ErrorCode = -1000; |
| 280 | pub(crate) mod mangled { pub use super::ErrorCode as _7_android_8_hardware_7_keymint_9_ErrorCode; } |
| 281 | } |
| 282 | pub mod HardwareAuthToken { |
| 283 | pub struct HardwareAuthToken { |
| 284 | pub challenge: i64, |
| 285 | pub userId: i64, |
| 286 | pub authenticatorId: i64, |
| 287 | pub authenticatorType: crate::mangled::_7_android_8_hardware_7_keymint_25_HardwareAuthenticatorType, |
| 288 | pub timestamp: crate::mangled::_7_android_8_hardware_7_keymint_9_Timestamp, |
| 289 | pub mac: Vec<u8>, |
| 290 | } |
| 291 | pub(crate) mod mangled { pub use super::HardwareAuthToken as _7_android_8_hardware_7_keymint_17_HardwareAuthToken; } |
| 292 | impl Default for HardwareAuthToken { |
| 293 | fn default() -> Self { |
| 294 | Self { |
| 295 | challenge: 0, |
| 296 | userId: 0, |
| 297 | authenticatorId: 0, |
| 298 | authenticatorType: Default::default(), |
| 299 | timestamp: Default::default(), |
| 300 | mac: Default::default(), |
| 301 | } |
| 302 | } |
| 303 | } |
| 304 | impl binder::parcel::Serialize for HardwareAuthToken { |
| 305 | fn serialize(&self, parcel: &mut binder::parcel::Parcel) -> binder::Result<()> { |
| 306 | <Self as binder::parcel::SerializeOption>::serialize_option(Some(self), parcel) |
| 307 | } |
| 308 | } |
| 309 | impl binder::parcel::SerializeArray for HardwareAuthToken {} |
| 310 | impl binder::parcel::SerializeOption for HardwareAuthToken { |
| 311 | fn serialize_option(this: Option<&Self>, parcel: &mut binder::parcel::Parcel) -> binder::Result<()> { |
| 312 | let this = if let Some(this) = this { |
| 313 | parcel.write(&1i32)?; |
| 314 | this |
| 315 | } else { |
| 316 | return parcel.write(&0i32); |
| 317 | }; |
| 318 | let start_pos = parcel.get_data_position(); |
| 319 | parcel.write(&0i32)?; |
| 320 | parcel.write(&this.challenge)?; |
| 321 | parcel.write(&this.userId)?; |
| 322 | parcel.write(&this.authenticatorId)?; |
| 323 | parcel.write(&this.authenticatorType)?; |
| 324 | parcel.write(&this.timestamp)?; |
| 325 | parcel.write(&this.mac)?; |
| 326 | let end_pos = parcel.get_data_position(); |
| 327 | let parcelable_size = (end_pos - start_pos) as i32; |
| 328 | unsafe { parcel.set_data_position(start_pos)?; } |
| 329 | parcel.write(&parcelable_size)?; |
| 330 | unsafe { parcel.set_data_position(end_pos)?; } |
| 331 | Ok(()) |
| 332 | } |
| 333 | } |
| 334 | impl binder::parcel::Deserialize for HardwareAuthToken { |
| 335 | fn deserialize(parcel: &binder::parcel::Parcel) -> binder::Result<Self> { |
| 336 | <Self as binder::parcel::DeserializeOption>::deserialize_option(parcel) |
| 337 | .transpose() |
| 338 | .unwrap_or(Err(binder::StatusCode::UNEXPECTED_NULL)) |
| 339 | } |
| 340 | } |
| 341 | impl binder::parcel::DeserializeArray for HardwareAuthToken {} |
| 342 | impl binder::parcel::DeserializeOption for HardwareAuthToken { |
| 343 | fn deserialize_option(parcel: &binder::parcel::Parcel) -> binder::Result<Option<Self>> { |
| 344 | let status: i32 = parcel.read()?; |
| 345 | if status == 0 { return Ok(None); } |
| 346 | let start_pos = parcel.get_data_position(); |
| 347 | let parcelable_size: i32 = parcel.read()?; |
| 348 | if parcelable_size < 0 { return Err(binder::StatusCode::BAD_VALUE); } |
| 349 | let mut result = Self::default(); |
| 350 | result.challenge = parcel.read()?; |
| 351 | if (parcel.get_data_position() - start_pos) >= parcelable_size { |
| 352 | unsafe { parcel.set_data_position(start_pos + parcelable_size)?; } |
| 353 | return Ok(Some(result)); |
| 354 | } |
| 355 | result.userId = parcel.read()?; |
| 356 | if (parcel.get_data_position() - start_pos) >= parcelable_size { |
| 357 | unsafe { parcel.set_data_position(start_pos + parcelable_size)?; } |
| 358 | return Ok(Some(result)); |
| 359 | } |
| 360 | result.authenticatorId = parcel.read()?; |
| 361 | if (parcel.get_data_position() - start_pos) >= parcelable_size { |
| 362 | unsafe { parcel.set_data_position(start_pos + parcelable_size)?; } |
| 363 | return Ok(Some(result)); |
| 364 | } |
| 365 | result.authenticatorType = parcel.read()?; |
| 366 | if (parcel.get_data_position() - start_pos) >= parcelable_size { |
| 367 | unsafe { parcel.set_data_position(start_pos + parcelable_size)?; } |
| 368 | return Ok(Some(result)); |
| 369 | } |
| 370 | result.timestamp = parcel.read()?; |
| 371 | if (parcel.get_data_position() - start_pos) >= parcelable_size { |
| 372 | unsafe { parcel.set_data_position(start_pos + parcelable_size)?; } |
| 373 | return Ok(Some(result)); |
| 374 | } |
| 375 | result.mac = parcel.read()?; |
| 376 | if (parcel.get_data_position() - start_pos) >= parcelable_size { |
| 377 | unsafe { parcel.set_data_position(start_pos + parcelable_size)?; } |
| 378 | return Ok(Some(result)); |
| 379 | } |
| 380 | Ok(Some(result)) |
| 381 | } |
| 382 | } |
| 383 | } |
| 384 | pub mod HardwareAuthenticatorType { |
| 385 | #![allow(non_upper_case_globals)] |
| 386 | pub type HardwareAuthenticatorType = i32; |
| 387 | pub const NONE: HardwareAuthenticatorType = 0; |
| 388 | pub const PASSWORD: HardwareAuthenticatorType = 1; |
| 389 | pub const FINGERPRINT: HardwareAuthenticatorType = 2; |
| 390 | pub const ANY: HardwareAuthenticatorType = -1; |
| 391 | pub(crate) mod mangled { pub use super::HardwareAuthenticatorType as _7_android_8_hardware_7_keymint_25_HardwareAuthenticatorType; } |
| 392 | } |
| 393 | pub mod HmacSharingParameters { |
| 394 | pub struct HmacSharingParameters { |
| 395 | pub seed: Vec<u8>, |
| 396 | pub nonce: Vec<u8>, |
| 397 | } |
| 398 | pub(crate) mod mangled { pub use super::HmacSharingParameters as _7_android_8_hardware_7_keymint_21_HmacSharingParameters; } |
| 399 | impl Default for HmacSharingParameters { |
| 400 | fn default() -> Self { |
| 401 | Self { |
| 402 | seed: Default::default(), |
| 403 | nonce: Default::default(), |
| 404 | } |
| 405 | } |
| 406 | } |
| 407 | impl binder::parcel::Serialize for HmacSharingParameters { |
| 408 | fn serialize(&self, parcel: &mut binder::parcel::Parcel) -> binder::Result<()> { |
| 409 | <Self as binder::parcel::SerializeOption>::serialize_option(Some(self), parcel) |
| 410 | } |
| 411 | } |
| 412 | impl binder::parcel::SerializeArray for HmacSharingParameters {} |
| 413 | impl binder::parcel::SerializeOption for HmacSharingParameters { |
| 414 | fn serialize_option(this: Option<&Self>, parcel: &mut binder::parcel::Parcel) -> binder::Result<()> { |
| 415 | let this = if let Some(this) = this { |
| 416 | parcel.write(&1i32)?; |
| 417 | this |
| 418 | } else { |
| 419 | return parcel.write(&0i32); |
| 420 | }; |
| 421 | let start_pos = parcel.get_data_position(); |
| 422 | parcel.write(&0i32)?; |
| 423 | parcel.write(&this.seed)?; |
| 424 | parcel.write(&this.nonce)?; |
| 425 | let end_pos = parcel.get_data_position(); |
| 426 | let parcelable_size = (end_pos - start_pos) as i32; |
| 427 | unsafe { parcel.set_data_position(start_pos)?; } |
| 428 | parcel.write(&parcelable_size)?; |
| 429 | unsafe { parcel.set_data_position(end_pos)?; } |
| 430 | Ok(()) |
| 431 | } |
| 432 | } |
| 433 | impl binder::parcel::Deserialize for HmacSharingParameters { |
| 434 | fn deserialize(parcel: &binder::parcel::Parcel) -> binder::Result<Self> { |
| 435 | <Self as binder::parcel::DeserializeOption>::deserialize_option(parcel) |
| 436 | .transpose() |
| 437 | .unwrap_or(Err(binder::StatusCode::UNEXPECTED_NULL)) |
| 438 | } |
| 439 | } |
| 440 | impl binder::parcel::DeserializeArray for HmacSharingParameters {} |
| 441 | impl binder::parcel::DeserializeOption for HmacSharingParameters { |
| 442 | fn deserialize_option(parcel: &binder::parcel::Parcel) -> binder::Result<Option<Self>> { |
| 443 | let status: i32 = parcel.read()?; |
| 444 | if status == 0 { return Ok(None); } |
| 445 | let start_pos = parcel.get_data_position(); |
| 446 | let parcelable_size: i32 = parcel.read()?; |
| 447 | if parcelable_size < 0 { return Err(binder::StatusCode::BAD_VALUE); } |
| 448 | let mut result = Self::default(); |
| 449 | result.seed = parcel.read()?; |
| 450 | if (parcel.get_data_position() - start_pos) >= parcelable_size { |
| 451 | unsafe { parcel.set_data_position(start_pos + parcelable_size)?; } |
| 452 | return Ok(Some(result)); |
| 453 | } |
| 454 | result.nonce = parcel.read()?; |
| 455 | if (parcel.get_data_position() - start_pos) >= parcelable_size { |
| 456 | unsafe { parcel.set_data_position(start_pos + parcelable_size)?; } |
| 457 | return Ok(Some(result)); |
| 458 | } |
| 459 | Ok(Some(result)) |
| 460 | } |
| 461 | } |
| 462 | } |
| 463 | pub mod IKeyMintDevice { |
| 464 | #![allow(non_upper_case_globals)] |
| 465 | #![allow(non_snake_case)] |
| 466 | #[allow(unused_imports)] use binder::IBinder; |
| 467 | use binder::declare_binder_interface; |
| 468 | declare_binder_interface! { |
| 469 | IKeyMintDevice["android.hardware.keymint.IKeyMintDevice"] { |
| 470 | native: BnKeyMintDevice(on_transact), |
| 471 | proxy: BpKeyMintDevice { |
| 472 | }, |
| 473 | } |
| 474 | } |
| 475 | pub trait IKeyMintDevice: binder::Interface { |
| 476 | fn get_descriptor() -> &'static str where Self: Sized { "android.hardware.keymint.IKeyMintDevice" } |
| 477 | fn getHardwareInfo(&self) -> binder::public_api::Result<crate::mangled::_7_android_8_hardware_7_keymint_19_KeyMintHardwareInfo> { |
| 478 | Err(binder::StatusCode::UNKNOWN_TRANSACTION.into()) |
| 479 | } |
| 480 | fn verifyAuthorization(&self, _arg_challenge: i64, _arg_parametersToVerify: &[crate::mangled::_7_android_8_hardware_7_keymint_12_KeyParameter], _arg_token: &crate::mangled::_7_android_8_hardware_7_keymint_17_HardwareAuthToken) -> binder::public_api::Result<crate::mangled::_7_android_8_hardware_7_keymint_17_VerificationToken> { |
| 481 | Err(binder::StatusCode::UNKNOWN_TRANSACTION.into()) |
| 482 | } |
| 483 | fn addRngEntropy(&self, _arg_data: &[u8]) -> binder::public_api::Result<()> { |
| 484 | Err(binder::StatusCode::UNKNOWN_TRANSACTION.into()) |
| 485 | } |
| 486 | fn generateKey(&self, _arg_keyParams: &[crate::mangled::_7_android_8_hardware_7_keymint_12_KeyParameter], _arg_generatedKeyBlob: &mut Vec<u8>, _arg_generatedKeyCharacteristics: &mut crate::mangled::_7_android_8_hardware_7_keymint_18_KeyCharacteristics, _arg_outCertChain: &mut Vec<crate::mangled::_7_android_8_hardware_7_keymint_11_Certificate>) -> binder::public_api::Result<()> { |
| 487 | Err(binder::StatusCode::UNKNOWN_TRANSACTION.into()) |
| 488 | } |
| 489 | fn importKey(&self, _arg_inKeyParams: &[crate::mangled::_7_android_8_hardware_7_keymint_12_KeyParameter], _arg_inKeyFormat: crate::mangled::_7_android_8_hardware_7_keymint_9_KeyFormat, _arg_inKeyData: &[u8], _arg_outImportedKeyBlob: &mut Vec<u8>, _arg_outImportedKeyCharacteristics: &mut crate::mangled::_7_android_8_hardware_7_keymint_18_KeyCharacteristics, _arg_outCertChain: &mut Vec<crate::mangled::_7_android_8_hardware_7_keymint_11_Certificate>) -> binder::public_api::Result<()> { |
| 490 | Err(binder::StatusCode::UNKNOWN_TRANSACTION.into()) |
| 491 | } |
| 492 | fn importWrappedKey(&self, _arg_inWrappedKeyData: &[u8], _arg_inWrappingKeyBlob: &[u8], _arg_inMaskingKey: &[u8], _arg_inUnwrappingParams: &[crate::mangled::_7_android_8_hardware_7_keymint_12_KeyParameter], _arg_inPasswordSid: i64, _arg_inBiometricSid: i64, _arg_outImportedKeyBlob: &mut Vec<u8>, _arg_outImportedKeyCharacteristics: &mut crate::mangled::_7_android_8_hardware_7_keymint_18_KeyCharacteristics) -> binder::public_api::Result<()> { |
| 493 | Err(binder::StatusCode::UNKNOWN_TRANSACTION.into()) |
| 494 | } |
| 495 | fn upgradeKey(&self, _arg_inKeyBlobToUpgrade: &[u8], _arg_inUpgradeParams: &[crate::mangled::_7_android_8_hardware_7_keymint_12_KeyParameter]) -> binder::public_api::Result<Vec<u8>> { |
| 496 | Err(binder::StatusCode::UNKNOWN_TRANSACTION.into()) |
| 497 | } |
| 498 | fn deleteKey(&self, _arg_inKeyBlob: &[u8]) -> binder::public_api::Result<()> { |
| 499 | Err(binder::StatusCode::UNKNOWN_TRANSACTION.into()) |
| 500 | } |
| 501 | fn deleteAllKeys(&self) -> binder::public_api::Result<()> { |
| 502 | Err(binder::StatusCode::UNKNOWN_TRANSACTION.into()) |
| 503 | } |
| 504 | fn destroyAttestationIds(&self) -> binder::public_api::Result<()> { |
| 505 | Err(binder::StatusCode::UNKNOWN_TRANSACTION.into()) |
| 506 | } |
| 507 | fn begin(&self, _arg_inPurpose: crate::mangled::_7_android_8_hardware_7_keymint_10_KeyPurpose, _arg_inKeyBlob: &[u8], _arg_inParams: &[crate::mangled::_7_android_8_hardware_7_keymint_12_KeyParameter], _arg_inAuthToken: &crate::mangled::_7_android_8_hardware_7_keymint_17_HardwareAuthToken) -> binder::public_api::Result<crate::mangled::_7_android_8_hardware_7_keymint_11_BeginResult> { |
| 508 | Err(binder::StatusCode::UNKNOWN_TRANSACTION.into()) |
| 509 | } |
| 510 | fn getDefaultImpl() -> DefaultImpl where Self: Sized { |
| 511 | DEFAULT_IMPL.lock().unwrap().clone() |
| 512 | } |
| 513 | fn setDefaultImpl(d: DefaultImpl) -> DefaultImpl where Self: Sized { |
| 514 | std::mem::replace(&mut *DEFAULT_IMPL.lock().unwrap(), d) |
| 515 | } |
| 516 | } |
| 517 | pub const TRANSACTION_getHardwareInfo: binder::TransactionCode = binder::SpIBinder::FIRST_CALL_TRANSACTION + 0; |
| 518 | pub const TRANSACTION_verifyAuthorization: binder::TransactionCode = binder::SpIBinder::FIRST_CALL_TRANSACTION + 1; |
| 519 | pub const TRANSACTION_addRngEntropy: binder::TransactionCode = binder::SpIBinder::FIRST_CALL_TRANSACTION + 2; |
| 520 | pub const TRANSACTION_generateKey: binder::TransactionCode = binder::SpIBinder::FIRST_CALL_TRANSACTION + 3; |
| 521 | pub const TRANSACTION_importKey: binder::TransactionCode = binder::SpIBinder::FIRST_CALL_TRANSACTION + 4; |
| 522 | pub const TRANSACTION_importWrappedKey: binder::TransactionCode = binder::SpIBinder::FIRST_CALL_TRANSACTION + 5; |
| 523 | pub const TRANSACTION_upgradeKey: binder::TransactionCode = binder::SpIBinder::FIRST_CALL_TRANSACTION + 6; |
| 524 | pub const TRANSACTION_deleteKey: binder::TransactionCode = binder::SpIBinder::FIRST_CALL_TRANSACTION + 7; |
| 525 | pub const TRANSACTION_deleteAllKeys: binder::TransactionCode = binder::SpIBinder::FIRST_CALL_TRANSACTION + 8; |
| 526 | pub const TRANSACTION_destroyAttestationIds: binder::TransactionCode = binder::SpIBinder::FIRST_CALL_TRANSACTION + 9; |
| 527 | pub const TRANSACTION_begin: binder::TransactionCode = binder::SpIBinder::FIRST_CALL_TRANSACTION + 10; |
| 528 | pub type DefaultImpl = Option<std::sync::Arc<dyn IKeyMintDevice + Send + Sync>>; |
| 529 | use lazy_static::lazy_static; |
| 530 | lazy_static! { |
| 531 | static ref DEFAULT_IMPL: std::sync::Mutex<DefaultImpl> = std::sync::Mutex::new(None); |
| 532 | } |
| 533 | pub(crate) mod mangled { pub use super::IKeyMintDevice as _7_android_8_hardware_7_keymint_14_IKeyMintDevice; } |
| 534 | impl IKeyMintDevice for BpKeyMintDevice { |
| 535 | fn getHardwareInfo(&self) -> binder::public_api::Result<crate::mangled::_7_android_8_hardware_7_keymint_19_KeyMintHardwareInfo> { |
| 536 | let _aidl_reply = self.binder.transact(TRANSACTION_getHardwareInfo, 0, |_aidl_data| { |
| 537 | Ok(()) |
| 538 | }); |
| 539 | if let Err(binder::StatusCode::UNKNOWN_TRANSACTION) = _aidl_reply { |
| 540 | if let Some(_aidl_default_impl) = <Self as IKeyMintDevice>::getDefaultImpl() { |
| 541 | return _aidl_default_impl.getHardwareInfo(); |
| 542 | } |
| 543 | } |
| 544 | let _aidl_reply = _aidl_reply?; |
| 545 | let _aidl_status: binder::Status = _aidl_reply.read()?; |
| 546 | if !_aidl_status.is_ok() { return Err(_aidl_status); } |
| 547 | let _aidl_return: crate::mangled::_7_android_8_hardware_7_keymint_19_KeyMintHardwareInfo = _aidl_reply.read()?; |
| 548 | Ok(_aidl_return) |
| 549 | } |
| 550 | fn verifyAuthorization(&self, _arg_challenge: i64, _arg_parametersToVerify: &[crate::mangled::_7_android_8_hardware_7_keymint_12_KeyParameter], _arg_token: &crate::mangled::_7_android_8_hardware_7_keymint_17_HardwareAuthToken) -> binder::public_api::Result<crate::mangled::_7_android_8_hardware_7_keymint_17_VerificationToken> { |
| 551 | let _aidl_reply = self.binder.transact(TRANSACTION_verifyAuthorization, 0, |_aidl_data| { |
| 552 | _aidl_data.write(&_arg_challenge)?; |
| 553 | _aidl_data.write(_arg_parametersToVerify)?; |
| 554 | _aidl_data.write(_arg_token)?; |
| 555 | Ok(()) |
| 556 | }); |
| 557 | if let Err(binder::StatusCode::UNKNOWN_TRANSACTION) = _aidl_reply { |
| 558 | if let Some(_aidl_default_impl) = <Self as IKeyMintDevice>::getDefaultImpl() { |
| 559 | return _aidl_default_impl.verifyAuthorization(_arg_challenge, _arg_parametersToVerify, _arg_token); |
| 560 | } |
| 561 | } |
| 562 | let _aidl_reply = _aidl_reply?; |
| 563 | let _aidl_status: binder::Status = _aidl_reply.read()?; |
| 564 | if !_aidl_status.is_ok() { return Err(_aidl_status); } |
| 565 | let _aidl_return: crate::mangled::_7_android_8_hardware_7_keymint_17_VerificationToken = _aidl_reply.read()?; |
| 566 | Ok(_aidl_return) |
| 567 | } |
| 568 | fn addRngEntropy(&self, _arg_data: &[u8]) -> binder::public_api::Result<()> { |
| 569 | let _aidl_reply = self.binder.transact(TRANSACTION_addRngEntropy, 0, |_aidl_data| { |
| 570 | _aidl_data.write(_arg_data)?; |
| 571 | Ok(()) |
| 572 | }); |
| 573 | if let Err(binder::StatusCode::UNKNOWN_TRANSACTION) = _aidl_reply { |
| 574 | if let Some(_aidl_default_impl) = <Self as IKeyMintDevice>::getDefaultImpl() { |
| 575 | return _aidl_default_impl.addRngEntropy(_arg_data); |
| 576 | } |
| 577 | } |
| 578 | let _aidl_reply = _aidl_reply?; |
| 579 | let _aidl_status: binder::Status = _aidl_reply.read()?; |
| 580 | if !_aidl_status.is_ok() { return Err(_aidl_status); } |
| 581 | Ok(()) |
| 582 | } |
| 583 | fn generateKey(&self, _arg_keyParams: &[crate::mangled::_7_android_8_hardware_7_keymint_12_KeyParameter], _arg_generatedKeyBlob: &mut Vec<u8>, _arg_generatedKeyCharacteristics: &mut crate::mangled::_7_android_8_hardware_7_keymint_18_KeyCharacteristics, _arg_outCertChain: &mut Vec<crate::mangled::_7_android_8_hardware_7_keymint_11_Certificate>) -> binder::public_api::Result<()> { |
| 584 | let _aidl_reply = self.binder.transact(TRANSACTION_generateKey, 0, |_aidl_data| { |
| 585 | _aidl_data.write(_arg_keyParams)?; |
| 586 | _aidl_data.write_slice_size(Some(_arg_generatedKeyBlob))?; |
| 587 | _aidl_data.write_slice_size(Some(_arg_outCertChain))?; |
| 588 | Ok(()) |
| 589 | }); |
| 590 | if let Err(binder::StatusCode::UNKNOWN_TRANSACTION) = _aidl_reply { |
| 591 | if let Some(_aidl_default_impl) = <Self as IKeyMintDevice>::getDefaultImpl() { |
| 592 | return _aidl_default_impl.generateKey(_arg_keyParams, _arg_generatedKeyBlob, _arg_generatedKeyCharacteristics, _arg_outCertChain); |
| 593 | } |
| 594 | } |
| 595 | let _aidl_reply = _aidl_reply?; |
| 596 | let _aidl_status: binder::Status = _aidl_reply.read()?; |
| 597 | if !_aidl_status.is_ok() { return Err(_aidl_status); } |
| 598 | *_arg_generatedKeyBlob = _aidl_reply.read()?; |
| 599 | *_arg_generatedKeyCharacteristics = _aidl_reply.read()?; |
| 600 | *_arg_outCertChain = _aidl_reply.read()?; |
| 601 | Ok(()) |
| 602 | } |
| 603 | fn importKey(&self, _arg_inKeyParams: &[crate::mangled::_7_android_8_hardware_7_keymint_12_KeyParameter], _arg_inKeyFormat: crate::mangled::_7_android_8_hardware_7_keymint_9_KeyFormat, _arg_inKeyData: &[u8], _arg_outImportedKeyBlob: &mut Vec<u8>, _arg_outImportedKeyCharacteristics: &mut crate::mangled::_7_android_8_hardware_7_keymint_18_KeyCharacteristics, _arg_outCertChain: &mut Vec<crate::mangled::_7_android_8_hardware_7_keymint_11_Certificate>) -> binder::public_api::Result<()> { |
| 604 | let _aidl_reply = self.binder.transact(TRANSACTION_importKey, 0, |_aidl_data| { |
| 605 | _aidl_data.write(_arg_inKeyParams)?; |
| 606 | _aidl_data.write(&_arg_inKeyFormat)?; |
| 607 | _aidl_data.write(_arg_inKeyData)?; |
| 608 | _aidl_data.write_slice_size(Some(_arg_outImportedKeyBlob))?; |
| 609 | _aidl_data.write_slice_size(Some(_arg_outCertChain))?; |
| 610 | Ok(()) |
| 611 | }); |
| 612 | if let Err(binder::StatusCode::UNKNOWN_TRANSACTION) = _aidl_reply { |
| 613 | if let Some(_aidl_default_impl) = <Self as IKeyMintDevice>::getDefaultImpl() { |
| 614 | return _aidl_default_impl.importKey(_arg_inKeyParams, _arg_inKeyFormat, _arg_inKeyData, _arg_outImportedKeyBlob, _arg_outImportedKeyCharacteristics, _arg_outCertChain); |
| 615 | } |
| 616 | } |
| 617 | let _aidl_reply = _aidl_reply?; |
| 618 | let _aidl_status: binder::Status = _aidl_reply.read()?; |
| 619 | if !_aidl_status.is_ok() { return Err(_aidl_status); } |
| 620 | *_arg_outImportedKeyBlob = _aidl_reply.read()?; |
| 621 | *_arg_outImportedKeyCharacteristics = _aidl_reply.read()?; |
| 622 | *_arg_outCertChain = _aidl_reply.read()?; |
| 623 | Ok(()) |
| 624 | } |
| 625 | fn importWrappedKey(&self, _arg_inWrappedKeyData: &[u8], _arg_inWrappingKeyBlob: &[u8], _arg_inMaskingKey: &[u8], _arg_inUnwrappingParams: &[crate::mangled::_7_android_8_hardware_7_keymint_12_KeyParameter], _arg_inPasswordSid: i64, _arg_inBiometricSid: i64, _arg_outImportedKeyBlob: &mut Vec<u8>, _arg_outImportedKeyCharacteristics: &mut crate::mangled::_7_android_8_hardware_7_keymint_18_KeyCharacteristics) -> binder::public_api::Result<()> { |
| 626 | let _aidl_reply = self.binder.transact(TRANSACTION_importWrappedKey, 0, |_aidl_data| { |
| 627 | _aidl_data.write(_arg_inWrappedKeyData)?; |
| 628 | _aidl_data.write(_arg_inWrappingKeyBlob)?; |
| 629 | _aidl_data.write(_arg_inMaskingKey)?; |
| 630 | _aidl_data.write(_arg_inUnwrappingParams)?; |
| 631 | _aidl_data.write(&_arg_inPasswordSid)?; |
| 632 | _aidl_data.write(&_arg_inBiometricSid)?; |
| 633 | _aidl_data.write_slice_size(Some(_arg_outImportedKeyBlob))?; |
| 634 | Ok(()) |
| 635 | }); |
| 636 | if let Err(binder::StatusCode::UNKNOWN_TRANSACTION) = _aidl_reply { |
| 637 | if let Some(_aidl_default_impl) = <Self as IKeyMintDevice>::getDefaultImpl() { |
| 638 | return _aidl_default_impl.importWrappedKey(_arg_inWrappedKeyData, _arg_inWrappingKeyBlob, _arg_inMaskingKey, _arg_inUnwrappingParams, _arg_inPasswordSid, _arg_inBiometricSid, _arg_outImportedKeyBlob, _arg_outImportedKeyCharacteristics); |
| 639 | } |
| 640 | } |
| 641 | let _aidl_reply = _aidl_reply?; |
| 642 | let _aidl_status: binder::Status = _aidl_reply.read()?; |
| 643 | if !_aidl_status.is_ok() { return Err(_aidl_status); } |
| 644 | *_arg_outImportedKeyBlob = _aidl_reply.read()?; |
| 645 | *_arg_outImportedKeyCharacteristics = _aidl_reply.read()?; |
| 646 | Ok(()) |
| 647 | } |
| 648 | fn upgradeKey(&self, _arg_inKeyBlobToUpgrade: &[u8], _arg_inUpgradeParams: &[crate::mangled::_7_android_8_hardware_7_keymint_12_KeyParameter]) -> binder::public_api::Result<Vec<u8>> { |
| 649 | let _aidl_reply = self.binder.transact(TRANSACTION_upgradeKey, 0, |_aidl_data| { |
| 650 | _aidl_data.write(_arg_inKeyBlobToUpgrade)?; |
| 651 | _aidl_data.write(_arg_inUpgradeParams)?; |
| 652 | Ok(()) |
| 653 | }); |
| 654 | if let Err(binder::StatusCode::UNKNOWN_TRANSACTION) = _aidl_reply { |
| 655 | if let Some(_aidl_default_impl) = <Self as IKeyMintDevice>::getDefaultImpl() { |
| 656 | return _aidl_default_impl.upgradeKey(_arg_inKeyBlobToUpgrade, _arg_inUpgradeParams); |
| 657 | } |
| 658 | } |
| 659 | let _aidl_reply = _aidl_reply?; |
| 660 | let _aidl_status: binder::Status = _aidl_reply.read()?; |
| 661 | if !_aidl_status.is_ok() { return Err(_aidl_status); } |
| 662 | let _aidl_return: Vec<u8> = _aidl_reply.read()?; |
| 663 | Ok(_aidl_return) |
| 664 | } |
| 665 | fn deleteKey(&self, _arg_inKeyBlob: &[u8]) -> binder::public_api::Result<()> { |
| 666 | let _aidl_reply = self.binder.transact(TRANSACTION_deleteKey, 0, |_aidl_data| { |
| 667 | _aidl_data.write(_arg_inKeyBlob)?; |
| 668 | Ok(()) |
| 669 | }); |
| 670 | if let Err(binder::StatusCode::UNKNOWN_TRANSACTION) = _aidl_reply { |
| 671 | if let Some(_aidl_default_impl) = <Self as IKeyMintDevice>::getDefaultImpl() { |
| 672 | return _aidl_default_impl.deleteKey(_arg_inKeyBlob); |
| 673 | } |
| 674 | } |
| 675 | let _aidl_reply = _aidl_reply?; |
| 676 | let _aidl_status: binder::Status = _aidl_reply.read()?; |
| 677 | if !_aidl_status.is_ok() { return Err(_aidl_status); } |
| 678 | Ok(()) |
| 679 | } |
| 680 | fn deleteAllKeys(&self) -> binder::public_api::Result<()> { |
| 681 | let _aidl_reply = self.binder.transact(TRANSACTION_deleteAllKeys, 0, |_aidl_data| { |
| 682 | Ok(()) |
| 683 | }); |
| 684 | if let Err(binder::StatusCode::UNKNOWN_TRANSACTION) = _aidl_reply { |
| 685 | if let Some(_aidl_default_impl) = <Self as IKeyMintDevice>::getDefaultImpl() { |
| 686 | return _aidl_default_impl.deleteAllKeys(); |
| 687 | } |
| 688 | } |
| 689 | let _aidl_reply = _aidl_reply?; |
| 690 | let _aidl_status: binder::Status = _aidl_reply.read()?; |
| 691 | if !_aidl_status.is_ok() { return Err(_aidl_status); } |
| 692 | Ok(()) |
| 693 | } |
| 694 | fn destroyAttestationIds(&self) -> binder::public_api::Result<()> { |
| 695 | let _aidl_reply = self.binder.transact(TRANSACTION_destroyAttestationIds, 0, |_aidl_data| { |
| 696 | Ok(()) |
| 697 | }); |
| 698 | if let Err(binder::StatusCode::UNKNOWN_TRANSACTION) = _aidl_reply { |
| 699 | if let Some(_aidl_default_impl) = <Self as IKeyMintDevice>::getDefaultImpl() { |
| 700 | return _aidl_default_impl.destroyAttestationIds(); |
| 701 | } |
| 702 | } |
| 703 | let _aidl_reply = _aidl_reply?; |
| 704 | let _aidl_status: binder::Status = _aidl_reply.read()?; |
| 705 | if !_aidl_status.is_ok() { return Err(_aidl_status); } |
| 706 | Ok(()) |
| 707 | } |
| 708 | fn begin(&self, _arg_inPurpose: crate::mangled::_7_android_8_hardware_7_keymint_10_KeyPurpose, _arg_inKeyBlob: &[u8], _arg_inParams: &[crate::mangled::_7_android_8_hardware_7_keymint_12_KeyParameter], _arg_inAuthToken: &crate::mangled::_7_android_8_hardware_7_keymint_17_HardwareAuthToken) -> binder::public_api::Result<crate::mangled::_7_android_8_hardware_7_keymint_11_BeginResult> { |
| 709 | let _aidl_reply = self.binder.transact(TRANSACTION_begin, 0, |_aidl_data| { |
| 710 | _aidl_data.write(&_arg_inPurpose)?; |
| 711 | _aidl_data.write(_arg_inKeyBlob)?; |
| 712 | _aidl_data.write(_arg_inParams)?; |
| 713 | _aidl_data.write(_arg_inAuthToken)?; |
| 714 | Ok(()) |
| 715 | }); |
| 716 | if let Err(binder::StatusCode::UNKNOWN_TRANSACTION) = _aidl_reply { |
| 717 | if let Some(_aidl_default_impl) = <Self as IKeyMintDevice>::getDefaultImpl() { |
| 718 | return _aidl_default_impl.begin(_arg_inPurpose, _arg_inKeyBlob, _arg_inParams, _arg_inAuthToken); |
| 719 | } |
| 720 | } |
| 721 | let _aidl_reply = _aidl_reply?; |
| 722 | let _aidl_status: binder::Status = _aidl_reply.read()?; |
| 723 | if !_aidl_status.is_ok() { return Err(_aidl_status); } |
| 724 | let _aidl_return: crate::mangled::_7_android_8_hardware_7_keymint_11_BeginResult = _aidl_reply.read()?; |
| 725 | Ok(_aidl_return) |
| 726 | } |
| 727 | } |
| 728 | impl IKeyMintDevice for binder::Binder<BnKeyMintDevice> { |
| 729 | fn getHardwareInfo(&self) -> binder::public_api::Result<crate::mangled::_7_android_8_hardware_7_keymint_19_KeyMintHardwareInfo> { self.0.getHardwareInfo() } |
| 730 | fn verifyAuthorization(&self, _arg_challenge: i64, _arg_parametersToVerify: &[crate::mangled::_7_android_8_hardware_7_keymint_12_KeyParameter], _arg_token: &crate::mangled::_7_android_8_hardware_7_keymint_17_HardwareAuthToken) -> binder::public_api::Result<crate::mangled::_7_android_8_hardware_7_keymint_17_VerificationToken> { self.0.verifyAuthorization(_arg_challenge, _arg_parametersToVerify, _arg_token) } |
| 731 | fn addRngEntropy(&self, _arg_data: &[u8]) -> binder::public_api::Result<()> { self.0.addRngEntropy(_arg_data) } |
| 732 | fn generateKey(&self, _arg_keyParams: &[crate::mangled::_7_android_8_hardware_7_keymint_12_KeyParameter], _arg_generatedKeyBlob: &mut Vec<u8>, _arg_generatedKeyCharacteristics: &mut crate::mangled::_7_android_8_hardware_7_keymint_18_KeyCharacteristics, _arg_outCertChain: &mut Vec<crate::mangled::_7_android_8_hardware_7_keymint_11_Certificate>) -> binder::public_api::Result<()> { self.0.generateKey(_arg_keyParams, _arg_generatedKeyBlob, _arg_generatedKeyCharacteristics, _arg_outCertChain) } |
| 733 | fn importKey(&self, _arg_inKeyParams: &[crate::mangled::_7_android_8_hardware_7_keymint_12_KeyParameter], _arg_inKeyFormat: crate::mangled::_7_android_8_hardware_7_keymint_9_KeyFormat, _arg_inKeyData: &[u8], _arg_outImportedKeyBlob: &mut Vec<u8>, _arg_outImportedKeyCharacteristics: &mut crate::mangled::_7_android_8_hardware_7_keymint_18_KeyCharacteristics, _arg_outCertChain: &mut Vec<crate::mangled::_7_android_8_hardware_7_keymint_11_Certificate>) -> binder::public_api::Result<()> { self.0.importKey(_arg_inKeyParams, _arg_inKeyFormat, _arg_inKeyData, _arg_outImportedKeyBlob, _arg_outImportedKeyCharacteristics, _arg_outCertChain) } |
| 734 | fn importWrappedKey(&self, _arg_inWrappedKeyData: &[u8], _arg_inWrappingKeyBlob: &[u8], _arg_inMaskingKey: &[u8], _arg_inUnwrappingParams: &[crate::mangled::_7_android_8_hardware_7_keymint_12_KeyParameter], _arg_inPasswordSid: i64, _arg_inBiometricSid: i64, _arg_outImportedKeyBlob: &mut Vec<u8>, _arg_outImportedKeyCharacteristics: &mut crate::mangled::_7_android_8_hardware_7_keymint_18_KeyCharacteristics) -> binder::public_api::Result<()> { self.0.importWrappedKey(_arg_inWrappedKeyData, _arg_inWrappingKeyBlob, _arg_inMaskingKey, _arg_inUnwrappingParams, _arg_inPasswordSid, _arg_inBiometricSid, _arg_outImportedKeyBlob, _arg_outImportedKeyCharacteristics) } |
| 735 | fn upgradeKey(&self, _arg_inKeyBlobToUpgrade: &[u8], _arg_inUpgradeParams: &[crate::mangled::_7_android_8_hardware_7_keymint_12_KeyParameter]) -> binder::public_api::Result<Vec<u8>> { self.0.upgradeKey(_arg_inKeyBlobToUpgrade, _arg_inUpgradeParams) } |
| 736 | fn deleteKey(&self, _arg_inKeyBlob: &[u8]) -> binder::public_api::Result<()> { self.0.deleteKey(_arg_inKeyBlob) } |
| 737 | fn deleteAllKeys(&self) -> binder::public_api::Result<()> { self.0.deleteAllKeys() } |
| 738 | fn destroyAttestationIds(&self) -> binder::public_api::Result<()> { self.0.destroyAttestationIds() } |
| 739 | fn begin(&self, _arg_inPurpose: crate::mangled::_7_android_8_hardware_7_keymint_10_KeyPurpose, _arg_inKeyBlob: &[u8], _arg_inParams: &[crate::mangled::_7_android_8_hardware_7_keymint_12_KeyParameter], _arg_inAuthToken: &crate::mangled::_7_android_8_hardware_7_keymint_17_HardwareAuthToken) -> binder::public_api::Result<crate::mangled::_7_android_8_hardware_7_keymint_11_BeginResult> { self.0.begin(_arg_inPurpose, _arg_inKeyBlob, _arg_inParams, _arg_inAuthToken) } |
| 740 | } |
| 741 | fn on_transact(_aidl_service: &dyn IKeyMintDevice, _aidl_code: binder::TransactionCode, _aidl_data: &binder::parcel::Parcel, _aidl_reply: &mut binder::parcel::Parcel) -> binder::Result<()> { |
| 742 | match _aidl_code { |
| 743 | TRANSACTION_getHardwareInfo => { |
| 744 | let _aidl_return = _aidl_service.getHardwareInfo(); |
| 745 | match &_aidl_return { |
| 746 | Ok(_aidl_return) => { |
| 747 | _aidl_reply.write(&binder::Status::from(binder::StatusCode::OK))?; |
| 748 | _aidl_reply.write(_aidl_return)?; |
| 749 | } |
| 750 | Err(_aidl_status) => _aidl_reply.write(_aidl_status)? |
| 751 | } |
| 752 | Ok(()) |
| 753 | } |
| 754 | TRANSACTION_verifyAuthorization => { |
| 755 | let _arg_challenge: i64 = _aidl_data.read()?; |
| 756 | let _arg_parametersToVerify: Vec<crate::mangled::_7_android_8_hardware_7_keymint_12_KeyParameter> = _aidl_data.read()?; |
| 757 | let _arg_token: crate::mangled::_7_android_8_hardware_7_keymint_17_HardwareAuthToken = _aidl_data.read()?; |
| 758 | let _aidl_return = _aidl_service.verifyAuthorization(_arg_challenge, &_arg_parametersToVerify, &_arg_token); |
| 759 | match &_aidl_return { |
| 760 | Ok(_aidl_return) => { |
| 761 | _aidl_reply.write(&binder::Status::from(binder::StatusCode::OK))?; |
| 762 | _aidl_reply.write(_aidl_return)?; |
| 763 | } |
| 764 | Err(_aidl_status) => _aidl_reply.write(_aidl_status)? |
| 765 | } |
| 766 | Ok(()) |
| 767 | } |
| 768 | TRANSACTION_addRngEntropy => { |
| 769 | let _arg_data: Vec<u8> = _aidl_data.read()?; |
| 770 | let _aidl_return = _aidl_service.addRngEntropy(&_arg_data); |
| 771 | match &_aidl_return { |
| 772 | Ok(_aidl_return) => { |
| 773 | _aidl_reply.write(&binder::Status::from(binder::StatusCode::OK))?; |
| 774 | } |
| 775 | Err(_aidl_status) => _aidl_reply.write(_aidl_status)? |
| 776 | } |
| 777 | Ok(()) |
| 778 | } |
| 779 | TRANSACTION_generateKey => { |
| 780 | let _arg_keyParams: Vec<crate::mangled::_7_android_8_hardware_7_keymint_12_KeyParameter> = _aidl_data.read()?; |
| 781 | let mut _arg_generatedKeyBlob: Vec<u8> = Default::default(); |
| 782 | _aidl_data.resize_out_vec(&mut _arg_generatedKeyBlob)?; |
| 783 | let mut _arg_generatedKeyCharacteristics: crate::mangled::_7_android_8_hardware_7_keymint_18_KeyCharacteristics = Default::default(); |
| 784 | let mut _arg_outCertChain: Vec<crate::mangled::_7_android_8_hardware_7_keymint_11_Certificate> = Default::default(); |
| 785 | _aidl_data.resize_out_vec(&mut _arg_outCertChain)?; |
| 786 | let _aidl_return = _aidl_service.generateKey(&_arg_keyParams, &mut _arg_generatedKeyBlob, &mut _arg_generatedKeyCharacteristics, &mut _arg_outCertChain); |
| 787 | match &_aidl_return { |
| 788 | Ok(_aidl_return) => { |
| 789 | _aidl_reply.write(&binder::Status::from(binder::StatusCode::OK))?; |
| 790 | _aidl_reply.write(&_arg_generatedKeyBlob)?; |
| 791 | _aidl_reply.write(&_arg_generatedKeyCharacteristics)?; |
| 792 | _aidl_reply.write(&_arg_outCertChain)?; |
| 793 | } |
| 794 | Err(_aidl_status) => _aidl_reply.write(_aidl_status)? |
| 795 | } |
| 796 | Ok(()) |
| 797 | } |
| 798 | TRANSACTION_importKey => { |
| 799 | let _arg_inKeyParams: Vec<crate::mangled::_7_android_8_hardware_7_keymint_12_KeyParameter> = _aidl_data.read()?; |
| 800 | let _arg_inKeyFormat: crate::mangled::_7_android_8_hardware_7_keymint_9_KeyFormat = _aidl_data.read()?; |
| 801 | let _arg_inKeyData: Vec<u8> = _aidl_data.read()?; |
| 802 | let mut _arg_outImportedKeyBlob: Vec<u8> = Default::default(); |
| 803 | _aidl_data.resize_out_vec(&mut _arg_outImportedKeyBlob)?; |
| 804 | let mut _arg_outImportedKeyCharacteristics: crate::mangled::_7_android_8_hardware_7_keymint_18_KeyCharacteristics = Default::default(); |
| 805 | let mut _arg_outCertChain: Vec<crate::mangled::_7_android_8_hardware_7_keymint_11_Certificate> = Default::default(); |
| 806 | _aidl_data.resize_out_vec(&mut _arg_outCertChain)?; |
| 807 | let _aidl_return = _aidl_service.importKey(&_arg_inKeyParams, _arg_inKeyFormat, &_arg_inKeyData, &mut _arg_outImportedKeyBlob, &mut _arg_outImportedKeyCharacteristics, &mut _arg_outCertChain); |
| 808 | match &_aidl_return { |
| 809 | Ok(_aidl_return) => { |
| 810 | _aidl_reply.write(&binder::Status::from(binder::StatusCode::OK))?; |
| 811 | _aidl_reply.write(&_arg_outImportedKeyBlob)?; |
| 812 | _aidl_reply.write(&_arg_outImportedKeyCharacteristics)?; |
| 813 | _aidl_reply.write(&_arg_outCertChain)?; |
| 814 | } |
| 815 | Err(_aidl_status) => _aidl_reply.write(_aidl_status)? |
| 816 | } |
| 817 | Ok(()) |
| 818 | } |
| 819 | TRANSACTION_importWrappedKey => { |
| 820 | let _arg_inWrappedKeyData: Vec<u8> = _aidl_data.read()?; |
| 821 | let _arg_inWrappingKeyBlob: Vec<u8> = _aidl_data.read()?; |
| 822 | let _arg_inMaskingKey: Vec<u8> = _aidl_data.read()?; |
| 823 | let _arg_inUnwrappingParams: Vec<crate::mangled::_7_android_8_hardware_7_keymint_12_KeyParameter> = _aidl_data.read()?; |
| 824 | let _arg_inPasswordSid: i64 = _aidl_data.read()?; |
| 825 | let _arg_inBiometricSid: i64 = _aidl_data.read()?; |
| 826 | let mut _arg_outImportedKeyBlob: Vec<u8> = Default::default(); |
| 827 | _aidl_data.resize_out_vec(&mut _arg_outImportedKeyBlob)?; |
| 828 | let mut _arg_outImportedKeyCharacteristics: crate::mangled::_7_android_8_hardware_7_keymint_18_KeyCharacteristics = Default::default(); |
| 829 | let _aidl_return = _aidl_service.importWrappedKey(&_arg_inWrappedKeyData, &_arg_inWrappingKeyBlob, &_arg_inMaskingKey, &_arg_inUnwrappingParams, _arg_inPasswordSid, _arg_inBiometricSid, &mut _arg_outImportedKeyBlob, &mut _arg_outImportedKeyCharacteristics); |
| 830 | match &_aidl_return { |
| 831 | Ok(_aidl_return) => { |
| 832 | _aidl_reply.write(&binder::Status::from(binder::StatusCode::OK))?; |
| 833 | _aidl_reply.write(&_arg_outImportedKeyBlob)?; |
| 834 | _aidl_reply.write(&_arg_outImportedKeyCharacteristics)?; |
| 835 | } |
| 836 | Err(_aidl_status) => _aidl_reply.write(_aidl_status)? |
| 837 | } |
| 838 | Ok(()) |
| 839 | } |
| 840 | TRANSACTION_upgradeKey => { |
| 841 | let _arg_inKeyBlobToUpgrade: Vec<u8> = _aidl_data.read()?; |
| 842 | let _arg_inUpgradeParams: Vec<crate::mangled::_7_android_8_hardware_7_keymint_12_KeyParameter> = _aidl_data.read()?; |
| 843 | let _aidl_return = _aidl_service.upgradeKey(&_arg_inKeyBlobToUpgrade, &_arg_inUpgradeParams); |
| 844 | match &_aidl_return { |
| 845 | Ok(_aidl_return) => { |
| 846 | _aidl_reply.write(&binder::Status::from(binder::StatusCode::OK))?; |
| 847 | _aidl_reply.write(_aidl_return)?; |
| 848 | } |
| 849 | Err(_aidl_status) => _aidl_reply.write(_aidl_status)? |
| 850 | } |
| 851 | Ok(()) |
| 852 | } |
| 853 | TRANSACTION_deleteKey => { |
| 854 | let _arg_inKeyBlob: Vec<u8> = _aidl_data.read()?; |
| 855 | let _aidl_return = _aidl_service.deleteKey(&_arg_inKeyBlob); |
| 856 | match &_aidl_return { |
| 857 | Ok(_aidl_return) => { |
| 858 | _aidl_reply.write(&binder::Status::from(binder::StatusCode::OK))?; |
| 859 | } |
| 860 | Err(_aidl_status) => _aidl_reply.write(_aidl_status)? |
| 861 | } |
| 862 | Ok(()) |
| 863 | } |
| 864 | TRANSACTION_deleteAllKeys => { |
| 865 | let _aidl_return = _aidl_service.deleteAllKeys(); |
| 866 | match &_aidl_return { |
| 867 | Ok(_aidl_return) => { |
| 868 | _aidl_reply.write(&binder::Status::from(binder::StatusCode::OK))?; |
| 869 | } |
| 870 | Err(_aidl_status) => _aidl_reply.write(_aidl_status)? |
| 871 | } |
| 872 | Ok(()) |
| 873 | } |
| 874 | TRANSACTION_destroyAttestationIds => { |
| 875 | let _aidl_return = _aidl_service.destroyAttestationIds(); |
| 876 | match &_aidl_return { |
| 877 | Ok(_aidl_return) => { |
| 878 | _aidl_reply.write(&binder::Status::from(binder::StatusCode::OK))?; |
| 879 | } |
| 880 | Err(_aidl_status) => _aidl_reply.write(_aidl_status)? |
| 881 | } |
| 882 | Ok(()) |
| 883 | } |
| 884 | TRANSACTION_begin => { |
| 885 | let _arg_inPurpose: crate::mangled::_7_android_8_hardware_7_keymint_10_KeyPurpose = _aidl_data.read()?; |
| 886 | let _arg_inKeyBlob: Vec<u8> = _aidl_data.read()?; |
| 887 | let _arg_inParams: Vec<crate::mangled::_7_android_8_hardware_7_keymint_12_KeyParameter> = _aidl_data.read()?; |
| 888 | let _arg_inAuthToken: crate::mangled::_7_android_8_hardware_7_keymint_17_HardwareAuthToken = _aidl_data.read()?; |
| 889 | let _aidl_return = _aidl_service.begin(_arg_inPurpose, &_arg_inKeyBlob, &_arg_inParams, &_arg_inAuthToken); |
| 890 | match &_aidl_return { |
| 891 | Ok(_aidl_return) => { |
| 892 | _aidl_reply.write(&binder::Status::from(binder::StatusCode::OK))?; |
| 893 | _aidl_reply.write(_aidl_return)?; |
| 894 | } |
| 895 | Err(_aidl_status) => _aidl_reply.write(_aidl_status)? |
| 896 | } |
| 897 | Ok(()) |
| 898 | } |
| 899 | _ => Err(binder::StatusCode::UNKNOWN_TRANSACTION) |
| 900 | } |
| 901 | } |
| 902 | } |
| 903 | pub mod IKeyMintOperation { |
| 904 | #![allow(non_upper_case_globals)] |
| 905 | #![allow(non_snake_case)] |
| 906 | #[allow(unused_imports)] use binder::IBinder; |
| 907 | use binder::declare_binder_interface; |
| 908 | declare_binder_interface! { |
| 909 | IKeyMintOperation["android.hardware.keymint.IKeyMintOperation"] { |
| 910 | native: BnKeyMintOperation(on_transact), |
| 911 | proxy: BpKeyMintOperation { |
| 912 | }, |
| 913 | } |
| 914 | } |
| 915 | pub trait IKeyMintOperation: binder::Interface { |
| 916 | fn get_descriptor() -> &'static str where Self: Sized { "android.hardware.keymint.IKeyMintOperation" } |
| 917 | fn update(&self, _arg_inParams: &[crate::mangled::_7_android_8_hardware_7_keymint_12_KeyParameter], _arg_input: &[u8], _arg_inVerificationToken: &crate::mangled::_7_android_8_hardware_7_keymint_17_VerificationToken, _arg_outParams: &mut Vec<crate::mangled::_7_android_8_hardware_7_keymint_12_KeyParameter>, _arg_output: &mut Vec<u8>) -> binder::public_api::Result<i32> { |
| 918 | Err(binder::StatusCode::UNKNOWN_TRANSACTION.into()) |
| 919 | } |
| 920 | fn finish(&self, _arg_inParams: &[crate::mangled::_7_android_8_hardware_7_keymint_12_KeyParameter], _arg_input: &[u8], _arg_inSignature: &[u8], _arg_authToken: &crate::mangled::_7_android_8_hardware_7_keymint_17_HardwareAuthToken, _arg_inVerificationToken: &crate::mangled::_7_android_8_hardware_7_keymint_17_VerificationToken, _arg_outParams: &mut Vec<crate::mangled::_7_android_8_hardware_7_keymint_12_KeyParameter>, _arg_output: &mut Vec<u8>) -> binder::public_api::Result<()> { |
| 921 | Err(binder::StatusCode::UNKNOWN_TRANSACTION.into()) |
| 922 | } |
| 923 | fn abort(&self) -> binder::public_api::Result<()> { |
| 924 | Err(binder::StatusCode::UNKNOWN_TRANSACTION.into()) |
| 925 | } |
| 926 | fn getDefaultImpl() -> DefaultImpl where Self: Sized { |
| 927 | DEFAULT_IMPL.lock().unwrap().clone() |
| 928 | } |
| 929 | fn setDefaultImpl(d: DefaultImpl) -> DefaultImpl where Self: Sized { |
| 930 | std::mem::replace(&mut *DEFAULT_IMPL.lock().unwrap(), d) |
| 931 | } |
| 932 | } |
| 933 | pub const TRANSACTION_update: binder::TransactionCode = binder::SpIBinder::FIRST_CALL_TRANSACTION + 0; |
| 934 | pub const TRANSACTION_finish: binder::TransactionCode = binder::SpIBinder::FIRST_CALL_TRANSACTION + 1; |
| 935 | pub const TRANSACTION_abort: binder::TransactionCode = binder::SpIBinder::FIRST_CALL_TRANSACTION + 2; |
| 936 | pub type DefaultImpl = Option<std::sync::Arc<dyn IKeyMintOperation + Send + Sync>>; |
| 937 | use lazy_static::lazy_static; |
| 938 | lazy_static! { |
| 939 | static ref DEFAULT_IMPL: std::sync::Mutex<DefaultImpl> = std::sync::Mutex::new(None); |
| 940 | } |
| 941 | pub(crate) mod mangled { pub use super::IKeyMintOperation as _7_android_8_hardware_7_keymint_17_IKeyMintOperation; } |
| 942 | impl IKeyMintOperation for BpKeyMintOperation { |
| 943 | fn update(&self, _arg_inParams: &[crate::mangled::_7_android_8_hardware_7_keymint_12_KeyParameter], _arg_input: &[u8], _arg_inVerificationToken: &crate::mangled::_7_android_8_hardware_7_keymint_17_VerificationToken, _arg_outParams: &mut Vec<crate::mangled::_7_android_8_hardware_7_keymint_12_KeyParameter>, _arg_output: &mut Vec<u8>) -> binder::public_api::Result<i32> { |
| 944 | let _aidl_reply = self.binder.transact(TRANSACTION_update, 0, |_aidl_data| { |
| 945 | _aidl_data.write(_arg_inParams)?; |
| 946 | _aidl_data.write(_arg_input)?; |
| 947 | _aidl_data.write(_arg_inVerificationToken)?; |
| 948 | _aidl_data.write_slice_size(Some(_arg_outParams))?; |
| 949 | _aidl_data.write_slice_size(Some(_arg_output))?; |
| 950 | Ok(()) |
| 951 | }); |
| 952 | if let Err(binder::StatusCode::UNKNOWN_TRANSACTION) = _aidl_reply { |
| 953 | if let Some(_aidl_default_impl) = <Self as IKeyMintOperation>::getDefaultImpl() { |
| 954 | return _aidl_default_impl.update(_arg_inParams, _arg_input, _arg_inVerificationToken, _arg_outParams, _arg_output); |
| 955 | } |
| 956 | } |
| 957 | let _aidl_reply = _aidl_reply?; |
| 958 | let _aidl_status: binder::Status = _aidl_reply.read()?; |
| 959 | if !_aidl_status.is_ok() { return Err(_aidl_status); } |
| 960 | let _aidl_return: i32 = _aidl_reply.read()?; |
| 961 | *_arg_outParams = _aidl_reply.read()?; |
| 962 | *_arg_output = _aidl_reply.read()?; |
| 963 | Ok(_aidl_return) |
| 964 | } |
| 965 | fn finish(&self, _arg_inParams: &[crate::mangled::_7_android_8_hardware_7_keymint_12_KeyParameter], _arg_input: &[u8], _arg_inSignature: &[u8], _arg_authToken: &crate::mangled::_7_android_8_hardware_7_keymint_17_HardwareAuthToken, _arg_inVerificationToken: &crate::mangled::_7_android_8_hardware_7_keymint_17_VerificationToken, _arg_outParams: &mut Vec<crate::mangled::_7_android_8_hardware_7_keymint_12_KeyParameter>, _arg_output: &mut Vec<u8>) -> binder::public_api::Result<()> { |
| 966 | let _aidl_reply = self.binder.transact(TRANSACTION_finish, 0, |_aidl_data| { |
| 967 | _aidl_data.write(_arg_inParams)?; |
| 968 | _aidl_data.write(_arg_input)?; |
| 969 | _aidl_data.write(_arg_inSignature)?; |
| 970 | _aidl_data.write(_arg_authToken)?; |
| 971 | _aidl_data.write(_arg_inVerificationToken)?; |
| 972 | _aidl_data.write_slice_size(Some(_arg_outParams))?; |
| 973 | _aidl_data.write_slice_size(Some(_arg_output))?; |
| 974 | Ok(()) |
| 975 | }); |
| 976 | if let Err(binder::StatusCode::UNKNOWN_TRANSACTION) = _aidl_reply { |
| 977 | if let Some(_aidl_default_impl) = <Self as IKeyMintOperation>::getDefaultImpl() { |
| 978 | return _aidl_default_impl.finish(_arg_inParams, _arg_input, _arg_inSignature, _arg_authToken, _arg_inVerificationToken, _arg_outParams, _arg_output); |
| 979 | } |
| 980 | } |
| 981 | let _aidl_reply = _aidl_reply?; |
| 982 | let _aidl_status: binder::Status = _aidl_reply.read()?; |
| 983 | if !_aidl_status.is_ok() { return Err(_aidl_status); } |
| 984 | *_arg_outParams = _aidl_reply.read()?; |
| 985 | *_arg_output = _aidl_reply.read()?; |
| 986 | Ok(()) |
| 987 | } |
| 988 | fn abort(&self) -> binder::public_api::Result<()> { |
| 989 | let _aidl_reply = self.binder.transact(TRANSACTION_abort, 0, |_aidl_data| { |
| 990 | Ok(()) |
| 991 | }); |
| 992 | if let Err(binder::StatusCode::UNKNOWN_TRANSACTION) = _aidl_reply { |
| 993 | if let Some(_aidl_default_impl) = <Self as IKeyMintOperation>::getDefaultImpl() { |
| 994 | return _aidl_default_impl.abort(); |
| 995 | } |
| 996 | } |
| 997 | let _aidl_reply = _aidl_reply?; |
| 998 | let _aidl_status: binder::Status = _aidl_reply.read()?; |
| 999 | if !_aidl_status.is_ok() { return Err(_aidl_status); } |
| 1000 | Ok(()) |
| 1001 | } |
| 1002 | } |
| 1003 | impl IKeyMintOperation for binder::Binder<BnKeyMintOperation> { |
| 1004 | fn update(&self, _arg_inParams: &[crate::mangled::_7_android_8_hardware_7_keymint_12_KeyParameter], _arg_input: &[u8], _arg_inVerificationToken: &crate::mangled::_7_android_8_hardware_7_keymint_17_VerificationToken, _arg_outParams: &mut Vec<crate::mangled::_7_android_8_hardware_7_keymint_12_KeyParameter>, _arg_output: &mut Vec<u8>) -> binder::public_api::Result<i32> { self.0.update(_arg_inParams, _arg_input, _arg_inVerificationToken, _arg_outParams, _arg_output) } |
| 1005 | fn finish(&self, _arg_inParams: &[crate::mangled::_7_android_8_hardware_7_keymint_12_KeyParameter], _arg_input: &[u8], _arg_inSignature: &[u8], _arg_authToken: &crate::mangled::_7_android_8_hardware_7_keymint_17_HardwareAuthToken, _arg_inVerificationToken: &crate::mangled::_7_android_8_hardware_7_keymint_17_VerificationToken, _arg_outParams: &mut Vec<crate::mangled::_7_android_8_hardware_7_keymint_12_KeyParameter>, _arg_output: &mut Vec<u8>) -> binder::public_api::Result<()> { self.0.finish(_arg_inParams, _arg_input, _arg_inSignature, _arg_authToken, _arg_inVerificationToken, _arg_outParams, _arg_output) } |
| 1006 | fn abort(&self) -> binder::public_api::Result<()> { self.0.abort() } |
| 1007 | } |
| 1008 | fn on_transact(_aidl_service: &dyn IKeyMintOperation, _aidl_code: binder::TransactionCode, _aidl_data: &binder::parcel::Parcel, _aidl_reply: &mut binder::parcel::Parcel) -> binder::Result<()> { |
| 1009 | match _aidl_code { |
| 1010 | TRANSACTION_update => { |
| 1011 | let _arg_inParams: Vec<crate::mangled::_7_android_8_hardware_7_keymint_12_KeyParameter> = _aidl_data.read()?; |
| 1012 | let _arg_input: Vec<u8> = _aidl_data.read()?; |
| 1013 | let _arg_inVerificationToken: crate::mangled::_7_android_8_hardware_7_keymint_17_VerificationToken = _aidl_data.read()?; |
| 1014 | let mut _arg_outParams: Vec<crate::mangled::_7_android_8_hardware_7_keymint_12_KeyParameter> = Default::default(); |
| 1015 | _aidl_data.resize_out_vec(&mut _arg_outParams)?; |
| 1016 | let mut _arg_output: Vec<u8> = Default::default(); |
| 1017 | _aidl_data.resize_out_vec(&mut _arg_output)?; |
| 1018 | let _aidl_return = _aidl_service.update(&_arg_inParams, &_arg_input, &_arg_inVerificationToken, &mut _arg_outParams, &mut _arg_output); |
| 1019 | match &_aidl_return { |
| 1020 | Ok(_aidl_return) => { |
| 1021 | _aidl_reply.write(&binder::Status::from(binder::StatusCode::OK))?; |
| 1022 | _aidl_reply.write(_aidl_return)?; |
| 1023 | _aidl_reply.write(&_arg_outParams)?; |
| 1024 | _aidl_reply.write(&_arg_output)?; |
| 1025 | } |
| 1026 | Err(_aidl_status) => _aidl_reply.write(_aidl_status)? |
| 1027 | } |
| 1028 | Ok(()) |
| 1029 | } |
| 1030 | TRANSACTION_finish => { |
| 1031 | let _arg_inParams: Vec<crate::mangled::_7_android_8_hardware_7_keymint_12_KeyParameter> = _aidl_data.read()?; |
| 1032 | let _arg_input: Vec<u8> = _aidl_data.read()?; |
| 1033 | let _arg_inSignature: Vec<u8> = _aidl_data.read()?; |
| 1034 | let _arg_authToken: crate::mangled::_7_android_8_hardware_7_keymint_17_HardwareAuthToken = _aidl_data.read()?; |
| 1035 | let _arg_inVerificationToken: crate::mangled::_7_android_8_hardware_7_keymint_17_VerificationToken = _aidl_data.read()?; |
| 1036 | let mut _arg_outParams: Vec<crate::mangled::_7_android_8_hardware_7_keymint_12_KeyParameter> = Default::default(); |
| 1037 | _aidl_data.resize_out_vec(&mut _arg_outParams)?; |
| 1038 | let mut _arg_output: Vec<u8> = Default::default(); |
| 1039 | _aidl_data.resize_out_vec(&mut _arg_output)?; |
| 1040 | let _aidl_return = _aidl_service.finish(&_arg_inParams, &_arg_input, &_arg_inSignature, &_arg_authToken, &_arg_inVerificationToken, &mut _arg_outParams, &mut _arg_output); |
| 1041 | match &_aidl_return { |
| 1042 | Ok(_aidl_return) => { |
| 1043 | _aidl_reply.write(&binder::Status::from(binder::StatusCode::OK))?; |
| 1044 | _aidl_reply.write(&_arg_outParams)?; |
| 1045 | _aidl_reply.write(&_arg_output)?; |
| 1046 | } |
| 1047 | Err(_aidl_status) => _aidl_reply.write(_aidl_status)? |
| 1048 | } |
| 1049 | Ok(()) |
| 1050 | } |
| 1051 | TRANSACTION_abort => { |
| 1052 | let _aidl_return = _aidl_service.abort(); |
| 1053 | match &_aidl_return { |
| 1054 | Ok(_aidl_return) => { |
| 1055 | _aidl_reply.write(&binder::Status::from(binder::StatusCode::OK))?; |
| 1056 | } |
| 1057 | Err(_aidl_status) => _aidl_reply.write(_aidl_status)? |
| 1058 | } |
| 1059 | Ok(()) |
| 1060 | } |
| 1061 | _ => Err(binder::StatusCode::UNKNOWN_TRANSACTION) |
| 1062 | } |
| 1063 | } |
| 1064 | } |
| 1065 | pub mod KeyCharacteristics { |
| 1066 | pub struct KeyCharacteristics { |
| 1067 | pub softwareEnforced: Vec<crate::mangled::_7_android_8_hardware_7_keymint_12_KeyParameter>, |
| 1068 | pub hardwareEnforced: Vec<crate::mangled::_7_android_8_hardware_7_keymint_12_KeyParameter>, |
| 1069 | } |
| 1070 | pub(crate) mod mangled { pub use super::KeyCharacteristics as _7_android_8_hardware_7_keymint_18_KeyCharacteristics; } |
| 1071 | impl Default for KeyCharacteristics { |
| 1072 | fn default() -> Self { |
| 1073 | Self { |
| 1074 | softwareEnforced: Default::default(), |
| 1075 | hardwareEnforced: Default::default(), |
| 1076 | } |
| 1077 | } |
| 1078 | } |
| 1079 | impl binder::parcel::Serialize for KeyCharacteristics { |
| 1080 | fn serialize(&self, parcel: &mut binder::parcel::Parcel) -> binder::Result<()> { |
| 1081 | <Self as binder::parcel::SerializeOption>::serialize_option(Some(self), parcel) |
| 1082 | } |
| 1083 | } |
| 1084 | impl binder::parcel::SerializeArray for KeyCharacteristics {} |
| 1085 | impl binder::parcel::SerializeOption for KeyCharacteristics { |
| 1086 | fn serialize_option(this: Option<&Self>, parcel: &mut binder::parcel::Parcel) -> binder::Result<()> { |
| 1087 | let this = if let Some(this) = this { |
| 1088 | parcel.write(&1i32)?; |
| 1089 | this |
| 1090 | } else { |
| 1091 | return parcel.write(&0i32); |
| 1092 | }; |
| 1093 | let start_pos = parcel.get_data_position(); |
| 1094 | parcel.write(&0i32)?; |
| 1095 | parcel.write(&this.softwareEnforced)?; |
| 1096 | parcel.write(&this.hardwareEnforced)?; |
| 1097 | let end_pos = parcel.get_data_position(); |
| 1098 | let parcelable_size = (end_pos - start_pos) as i32; |
| 1099 | unsafe { parcel.set_data_position(start_pos)?; } |
| 1100 | parcel.write(&parcelable_size)?; |
| 1101 | unsafe { parcel.set_data_position(end_pos)?; } |
| 1102 | Ok(()) |
| 1103 | } |
| 1104 | } |
| 1105 | impl binder::parcel::Deserialize for KeyCharacteristics { |
| 1106 | fn deserialize(parcel: &binder::parcel::Parcel) -> binder::Result<Self> { |
| 1107 | <Self as binder::parcel::DeserializeOption>::deserialize_option(parcel) |
| 1108 | .transpose() |
| 1109 | .unwrap_or(Err(binder::StatusCode::UNEXPECTED_NULL)) |
| 1110 | } |
| 1111 | } |
| 1112 | impl binder::parcel::DeserializeArray for KeyCharacteristics {} |
| 1113 | impl binder::parcel::DeserializeOption for KeyCharacteristics { |
| 1114 | fn deserialize_option(parcel: &binder::parcel::Parcel) -> binder::Result<Option<Self>> { |
| 1115 | let status: i32 = parcel.read()?; |
| 1116 | if status == 0 { return Ok(None); } |
| 1117 | let start_pos = parcel.get_data_position(); |
| 1118 | let parcelable_size: i32 = parcel.read()?; |
| 1119 | if parcelable_size < 0 { return Err(binder::StatusCode::BAD_VALUE); } |
| 1120 | let mut result = Self::default(); |
| 1121 | result.softwareEnforced = parcel.read()?; |
| 1122 | if (parcel.get_data_position() - start_pos) >= parcelable_size { |
| 1123 | unsafe { parcel.set_data_position(start_pos + parcelable_size)?; } |
| 1124 | return Ok(Some(result)); |
| 1125 | } |
| 1126 | result.hardwareEnforced = parcel.read()?; |
| 1127 | if (parcel.get_data_position() - start_pos) >= parcelable_size { |
| 1128 | unsafe { parcel.set_data_position(start_pos + parcelable_size)?; } |
| 1129 | return Ok(Some(result)); |
| 1130 | } |
| 1131 | Ok(Some(result)) |
| 1132 | } |
| 1133 | } |
| 1134 | } |
| 1135 | pub mod KeyDerivationFunction { |
| 1136 | #![allow(non_upper_case_globals)] |
| 1137 | pub type KeyDerivationFunction = i32; |
| 1138 | pub const NONE: KeyDerivationFunction = 0; |
| 1139 | pub const RFC5869_SHA256: KeyDerivationFunction = 1; |
| 1140 | pub const ISO18033_2_KDF1_SHA1: KeyDerivationFunction = 2; |
| 1141 | pub const ISO18033_2_KDF1_SHA256: KeyDerivationFunction = 3; |
| 1142 | pub const ISO18033_2_KDF2_SHA1: KeyDerivationFunction = 4; |
| 1143 | pub const ISO18033_2_KDF2_SHA256: KeyDerivationFunction = 5; |
| 1144 | pub(crate) mod mangled { pub use super::KeyDerivationFunction as _7_android_8_hardware_7_keymint_21_KeyDerivationFunction; } |
| 1145 | } |
| 1146 | pub mod KeyFormat { |
| 1147 | #![allow(non_upper_case_globals)] |
| 1148 | pub type KeyFormat = i32; |
| 1149 | pub const X509: KeyFormat = 0; |
| 1150 | pub const PKCS8: KeyFormat = 1; |
| 1151 | pub const RAW: KeyFormat = 3; |
| 1152 | pub(crate) mod mangled { pub use super::KeyFormat as _7_android_8_hardware_7_keymint_9_KeyFormat; } |
| 1153 | } |
| 1154 | pub mod KeyMintHardwareInfo { |
| 1155 | pub struct KeyMintHardwareInfo { |
| 1156 | pub versionNumber: i32, |
| 1157 | pub securityLevel: crate::mangled::_7_android_8_hardware_7_keymint_13_SecurityLevel, |
| 1158 | pub keyMintName: String, |
| 1159 | pub keyMintAuthorName: String, |
| 1160 | } |
| 1161 | pub(crate) mod mangled { pub use super::KeyMintHardwareInfo as _7_android_8_hardware_7_keymint_19_KeyMintHardwareInfo; } |
| 1162 | impl Default for KeyMintHardwareInfo { |
| 1163 | fn default() -> Self { |
| 1164 | Self { |
| 1165 | versionNumber: 0, |
| 1166 | securityLevel: Default::default(), |
| 1167 | keyMintName: Default::default(), |
| 1168 | keyMintAuthorName: Default::default(), |
| 1169 | } |
| 1170 | } |
| 1171 | } |
| 1172 | impl binder::parcel::Serialize for KeyMintHardwareInfo { |
| 1173 | fn serialize(&self, parcel: &mut binder::parcel::Parcel) -> binder::Result<()> { |
| 1174 | <Self as binder::parcel::SerializeOption>::serialize_option(Some(self), parcel) |
| 1175 | } |
| 1176 | } |
| 1177 | impl binder::parcel::SerializeArray for KeyMintHardwareInfo {} |
| 1178 | impl binder::parcel::SerializeOption for KeyMintHardwareInfo { |
| 1179 | fn serialize_option(this: Option<&Self>, parcel: &mut binder::parcel::Parcel) -> binder::Result<()> { |
| 1180 | let this = if let Some(this) = this { |
| 1181 | parcel.write(&1i32)?; |
| 1182 | this |
| 1183 | } else { |
| 1184 | return parcel.write(&0i32); |
| 1185 | }; |
| 1186 | let start_pos = parcel.get_data_position(); |
| 1187 | parcel.write(&0i32)?; |
| 1188 | parcel.write(&this.versionNumber)?; |
| 1189 | parcel.write(&this.securityLevel)?; |
| 1190 | parcel.write(&this.keyMintName)?; |
| 1191 | parcel.write(&this.keyMintAuthorName)?; |
| 1192 | let end_pos = parcel.get_data_position(); |
| 1193 | let parcelable_size = (end_pos - start_pos) as i32; |
| 1194 | unsafe { parcel.set_data_position(start_pos)?; } |
| 1195 | parcel.write(&parcelable_size)?; |
| 1196 | unsafe { parcel.set_data_position(end_pos)?; } |
| 1197 | Ok(()) |
| 1198 | } |
| 1199 | } |
| 1200 | impl binder::parcel::Deserialize for KeyMintHardwareInfo { |
| 1201 | fn deserialize(parcel: &binder::parcel::Parcel) -> binder::Result<Self> { |
| 1202 | <Self as binder::parcel::DeserializeOption>::deserialize_option(parcel) |
| 1203 | .transpose() |
| 1204 | .unwrap_or(Err(binder::StatusCode::UNEXPECTED_NULL)) |
| 1205 | } |
| 1206 | } |
| 1207 | impl binder::parcel::DeserializeArray for KeyMintHardwareInfo {} |
| 1208 | impl binder::parcel::DeserializeOption for KeyMintHardwareInfo { |
| 1209 | fn deserialize_option(parcel: &binder::parcel::Parcel) -> binder::Result<Option<Self>> { |
| 1210 | let status: i32 = parcel.read()?; |
| 1211 | if status == 0 { return Ok(None); } |
| 1212 | let start_pos = parcel.get_data_position(); |
| 1213 | let parcelable_size: i32 = parcel.read()?; |
| 1214 | if parcelable_size < 0 { return Err(binder::StatusCode::BAD_VALUE); } |
| 1215 | let mut result = Self::default(); |
| 1216 | result.versionNumber = parcel.read()?; |
| 1217 | if (parcel.get_data_position() - start_pos) >= parcelable_size { |
| 1218 | unsafe { parcel.set_data_position(start_pos + parcelable_size)?; } |
| 1219 | return Ok(Some(result)); |
| 1220 | } |
| 1221 | result.securityLevel = parcel.read()?; |
| 1222 | if (parcel.get_data_position() - start_pos) >= parcelable_size { |
| 1223 | unsafe { parcel.set_data_position(start_pos + parcelable_size)?; } |
| 1224 | return Ok(Some(result)); |
| 1225 | } |
| 1226 | result.keyMintName = parcel.read()?; |
| 1227 | if (parcel.get_data_position() - start_pos) >= parcelable_size { |
| 1228 | unsafe { parcel.set_data_position(start_pos + parcelable_size)?; } |
| 1229 | return Ok(Some(result)); |
| 1230 | } |
| 1231 | result.keyMintAuthorName = parcel.read()?; |
| 1232 | if (parcel.get_data_position() - start_pos) >= parcelable_size { |
| 1233 | unsafe { parcel.set_data_position(start_pos + parcelable_size)?; } |
| 1234 | return Ok(Some(result)); |
| 1235 | } |
| 1236 | Ok(Some(result)) |
| 1237 | } |
| 1238 | } |
| 1239 | } |
| 1240 | pub mod KeyOrigin { |
| 1241 | #![allow(non_upper_case_globals)] |
| 1242 | pub type KeyOrigin = i32; |
| 1243 | pub const GENERATED: KeyOrigin = 0; |
| 1244 | pub const DERIVED: KeyOrigin = 1; |
| 1245 | pub const IMPORTED: KeyOrigin = 2; |
| 1246 | pub const SECURELY_IMPORTED: KeyOrigin = 4; |
| 1247 | pub(crate) mod mangled { pub use super::KeyOrigin as _7_android_8_hardware_7_keymint_9_KeyOrigin; } |
| 1248 | } |
| 1249 | pub mod KeyParameter { |
| 1250 | pub struct KeyParameter { |
| 1251 | pub tag: crate::mangled::_7_android_8_hardware_7_keymint_3_Tag, |
| 1252 | pub boolValue: bool, |
| 1253 | pub integer: i32, |
| 1254 | pub longInteger: i64, |
| 1255 | pub dateTime: i64, |
| 1256 | pub blob: Vec<u8>, |
| 1257 | } |
| 1258 | pub(crate) mod mangled { pub use super::KeyParameter as _7_android_8_hardware_7_keymint_12_KeyParameter; } |
| 1259 | impl Default for KeyParameter { |
| 1260 | fn default() -> Self { |
| 1261 | Self { |
| 1262 | tag: Default::default(), |
| 1263 | boolValue: false, |
| 1264 | integer: 0, |
| 1265 | longInteger: 0, |
| 1266 | dateTime: 0, |
| 1267 | blob: Default::default(), |
| 1268 | } |
| 1269 | } |
| 1270 | } |
| 1271 | impl binder::parcel::Serialize for KeyParameter { |
| 1272 | fn serialize(&self, parcel: &mut binder::parcel::Parcel) -> binder::Result<()> { |
| 1273 | <Self as binder::parcel::SerializeOption>::serialize_option(Some(self), parcel) |
| 1274 | } |
| 1275 | } |
| 1276 | impl binder::parcel::SerializeArray for KeyParameter {} |
| 1277 | impl binder::parcel::SerializeOption for KeyParameter { |
| 1278 | fn serialize_option(this: Option<&Self>, parcel: &mut binder::parcel::Parcel) -> binder::Result<()> { |
| 1279 | let this = if let Some(this) = this { |
| 1280 | parcel.write(&1i32)?; |
| 1281 | this |
| 1282 | } else { |
| 1283 | return parcel.write(&0i32); |
| 1284 | }; |
| 1285 | let start_pos = parcel.get_data_position(); |
| 1286 | parcel.write(&0i32)?; |
| 1287 | parcel.write(&this.tag)?; |
| 1288 | parcel.write(&this.boolValue)?; |
| 1289 | parcel.write(&this.integer)?; |
| 1290 | parcel.write(&this.longInteger)?; |
| 1291 | parcel.write(&this.dateTime)?; |
| 1292 | parcel.write(&this.blob)?; |
| 1293 | let end_pos = parcel.get_data_position(); |
| 1294 | let parcelable_size = (end_pos - start_pos) as i32; |
| 1295 | unsafe { parcel.set_data_position(start_pos)?; } |
| 1296 | parcel.write(&parcelable_size)?; |
| 1297 | unsafe { parcel.set_data_position(end_pos)?; } |
| 1298 | Ok(()) |
| 1299 | } |
| 1300 | } |
| 1301 | impl binder::parcel::Deserialize for KeyParameter { |
| 1302 | fn deserialize(parcel: &binder::parcel::Parcel) -> binder::Result<Self> { |
| 1303 | <Self as binder::parcel::DeserializeOption>::deserialize_option(parcel) |
| 1304 | .transpose() |
| 1305 | .unwrap_or(Err(binder::StatusCode::UNEXPECTED_NULL)) |
| 1306 | } |
| 1307 | } |
| 1308 | impl binder::parcel::DeserializeArray for KeyParameter {} |
| 1309 | impl binder::parcel::DeserializeOption for KeyParameter { |
| 1310 | fn deserialize_option(parcel: &binder::parcel::Parcel) -> binder::Result<Option<Self>> { |
| 1311 | let status: i32 = parcel.read()?; |
| 1312 | if status == 0 { return Ok(None); } |
| 1313 | let start_pos = parcel.get_data_position(); |
| 1314 | let parcelable_size: i32 = parcel.read()?; |
| 1315 | if parcelable_size < 0 { return Err(binder::StatusCode::BAD_VALUE); } |
| 1316 | let mut result = Self::default(); |
| 1317 | result.tag = parcel.read()?; |
| 1318 | if (parcel.get_data_position() - start_pos) >= parcelable_size { |
| 1319 | unsafe { parcel.set_data_position(start_pos + parcelable_size)?; } |
| 1320 | return Ok(Some(result)); |
| 1321 | } |
| 1322 | result.boolValue = parcel.read()?; |
| 1323 | if (parcel.get_data_position() - start_pos) >= parcelable_size { |
| 1324 | unsafe { parcel.set_data_position(start_pos + parcelable_size)?; } |
| 1325 | return Ok(Some(result)); |
| 1326 | } |
| 1327 | result.integer = parcel.read()?; |
| 1328 | if (parcel.get_data_position() - start_pos) >= parcelable_size { |
| 1329 | unsafe { parcel.set_data_position(start_pos + parcelable_size)?; } |
| 1330 | return Ok(Some(result)); |
| 1331 | } |
| 1332 | result.longInteger = parcel.read()?; |
| 1333 | if (parcel.get_data_position() - start_pos) >= parcelable_size { |
| 1334 | unsafe { parcel.set_data_position(start_pos + parcelable_size)?; } |
| 1335 | return Ok(Some(result)); |
| 1336 | } |
| 1337 | result.dateTime = parcel.read()?; |
| 1338 | if (parcel.get_data_position() - start_pos) >= parcelable_size { |
| 1339 | unsafe { parcel.set_data_position(start_pos + parcelable_size)?; } |
| 1340 | return Ok(Some(result)); |
| 1341 | } |
| 1342 | result.blob = parcel.read()?; |
| 1343 | if (parcel.get_data_position() - start_pos) >= parcelable_size { |
| 1344 | unsafe { parcel.set_data_position(start_pos + parcelable_size)?; } |
| 1345 | return Ok(Some(result)); |
| 1346 | } |
| 1347 | Ok(Some(result)) |
| 1348 | } |
| 1349 | } |
| 1350 | } |
| 1351 | pub mod KeyPurpose { |
| 1352 | #![allow(non_upper_case_globals)] |
| 1353 | pub type KeyPurpose = i32; |
| 1354 | pub const ENCRYPT: KeyPurpose = 0; |
| 1355 | pub const DECRYPT: KeyPurpose = 1; |
| 1356 | pub const SIGN: KeyPurpose = 2; |
| 1357 | pub const VERIFY: KeyPurpose = 3; |
| 1358 | pub const WRAP_KEY: KeyPurpose = 5; |
| 1359 | pub(crate) mod mangled { pub use super::KeyPurpose as _7_android_8_hardware_7_keymint_10_KeyPurpose; } |
| 1360 | } |
| 1361 | pub mod PaddingMode { |
| 1362 | #![allow(non_upper_case_globals)] |
| 1363 | pub type PaddingMode = i32; |
| 1364 | pub const NONE: PaddingMode = 1; |
| 1365 | pub const RSA_OAEP: PaddingMode = 2; |
| 1366 | pub const RSA_PSS: PaddingMode = 3; |
| 1367 | pub const RSA_PKCS1_1_5_ENCRYPT: PaddingMode = 4; |
| 1368 | pub const RSA_PKCS1_1_5_SIGN: PaddingMode = 5; |
| 1369 | pub const PKCS7: PaddingMode = 64; |
| 1370 | pub(crate) mod mangled { pub use super::PaddingMode as _7_android_8_hardware_7_keymint_11_PaddingMode; } |
| 1371 | } |
| 1372 | pub mod SecurityLevel { |
| 1373 | #![allow(non_upper_case_globals)] |
| 1374 | pub type SecurityLevel = i32; |
| 1375 | pub const SOFTWARE: SecurityLevel = 0; |
| 1376 | pub const TRUSTED_ENVIRONMENT: SecurityLevel = 1; |
| 1377 | pub const STRONGBOX: SecurityLevel = 2; |
| 1378 | pub(crate) mod mangled { pub use super::SecurityLevel as _7_android_8_hardware_7_keymint_13_SecurityLevel; } |
| 1379 | } |
| 1380 | pub mod Tag { |
| 1381 | #![allow(non_upper_case_globals)] |
| 1382 | pub type Tag = i32; |
| 1383 | pub const INVALID: Tag = 0; |
| 1384 | pub const PURPOSE: Tag = 536870913; |
| 1385 | pub const ALGORITHM: Tag = 268435458; |
| 1386 | pub const KEY_SIZE: Tag = 805306371; |
| 1387 | pub const BLOCK_MODE: Tag = 536870916; |
| 1388 | pub const DIGEST: Tag = 536870917; |
| 1389 | pub const PADDING: Tag = 536870918; |
| 1390 | pub const CALLER_NONCE: Tag = 1879048199; |
| 1391 | pub const MIN_MAC_LENGTH: Tag = 805306376; |
| 1392 | pub const EC_CURVE: Tag = 268435466; |
| 1393 | pub const RSA_PUBLIC_EXPONENT: Tag = 1342177480; |
| 1394 | pub const INCLUDE_UNIQUE_ID: Tag = 1879048394; |
| 1395 | pub const BLOB_USAGE_REQUIREMENTS: Tag = 268435757; |
| 1396 | pub const BOOTLOADER_ONLY: Tag = 1879048494; |
| 1397 | pub const ROLLBACK_RESISTANCE: Tag = 1879048495; |
| 1398 | pub const HARDWARE_TYPE: Tag = 268435760; |
| 1399 | pub const EARLY_BOOT_ONLY: Tag = 1879048497; |
| 1400 | pub const ACTIVE_DATETIME: Tag = 1610613136; |
| 1401 | pub const ORIGINATION_EXPIRE_DATETIME: Tag = 1610613137; |
| 1402 | pub const USAGE_EXPIRE_DATETIME: Tag = 1610613138; |
| 1403 | pub const MIN_SECONDS_BETWEEN_OPS: Tag = 805306771; |
| 1404 | pub const MAX_USES_PER_BOOT: Tag = 805306772; |
| 1405 | pub const USER_ID: Tag = 805306869; |
| 1406 | pub const USER_SECURE_ID: Tag = 1073742326; |
| 1407 | pub const NO_AUTH_REQUIRED: Tag = 1879048695; |
| 1408 | pub const USER_AUTH_TYPE: Tag = 268435960; |
| 1409 | pub const AUTH_TIMEOUT: Tag = 805306873; |
| 1410 | pub const ALLOW_WHILE_ON_BODY: Tag = 1879048698; |
| 1411 | pub const TRUSTED_USER_PRESENCE_REQUIRED: Tag = 1879048699; |
| 1412 | pub const TRUSTED_CONFIRMATION_REQUIRED: Tag = 1879048700; |
| 1413 | pub const UNLOCKED_DEVICE_REQUIRED: Tag = 1879048701; |
| 1414 | pub const APPLICATION_ID: Tag = -1879047591; |
| 1415 | pub const APPLICATION_DATA: Tag = -1879047492; |
| 1416 | pub const CREATION_DATETIME: Tag = 1610613437; |
| 1417 | pub const ORIGIN: Tag = 268436158; |
| 1418 | pub const ROOT_OF_TRUST: Tag = -1879047488; |
| 1419 | pub const OS_VERSION: Tag = 805307073; |
| 1420 | pub const OS_PATCHLEVEL: Tag = 805307074; |
| 1421 | pub const UNIQUE_ID: Tag = -1879047485; |
| 1422 | pub const ATTESTATION_CHALLENGE: Tag = -1879047484; |
| 1423 | pub const ATTESTATION_APPLICATION_ID: Tag = -1879047483; |
| 1424 | pub const ATTESTATION_ID_BRAND: Tag = -1879047482; |
| 1425 | pub const ATTESTATION_ID_DEVICE: Tag = -1879047481; |
| 1426 | pub const ATTESTATION_ID_PRODUCT: Tag = -1879047480; |
| 1427 | pub const ATTESTATION_ID_SERIAL: Tag = -1879047479; |
| 1428 | pub const ATTESTATION_ID_IMEI: Tag = -1879047478; |
| 1429 | pub const ATTESTATION_ID_MEID: Tag = -1879047477; |
| 1430 | pub const ATTESTATION_ID_MANUFACTURER: Tag = -1879047476; |
| 1431 | pub const ATTESTATION_ID_MODEL: Tag = -1879047475; |
| 1432 | pub const VENDOR_PATCHLEVEL: Tag = 805307086; |
| 1433 | pub const BOOT_PATCHLEVEL: Tag = 805307087; |
| 1434 | pub const DEVICE_UNIQUE_ATTESTATION: Tag = 1879048912; |
| 1435 | pub const IDENTITY_CREDENTIAL_KEY: Tag = 1879048913; |
| 1436 | pub const STORAGE_KEY: Tag = 1879048914; |
| 1437 | pub const ASSOCIATED_DATA: Tag = -1879047192; |
| 1438 | pub const NONCE: Tag = -1879047191; |
| 1439 | pub const MAC_LENGTH: Tag = 805307371; |
| 1440 | pub const RESET_SINCE_ID_ROTATION: Tag = 1879049196; |
| 1441 | pub const CONFIRMATION_TOKEN: Tag = -1879047187; |
| 1442 | pub(crate) mod mangled { pub use super::Tag as _7_android_8_hardware_7_keymint_3_Tag; } |
| 1443 | } |
| 1444 | pub mod TagType { |
| 1445 | #![allow(non_upper_case_globals)] |
| 1446 | pub type TagType = i32; |
| 1447 | pub const INVALID: TagType = 0; |
| 1448 | pub const ENUM: TagType = 268435456; |
| 1449 | pub const ENUM_REP: TagType = 536870912; |
| 1450 | pub const UINT: TagType = 805306368; |
| 1451 | pub const UINT_REP: TagType = 1073741824; |
| 1452 | pub const ULONG: TagType = 1342177280; |
| 1453 | pub const DATE: TagType = 1610612736; |
| 1454 | pub const BOOL: TagType = 1879048192; |
| 1455 | pub const BIGNUM: TagType = -2147483648; |
| 1456 | pub const BYTES: TagType = -1879048192; |
| 1457 | pub const ULONG_REP: TagType = -1610612736; |
| 1458 | pub(crate) mod mangled { pub use super::TagType as _7_android_8_hardware_7_keymint_7_TagType; } |
| 1459 | } |
| 1460 | pub mod Timestamp { |
| 1461 | pub struct Timestamp { |
| 1462 | pub milliSeconds: i64, |
| 1463 | } |
| 1464 | pub(crate) mod mangled { pub use super::Timestamp as _7_android_8_hardware_7_keymint_9_Timestamp; } |
| 1465 | impl Default for Timestamp { |
| 1466 | fn default() -> Self { |
| 1467 | Self { |
| 1468 | milliSeconds: 0, |
| 1469 | } |
| 1470 | } |
| 1471 | } |
| 1472 | impl binder::parcel::Serialize for Timestamp { |
| 1473 | fn serialize(&self, parcel: &mut binder::parcel::Parcel) -> binder::Result<()> { |
| 1474 | <Self as binder::parcel::SerializeOption>::serialize_option(Some(self), parcel) |
| 1475 | } |
| 1476 | } |
| 1477 | impl binder::parcel::SerializeArray for Timestamp {} |
| 1478 | impl binder::parcel::SerializeOption for Timestamp { |
| 1479 | fn serialize_option(this: Option<&Self>, parcel: &mut binder::parcel::Parcel) -> binder::Result<()> { |
| 1480 | let this = if let Some(this) = this { |
| 1481 | parcel.write(&1i32)?; |
| 1482 | this |
| 1483 | } else { |
| 1484 | return parcel.write(&0i32); |
| 1485 | }; |
| 1486 | let start_pos = parcel.get_data_position(); |
| 1487 | parcel.write(&0i32)?; |
| 1488 | parcel.write(&this.milliSeconds)?; |
| 1489 | let end_pos = parcel.get_data_position(); |
| 1490 | let parcelable_size = (end_pos - start_pos) as i32; |
| 1491 | unsafe { parcel.set_data_position(start_pos)?; } |
| 1492 | parcel.write(&parcelable_size)?; |
| 1493 | unsafe { parcel.set_data_position(end_pos)?; } |
| 1494 | Ok(()) |
| 1495 | } |
| 1496 | } |
| 1497 | impl binder::parcel::Deserialize for Timestamp { |
| 1498 | fn deserialize(parcel: &binder::parcel::Parcel) -> binder::Result<Self> { |
| 1499 | <Self as binder::parcel::DeserializeOption>::deserialize_option(parcel) |
| 1500 | .transpose() |
| 1501 | .unwrap_or(Err(binder::StatusCode::UNEXPECTED_NULL)) |
| 1502 | } |
| 1503 | } |
| 1504 | impl binder::parcel::DeserializeArray for Timestamp {} |
| 1505 | impl binder::parcel::DeserializeOption for Timestamp { |
| 1506 | fn deserialize_option(parcel: &binder::parcel::Parcel) -> binder::Result<Option<Self>> { |
| 1507 | let status: i32 = parcel.read()?; |
| 1508 | if status == 0 { return Ok(None); } |
| 1509 | let start_pos = parcel.get_data_position(); |
| 1510 | let parcelable_size: i32 = parcel.read()?; |
| 1511 | if parcelable_size < 0 { return Err(binder::StatusCode::BAD_VALUE); } |
| 1512 | let mut result = Self::default(); |
| 1513 | result.milliSeconds = parcel.read()?; |
| 1514 | if (parcel.get_data_position() - start_pos) >= parcelable_size { |
| 1515 | unsafe { parcel.set_data_position(start_pos + parcelable_size)?; } |
| 1516 | return Ok(Some(result)); |
| 1517 | } |
| 1518 | Ok(Some(result)) |
| 1519 | } |
| 1520 | } |
| 1521 | } |
| 1522 | pub mod VerificationToken { |
| 1523 | pub struct VerificationToken { |
| 1524 | pub challenge: i64, |
| 1525 | pub timestamp: crate::mangled::_7_android_8_hardware_7_keymint_9_Timestamp, |
| 1526 | pub securityLevel: crate::mangled::_7_android_8_hardware_7_keymint_13_SecurityLevel, |
| 1527 | pub mac: Vec<u8>, |
| 1528 | } |
| 1529 | pub(crate) mod mangled { pub use super::VerificationToken as _7_android_8_hardware_7_keymint_17_VerificationToken; } |
| 1530 | impl Default for VerificationToken { |
| 1531 | fn default() -> Self { |
| 1532 | Self { |
| 1533 | challenge: 0, |
| 1534 | timestamp: Default::default(), |
| 1535 | securityLevel: Default::default(), |
| 1536 | mac: Default::default(), |
| 1537 | } |
| 1538 | } |
| 1539 | } |
| 1540 | impl binder::parcel::Serialize for VerificationToken { |
| 1541 | fn serialize(&self, parcel: &mut binder::parcel::Parcel) -> binder::Result<()> { |
| 1542 | <Self as binder::parcel::SerializeOption>::serialize_option(Some(self), parcel) |
| 1543 | } |
| 1544 | } |
| 1545 | impl binder::parcel::SerializeArray for VerificationToken {} |
| 1546 | impl binder::parcel::SerializeOption for VerificationToken { |
| 1547 | fn serialize_option(this: Option<&Self>, parcel: &mut binder::parcel::Parcel) -> binder::Result<()> { |
| 1548 | let this = if let Some(this) = this { |
| 1549 | parcel.write(&1i32)?; |
| 1550 | this |
| 1551 | } else { |
| 1552 | return parcel.write(&0i32); |
| 1553 | }; |
| 1554 | let start_pos = parcel.get_data_position(); |
| 1555 | parcel.write(&0i32)?; |
| 1556 | parcel.write(&this.challenge)?; |
| 1557 | parcel.write(&this.timestamp)?; |
| 1558 | parcel.write(&this.securityLevel)?; |
| 1559 | parcel.write(&this.mac)?; |
| 1560 | let end_pos = parcel.get_data_position(); |
| 1561 | let parcelable_size = (end_pos - start_pos) as i32; |
| 1562 | unsafe { parcel.set_data_position(start_pos)?; } |
| 1563 | parcel.write(&parcelable_size)?; |
| 1564 | unsafe { parcel.set_data_position(end_pos)?; } |
| 1565 | Ok(()) |
| 1566 | } |
| 1567 | } |
| 1568 | impl binder::parcel::Deserialize for VerificationToken { |
| 1569 | fn deserialize(parcel: &binder::parcel::Parcel) -> binder::Result<Self> { |
| 1570 | <Self as binder::parcel::DeserializeOption>::deserialize_option(parcel) |
| 1571 | .transpose() |
| 1572 | .unwrap_or(Err(binder::StatusCode::UNEXPECTED_NULL)) |
| 1573 | } |
| 1574 | } |
| 1575 | impl binder::parcel::DeserializeArray for VerificationToken {} |
| 1576 | impl binder::parcel::DeserializeOption for VerificationToken { |
| 1577 | fn deserialize_option(parcel: &binder::parcel::Parcel) -> binder::Result<Option<Self>> { |
| 1578 | let status: i32 = parcel.read()?; |
| 1579 | if status == 0 { return Ok(None); } |
| 1580 | let start_pos = parcel.get_data_position(); |
| 1581 | let parcelable_size: i32 = parcel.read()?; |
| 1582 | if parcelable_size < 0 { return Err(binder::StatusCode::BAD_VALUE); } |
| 1583 | let mut result = Self::default(); |
| 1584 | result.challenge = parcel.read()?; |
| 1585 | if (parcel.get_data_position() - start_pos) >= parcelable_size { |
| 1586 | unsafe { parcel.set_data_position(start_pos + parcelable_size)?; } |
| 1587 | return Ok(Some(result)); |
| 1588 | } |
| 1589 | result.timestamp = parcel.read()?; |
| 1590 | if (parcel.get_data_position() - start_pos) >= parcelable_size { |
| 1591 | unsafe { parcel.set_data_position(start_pos + parcelable_size)?; } |
| 1592 | return Ok(Some(result)); |
| 1593 | } |
| 1594 | result.securityLevel = parcel.read()?; |
| 1595 | if (parcel.get_data_position() - start_pos) >= parcelable_size { |
| 1596 | unsafe { parcel.set_data_position(start_pos + parcelable_size)?; } |
| 1597 | return Ok(Some(result)); |
| 1598 | } |
| 1599 | result.mac = parcel.read()?; |
| 1600 | if (parcel.get_data_position() - start_pos) >= parcelable_size { |
| 1601 | unsafe { parcel.set_data_position(start_pos + parcelable_size)?; } |
| 1602 | return Ok(Some(result)); |
| 1603 | } |
| 1604 | Ok(Some(result)) |
| 1605 | } |
| 1606 | } |
| 1607 | } |
| 1608 | } |
| 1609 | } |
| 1610 | } |
| 1611 | } |
| 1612 | pub mod mangled { |
| 1613 | pub use super::aidl::android::hardware::keymint::Algorithm::mangled::*; |
| 1614 | pub use super::aidl::android::hardware::keymint::BeginResult::mangled::*; |
| 1615 | pub use super::aidl::android::hardware::keymint::BlockMode::mangled::*; |
| 1616 | pub use super::aidl::android::hardware::keymint::Certificate::mangled::*; |
| 1617 | pub use super::aidl::android::hardware::keymint::Constants::mangled::*; |
| 1618 | pub use super::aidl::android::hardware::keymint::Digest::mangled::*; |
| 1619 | pub use super::aidl::android::hardware::keymint::EcCurve::mangled::*; |
| 1620 | pub use super::aidl::android::hardware::keymint::ErrorCode::mangled::*; |
| 1621 | pub use super::aidl::android::hardware::keymint::HardwareAuthToken::mangled::*; |
| 1622 | pub use super::aidl::android::hardware::keymint::HardwareAuthenticatorType::mangled::*; |
| 1623 | pub use super::aidl::android::hardware::keymint::HmacSharingParameters::mangled::*; |
| 1624 | pub use super::aidl::android::hardware::keymint::IKeyMintDevice::mangled::*; |
| 1625 | pub use super::aidl::android::hardware::keymint::IKeyMintOperation::mangled::*; |
| 1626 | pub use super::aidl::android::hardware::keymint::KeyCharacteristics::mangled::*; |
| 1627 | pub use super::aidl::android::hardware::keymint::KeyDerivationFunction::mangled::*; |
| 1628 | pub use super::aidl::android::hardware::keymint::KeyFormat::mangled::*; |
| 1629 | pub use super::aidl::android::hardware::keymint::KeyMintHardwareInfo::mangled::*; |
| 1630 | pub use super::aidl::android::hardware::keymint::KeyOrigin::mangled::*; |
| 1631 | pub use super::aidl::android::hardware::keymint::KeyParameter::mangled::*; |
| 1632 | pub use super::aidl::android::hardware::keymint::KeyPurpose::mangled::*; |
| 1633 | pub use super::aidl::android::hardware::keymint::PaddingMode::mangled::*; |
| 1634 | pub use super::aidl::android::hardware::keymint::SecurityLevel::mangled::*; |
| 1635 | pub use super::aidl::android::hardware::keymint::Tag::mangled::*; |
| 1636 | pub use super::aidl::android::hardware::keymint::TagType::mangled::*; |
| 1637 | pub use super::aidl::android::hardware::keymint::Timestamp::mangled::*; |
| 1638 | pub use super::aidl::android::hardware::keymint::VerificationToken::mangled::*; |
| 1639 | } |