Shawn Willden | 128ffe0 | 2014-08-06 12:31:33 -0600 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 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 | |
Shawn Willden | 301646f | 2014-08-08 21:44:10 -0600 | [diff] [blame] | 17 | #ifndef SYSTEM_KEYMASTER_GOOGLE_SOFT_KEYMASTER_H_ |
| 18 | #define SYSTEM_KEYMASTER_GOOGLE_SOFT_KEYMASTER_H_ |
Shawn Willden | 128ffe0 | 2014-08-06 12:31:33 -0600 | [diff] [blame] | 19 | |
| 20 | #include "google_keymaster.h" |
| 21 | |
| 22 | namespace keymaster { |
| 23 | |
| 24 | class GoogleSoftKeymaster : public GoogleKeymaster { |
| 25 | public: |
| 26 | bool is_enforced(keymaster_tag_t /* tag */) { return false; } |
| 27 | keymaster_key_origin_t origin() { return KM_ORIGIN_SOFTWARE; } |
| 28 | |
| 29 | private: |
| 30 | static uint8_t master_key_[]; |
| 31 | |
Shawn Willden | 4db3fbd | 2014-08-08 22:13:44 -0600 | [diff] [blame^] | 32 | keymaster_key_blob_t MasterKey() { |
| 33 | keymaster_key_blob_t blob; |
| 34 | blob.key_material = master_key_; |
| 35 | blob.key_material_size = 16; |
| 36 | return blob; |
| 37 | } |
Shawn Willden | 128ffe0 | 2014-08-06 12:31:33 -0600 | [diff] [blame] | 38 | |
Shawn Willden | 4db3fbd | 2014-08-08 22:13:44 -0600 | [diff] [blame^] | 39 | void GenerateNonce(uint8_t* nonce, size_t length) { |
Shawn Willden | 128ffe0 | 2014-08-06 12:31:33 -0600 | [diff] [blame] | 40 | for (size_t i = 0; i < length; ++i) |
| 41 | nonce[i] = 0; |
| 42 | } |
| 43 | }; |
| 44 | |
| 45 | uint8_t GoogleSoftKeymaster::master_key_[16] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; |
| 46 | |
| 47 | } // namespace |
| 48 | |
Shawn Willden | 301646f | 2014-08-08 21:44:10 -0600 | [diff] [blame] | 49 | #endif // SYSTEM_KEYMASTER_GOOGLE_SOFT_KEYMASTER_H_ |