1 //
2 // Copyright (C) 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 TPM_MANAGER_SERVER_OPENSSL_CRYPTO_UTIL_IMPL_H_
18 #define TPM_MANAGER_SERVER_OPENSSL_CRYPTO_UTIL_IMPL_H_
19 
20 #include <string>
21 
22 #include <base/compiler_specific.h>
23 #include <base/macros.h>
24 
25 #include "tpm_manager/server/openssl_crypto_util.h"
26 
27 namespace tpm_manager {
28 
29 // OpensslCryptoUtilImpl is the default implementation of the
30 // OpensslCryptoUtil interface.
31 // Example usage:
32 // OpensslCryptoUtilImpl util;
33 // std::string random_bytes;
34 // bool result = util.GetRandomBytes(5, &random_bytes);
35 class OpensslCryptoUtilImpl : public OpensslCryptoUtil {
36  public:
37   OpensslCryptoUtilImpl() = default;
38   ~OpensslCryptoUtilImpl() override = default;
39 
40   // OpensslCryptoUtil methods.
41   bool GetRandomBytes(size_t num_bytes,
42                       std::string* random_data) override WARN_UNUSED_RESULT;
43 
44  private:
45   DISALLOW_COPY_AND_ASSIGN(OpensslCryptoUtilImpl);
46 };
47 
48 }  // namespace tpm_manager
49 
50 #endif  // TPM_MANAGER_SERVER_OPENSSL_CRYPTO_UTIL_IMPL_H_
51