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