Refactor base64 implementation 19/240019/8
authorMateusz Cegielka <m.cegielka@samsung.com>
Fri, 31 Jul 2020 11:12:52 +0000 (13:12 +0200)
committerKrzysztof Jackiewicz <k.jackiewicz@samsung.com>
Wed, 2 Sep 2020 10:34:05 +0000 (10:34 +0000)
commit198def3c4d5e0cb8ad1e85fab43caf557dab9d10
tree00a31e8e955e6d2379523722195cc0186bbebeca
parent39b2753ce5be83421d819cc0a60b9bda628291f7
Refactor base64 implementation

This codebase contains two slightly different base64 encoding wrappers,
both using low-level OpenSSL BIO API. The wrappers provide access to a
streaming interface, despite the fact that this property is not used
anywhere. To handle errors, the wrappers sometimes use exceptions and
sometimes return codes. To implement this, a stateful class was used,
and these four facts resulted in needlessly verbose code.

I have merged the two implementations and simplified them to two free
functions. The encode function now uses higher-level OpenSSL EVP API,
and the decode function was refactored.

Change-Id: I5016723158321d0c1aa10810aa9067cd2249f38e
19 files changed:
common/base64_generic.cpp [new file with mode: 0644]
common/base64_generic.h [new file with mode: 0644]
misc/ckm_db_tool/CMakeLists.txt
misc/ckm_db_tool/db-wrapper.cpp
misc/ckm_initial_values/CMakeLists.txt
misc/ckm_initial_values/base64.cpp [deleted file]
misc/ckm_initial_values/base64.h [deleted file]
misc/ckm_initial_values/main.cpp
src/CMakeLists.txt
src/manager/CMakeLists.txt
src/manager/common/base64.cpp [deleted file]
src/manager/common/base64.h
src/manager/common/certificate-impl.cpp
src/manager/initial-values/BufferHandler.cpp
src/manager/initial-values/InitialValuesFile.cpp
src/manager/service/crypto-logic.cpp
unit-tests/CMakeLists.txt
unit-tests/test_base64.cpp
unit-tests/test_crypto-logic.cpp