blob: 776ca1b61fc821073616c761846dd5b46cc96e79 [file] [log] [blame]
Shawn Willdend67afae2014-08-19 12:36:27 -06001/*
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 Willden95e13822014-12-15 16:12:16 -070017#include "key.h"
18
Shawn Willden437fbd12014-08-20 11:59:49 -060019#include <openssl/x509.h>
20
Shawn Willden437fbd12014-08-20 11:59:49 -060021#include "openssl_utils.h"
Shawn Willdend67afae2014-08-19 12:36:27 -060022
Shawn Willdend67afae2014-08-19 12:36:27 -060023namespace keymaster {
24
Shawn Willdena278f612014-12-23 11:22:21 -070025/* static */
26template <> KeyFactoryRegistry* KeyFactoryRegistry::instance_ptr = 0;
Shawn Willden437fbd12014-08-20 11:59:49 -060027
Shawn Willden0cb69422015-05-26 08:31:37 -060028Key::Key(const AuthorizationSet& hw_enforced, const AuthorizationSet& sw_enforced,
29 keymaster_error_t* error) {
30 assert(error);
31 authorizations_.push_back(hw_enforced);
32 authorizations_.push_back(sw_enforced);
33 *error = KM_ERROR_OK;
34 if (authorizations_.is_valid() != AuthorizationSet::OK)
35 *error = KM_ERROR_MEMORY_ALLOCATION_FAILED;
Shawn Willdend67afae2014-08-19 12:36:27 -060036}
Shawn Willdend67afae2014-08-19 12:36:27 -060037} // namespace keymaster