blob: dacaf21ad6b6991b9f56a8d2ed3077d8ede0fc43 [file] [log] [blame]
Shawn Willden63ac0432014-12-29 14:07:08 -07001/*
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
17#include "operation.h"
18
19namespace keymaster {
20
Shawn Willdend92591d2014-12-30 18:19:10 -070021bool OperationFactory::supported(keymaster_padding_t padding) const {
22 size_t padding_count;
23 const keymaster_padding_t* supported_paddings = SupportedPaddingModes(&padding_count);
24 for (size_t i = 0; i < padding_count; ++i)
25 if (padding == supported_paddings[i])
26 return true;
27 return false;
28}
29
30bool OperationFactory::supported(keymaster_block_mode_t block_mode) const {
31 size_t block_mode_count;
32 const keymaster_block_mode_t* supported_block_modes = SupportedBlockModes(&block_mode_count);
33 for (size_t i = 0; i < block_mode_count; ++i)
34 if (block_mode == supported_block_modes[i])
35 return true;
36 return false;
37}
38
39bool OperationFactory::supported(keymaster_digest_t digest) const {
40 size_t digest_count;
41 const keymaster_digest_t* supported_digests = SupportedDigests(&digest_count);
42 for (size_t i = 0; i < digest_count; ++i)
43 if (digest == supported_digests[i])
44 return true;
45 return false;
46}
47
Shawn Willden63ac0432014-12-29 14:07:08 -070048} // namespace keymaster