Home | History | Annotate | Download | only in gatekeeper
      1 /*
      2  * Copyright 2015 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 #ifndef GATEKEEPER_PASSWORD_HANDLE_H_
     18 #define GATEKEEPER_PASSWORD_HANDLE_H_
     19 
     20 #define HANDLE_FLAG_THROTTLE_SECURE 1
     21 
     22 #define HANDLE_VERSION_THROTTLE 2
     23 
     24 namespace gatekeeper {
     25 
     26 typedef uint64_t secure_id_t;
     27 typedef uint64_t salt_t;
     28 /**
     29  * structure for easy serialization
     30  * and deserialization of password handles.
     31  */
     32 static const uint8_t HANDLE_VERSION = 2;
     33 struct __attribute__ ((__packed__)) password_handle_t {
     34     // fields included in signature
     35     uint8_t version;
     36     secure_id_t user_id;
     37     uint64_t flags;
     38 
     39     // fields not included in signature
     40     salt_t salt;
     41     uint8_t signature[32];
     42 
     43     bool hardware_backed;
     44 };
     45 }
     46 
     47 #endif // GATEKEEPER_PASSWORD_HANDLE_H_
     48