Home | History | Annotate | Download | only in hardware
      1 /*
      2  * Copyright (C) 2014 The Android Open Source Project
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 
     17 #include <stdint.h>
     18 
     19 #ifndef ANDROID_HARDWARE_HW_AUTH_TOKEN_H
     20 #define ANDROID_HARDWARE_HW_AUTH_TOKEN_H
     21 
     22 #ifdef __cplusplus
     23 extern "C" {
     24 #endif  // __cplusplus
     25 
     26 #define HW_AUTH_TOKEN_VERSION 0
     27 
     28 typedef enum {
     29     HW_AUTH_NONE = 0,
     30     HW_AUTH_PASSWORD = 1 << 0,
     31     HW_AUTH_FINGERPRINT = 1 << 1,
     32     // Additional entries should be powers of 2.
     33     HW_AUTH_ANY = UINT32_MAX,
     34 } hw_authenticator_type_t;
     35 
     36 /**
     37  * Data format for an authentication record used to prove successful authentication.
     38  */
     39 typedef struct __attribute__((__packed__)) {
     40     uint8_t version;  // Current version is 0
     41     uint64_t challenge;
     42     uint64_t user_id;             // secure user ID, not Android user ID
     43     uint64_t authenticator_id;    // secure authenticator ID
     44     uint32_t authenticator_type;  // hw_authenticator_type_t, in network order
     45     uint64_t timestamp;           // in network order
     46     uint8_t hmac[32];
     47 } hw_auth_token_t;
     48 
     49 #ifdef __cplusplus
     50 }  // extern "C"
     51 #endif  // __cplusplus
     52 
     53 #endif  // ANDROID_HARDWARE_HW_AUTH_TOKEN_H
     54