2 * Copyright (c) 2018 Samsung Electronics Co., Ltd All Rights Reserved
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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
16 * @file ode-tests-common.cpp
17 * @author Pawel Kowalski (p.kowalski2@partner.samsung.com)
18 * @brief Tests for the ODE API
21 #include <dpl/log/log.h>
23 #include "ode-tests-common.h"
25 #define ERRORDESCRIBE(name) case name: return #name
27 const char* ODEErrorToString(int error) {
29 ERRORDESCRIBE(ODE_ERROR_NONE);
30 ERRORDESCRIBE(ODE_ERROR_INVALID_PARAMETER);
31 ERRORDESCRIBE(ODE_ERROR_CONNECTION_REFUSED);
32 ERRORDESCRIBE(ODE_ERROR_PERMISSION_DENIED);
33 ERRORDESCRIBE(ODE_ERROR_NO_SUCH_FILE);
34 ERRORDESCRIBE(ODE_ERROR_NO_SUCH_DEVICE);
35 ERRORDESCRIBE(ODE_ERROR_KEY_REJECTED);
36 ERRORDESCRIBE(ODE_ERROR_NO_DATA);
37 ERRORDESCRIBE(ODE_ERROR_RESOURCE_BUSY);
38 ERRORDESCRIBE(ODE_ERROR_UNKNOWN);
39 default: return "Error not defined";
45 HelperKeys::HelperKeys(const char* device, const char* password, bool initialize) {
51 assert_positive(ode_key_is_initialized, dev, &result);
54 assert_positive(ode_key_init, dev, pass, ODE_KEY_DEFAULT_256BIT);
59 HelperKeys::~HelperKeys() {
60 ode_key_remove_master_key(dev);
61 ode_key_remove(dev, pass);