Thai Duong | fabacaf | 2015-03-25 20:14:57 -0700 | [diff] [blame^] | 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 SYSTEM_KEYMASTER_KDF_H_ |
| 18 | #define SYSTEM_KEYMASTER_KDF_H_ |
| 19 | |
| 20 | #include <keymaster/serializable.h> |
| 21 | |
| 22 | namespace keymaster { |
| 23 | |
| 24 | // Kdf is an abstract class that provides an interface to a |
| 25 | // key derivation function. |
| 26 | class Kdf { |
| 27 | public: |
| 28 | virtual ~Kdf() {} |
| 29 | |
| 30 | virtual bool Init(Buffer& secret, Buffer& salt, Buffer& info, size_t key_bytes_to_generate) = 0; |
| 31 | virtual bool Init(const uint8_t* secret, size_t secret_len, const uint8_t* salt, |
| 32 | size_t salt_len, const uint8_t* info, size_t info_len, |
| 33 | size_t key_bytes_to_generate) = 0; |
| 34 | |
| 35 | virtual bool secret_key(Buffer* buf) const = 0; |
| 36 | }; |
| 37 | |
| 38 | } // namespace keymaster |
| 39 | |
| 40 | #endif // SYSTEM_KEYMASTER_KDF_H_ |