Skip to content

Commit

Permalink
hotplace rev.501 grooming
Browse files Browse the repository at this point in the history
  • Loading branch information
princeb612 committed Apr 21, 2024
1 parent e011b51 commit 76381bb
Show file tree
Hide file tree
Showing 107 changed files with 454 additions and 533 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,14 @@

## studying

* RFC 2068 Hypertext Transfer Protocol -- HTTP/1.1
* RFC 2817 Upgrading to TLS Within HTTP/1.1
* RFC 7540 Hypertext Transfer Protocol Version 2 (HTTP/2)
* RFC 7541 HPACK: Header Compression for HTTP/2
* RFC 9114 HTTP/3

## next time

* RFC 2068 Hypertext Transfer Protocol -- HTTP/1.1
* RFC 8778 Use of the HSS/LMS Hash-Based Signature Algorithm with CBOR Object Signing and Encryption (COSE)
* RFC 9021 Use of the Walnut Digital Signature Algorithm with CBOR Object Signing and Encryption (COSE)
* RFC 9054 CBOR Object Signing and Encryption (COSE): Hash Algorithms
Expand Down
10 changes: 9 additions & 1 deletion sdk/base.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,22 @@
#include <sdk/base/basic/base64.hpp>
#include <sdk/base/basic/cmdline.hpp>
#include <sdk/base/basic/console_color.hpp>
#include <sdk/base/basic/constexpr_obfuscate.hpp>
#include <sdk/base/basic/dump_memory.hpp>
#include <sdk/base/basic/ieee754.hpp>
#include <sdk/base/basic/obfuscate_string.hpp>
#include <sdk/base/basic/valist.hpp>
#include <sdk/base/basic/variant.hpp>

/* stream */
#include <sdk/base/stream/basic_stream.hpp>
#include <sdk/base/stream/bufferio.hpp>
#include <sdk/base/stream/printf.hpp>

/* string */
#include <sdk/base/string/string.hpp>

/* system */
#include <sdk/base/system/atomic.hpp>
#include <sdk/base/system/critical_section.hpp>
#include <sdk/base/system/datetime.hpp>
Expand All @@ -52,11 +59,12 @@
#include <sdk/base/system/thread.hpp>
#include <sdk/base/system/trace.hpp>
#include <sdk/base/system/types.hpp>

#if defined _WIN32 || defined _WIN64
#include <sdk/base/system/windows/sdk.hpp>
#include <sdk/base/system/windows/windows_version.hpp>
#endif

/* unittest */
#include <sdk/base/unittest/testcase.hpp>

#endif
18 changes: 16 additions & 2 deletions sdk/crypto.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,20 @@
#ifndef __HOTPLACE_SDK_CRYPTO__
#define __HOTPLACE_SDK_CRYPTO__

/* top-most */
#include <sdk/base.hpp>
#include <sdk/crypto/crypto.hpp>
#include <sdk/crypto/types.hpp>
#include <sdk/io.hpp>

/* authenticode */
#include <sdk/crypto/authenticode/authenticode.hpp>
#include <sdk/crypto/authenticode/authenticode_plugin.hpp>
#include <sdk/crypto/authenticode/authenticode_plugin_pe.hpp>
#include <sdk/crypto/authenticode/authenticode_verifier.hpp>
#include <sdk/crypto/authenticode/sdk.hpp>

/* basic */
#include <sdk/crypto/basic/crypto_advisor.hpp>
#include <sdk/crypto/basic/crypto_key.hpp>
#include <sdk/crypto/basic/crypto_keychain.hpp>
Expand All @@ -30,16 +39,21 @@
#include <sdk/crypto/basic/openssl_sign.hpp>
#include <sdk/crypto/basic/time_otp.hpp>
#include <sdk/crypto/basic/types.hpp>

/* COSE */
#include <sdk/crypto/cose/cbor_object_encryption.hpp>
#include <sdk/crypto/cose/cbor_object_signing.hpp>
#include <sdk/crypto/cose/cbor_object_signing_encryption.hpp>
#include <sdk/crypto/cose/cbor_web_key.hpp>
#include <sdk/crypto/cose/cose_composer.hpp>
#include <sdk/crypto/cose/types.hpp>

/* JOSE */
#include <sdk/crypto/jose/json_object_encryption.hpp>
#include <sdk/crypto/jose/json_object_signing.hpp>
#include <sdk/crypto/jose/json_object_signing_encryption.hpp>
#include <sdk/crypto/jose/json_web_key.hpp>
#include <sdk/crypto/jose/json_web_signature.hpp>
#include <sdk/crypto/types.hpp>
#include <sdk/io.hpp>
#include <sdk/crypto/jose/types.hpp>

#endif
3 changes: 2 additions & 1 deletion sdk/crypto/authenticode/authenticode_plugin.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
#define __HOTPLACE_SDK_CRYPTO_AUTHENTICODE_PLUGIN__

#include <list>
#include <sdk/io/stream/file_stream.hpp>
#include <sdk/base.hpp>
#include <sdk/io.hpp>
#include <string>

namespace hotplace {
Expand Down
7 changes: 1 addition & 6 deletions sdk/crypto/authenticode/authenticode_verifier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,17 @@
*/

#include <map>
#include <sdk/base/stl.hpp>
#include <sdk/base/system/critical_section.hpp>
#include <sdk/base/system/thread.hpp>
#include <sdk/base/system/trace.hpp>
#include <sdk/base.hpp>
#include <sdk/crypto/authenticode/authenticode_plugin_pe.hpp>
#include <sdk/crypto/authenticode/authenticode_verifier.hpp>
#include <sdk/crypto/authenticode/sdk.hpp>
#include <sdk/crypto/basic/openssl_sdk.hpp>
#include <sdk/io/string/string.hpp>
#include <sdk/io/system/sdk.hpp>
#include <sdk/net/basic/sdk.hpp>
#include <set>

namespace hotplace {
using namespace io;
using namespace net;
namespace crypto {

#define AUTHENTICODE_CONTEXT_SIGNATURE 0x20170710
Expand Down
2 changes: 0 additions & 2 deletions sdk/crypto/authenticode/authenticode_verifier.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,8 @@
#include <sdk/base.hpp>
#include <sdk/crypto/authenticode/authenticode_plugin.hpp>
#include <sdk/crypto/basic/openssl_hash.hpp>
//#include <sdk/io/stream/file_stream.hpp>

namespace hotplace {
// using namespace io;
namespace crypto {

class authenticode_plugin;
Expand Down
1 change: 1 addition & 0 deletions sdk/crypto/authenticode/sdk.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#ifndef __HOTPLACE_SDK_CRYPTO_AUTHENTICODE_SDK__
#define __HOTPLACE_SDK_CRYPTO_AUTHENTICODE_SDK__

#include <sdk/base.hpp>
#include <sdk/crypto/basic/types.hpp>
#include <set>
#include <string>
Expand Down
6 changes: 3 additions & 3 deletions sdk/crypto/cose/cbor_object_signing_encryption.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ return_t cbor_object_signing_encryption::encrypt(cose_context_t* handle, crypto_
return ret;
}

return_t cbor_object_signing_encryption::encrypt2(cose_context_t* handle, crypto_key* key, binary_t const& input, binary_t& output) {
return_t cbor_object_signing_encryption::encrypt(cose_context_t* handle, crypto_key* key, binary_t const& input, binary_t& output) {
return_t ret = errorcode_t::success;

__try2 {
Expand Down Expand Up @@ -259,7 +259,7 @@ return_t cbor_object_signing_encryption::sign(cose_context_t* handle, crypto_key
return ret;
}

return_t cbor_object_signing_encryption::sign2(cose_context_t* handle, crypto_key* key, binary_t const& input, binary_t& output) {
return_t cbor_object_signing_encryption::sign(cose_context_t* handle, crypto_key* key, binary_t const& input, binary_t& output) {
return_t ret = errorcode_t::success;

__try2 {
Expand Down Expand Up @@ -323,7 +323,7 @@ return_t cbor_object_signing_encryption::mac(cose_context_t* handle, crypto_key*
return ret;
}

return_t cbor_object_signing_encryption::mac2(cose_context_t* handle, crypto_key* key, binary_t const& input, binary_t& output) {
return_t cbor_object_signing_encryption::mac(cose_context_t* handle, crypto_key* key, binary_t const& input, binary_t& output) {
return_t ret = errorcode_t::success;

__try2 {
Expand Down
12 changes: 6 additions & 6 deletions sdk/crypto/cose/cbor_object_signing_encryption.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,11 @@ class cbor_object_signing_encryption {
* recipient.get_protected().add(cose_key_t::cose_alg, keyalg);
*
* // fill others and compose
* ret = cose.encrypt2(handle, key, input, cbor);
* ret = cose.encrypt(handle, key, input, cbor);
* }
* cose.close(handle);
*/
return_t encrypt2(cose_context_t* handle, crypto_key* key, binary_t const& input, binary_t& output);
return_t encrypt(cose_context_t* handle, crypto_key* key, binary_t const& input, binary_t& output);
/**
* @brief decrypt
* @param cose_context_t* handle [in]
Expand Down Expand Up @@ -190,11 +190,11 @@ class cbor_object_signing_encryption {
* body.get_protected().add(cose_key_t::cose_alg, alg);
*
* // fill others and compose
* ret = cose.sign2(handle, key, input, cbor);
* ret = cose.sign(handle, key, input, cbor);
*
* cose.close(handle);
*/
return_t sign2(cose_context_t* handle, crypto_key* key, binary_t const& input, binary_t& output);
return_t sign(cose_context_t* handle, crypto_key* key, binary_t const& input, binary_t& output);
/**
* @brief mac
* @param cose_context_t* handle [in]
Expand Down Expand Up @@ -249,11 +249,11 @@ class cbor_object_signing_encryption {
* recipient.get_protected().add(cose_key_t::cose_alg, keyalg);
*
* // fill others and compose
* ret = cose.mac2(handle, key, input, cbor);
* ret = cose.mac(handle, key, input, cbor);
* }
* cose.close(handle);
*/
return_t mac2(cose_context_t* handle, crypto_key* key, binary_t const& input, binary_t& output);
return_t mac(cose_context_t* handle, crypto_key* key, binary_t const& input, binary_t& output);
/**
* @brief verify with kid
* @param cose_context_t* handle [in]
Expand Down
2 changes: 0 additions & 2 deletions sdk/crypto/jose/json_object_encryption.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@

#include <iostream>
#include <sdk/base.hpp>
#include <sdk/base/basic/base64.hpp>
#include <sdk/base/stream/basic_stream.hpp>
#include <sdk/crypto/basic/crypto_advisor.hpp>
#include <sdk/crypto/basic/crypto_keychain.hpp>
#include <sdk/crypto/basic/evp_key.hpp>
Expand Down
2 changes: 0 additions & 2 deletions sdk/crypto/jose/json_object_signing_encryption.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@

#include <iostream>
#include <sdk/base.hpp>
#include <sdk/base/basic/base64.hpp>
#include <sdk/base/stream/basic_stream.hpp>
#include <sdk/crypto/basic/crypto_advisor.hpp>
#include <sdk/crypto/basic/crypto_keychain.hpp>
#include <sdk/crypto/basic/openssl_prng.hpp>
Expand Down
15 changes: 14 additions & 1 deletion sdk/io.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,18 @@
#ifndef __HOTPLACE_SDK_IO__
#define __HOTPLACE_SDK_IO__

/* top-most */
#include <sdk/base.hpp>
#include <sdk/io/types.hpp>

/* basic */
#include <sdk/io/basic/json.hpp>
#include <sdk/io/basic/keyvalue.hpp>
#include <sdk/io/basic/mlfq.hpp>
#include <sdk/io/basic/payload.hpp>
#include <sdk/io/basic/zlib.hpp>

/* CBOR */
#include <sdk/io/cbor/cbor_array.hpp>
#include <sdk/io/cbor/cbor_data.hpp>
#include <sdk/io/cbor/cbor_encode.hpp>
Expand All @@ -25,14 +31,21 @@
#include <sdk/io/cbor/cbor_publisher.hpp>
#include <sdk/io/cbor/cbor_reader.hpp>
#include <sdk/io/cbor/cbor_visitor.hpp>
#include <sdk/io/cbor/concise_binary_object_representation.hpp>

/* stream */
#include <sdk/io/stream/file_stream.hpp>
#include <sdk/io/stream/stream.hpp>
#include <sdk/io/stream/string.hpp>

/* string */
#include <sdk/io/string/string.hpp>

/* system */
#include <sdk/io/system/multiplexer.hpp>
#include <sdk/io/system/sdk.hpp>
#include <sdk/io/system/types.hpp>
#include <sdk/io/types.hpp>
#include <sdk/io/system/windows_pe.hpp>
#if defined __linux__
#elif defined _WIN32 || defined _WIN64
#include <sdk/io/system/windows/windows_registry.hpp>
Expand Down
2 changes: 1 addition & 1 deletion sdk/io/basic/json.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

#include <jansson.h>

#include <sdk/base/system/trace.hpp>
#include <sdk/base.hpp>
#include <sdk/io/system/sdk.hpp>

namespace hotplace {
Expand Down
2 changes: 1 addition & 1 deletion sdk/io/basic/keyvalue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* Date Name Description
*/

#include <sdk/base/system/critical_section.hpp>
#include <sdk/base.hpp>
#include <sdk/io/basic/keyvalue.hpp>

namespace hotplace {
Expand Down
2 changes: 0 additions & 2 deletions sdk/io/basic/keyvalue.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@

#include <map>
#include <sdk/base.hpp>
#include <sdk/base/system/critical_section.hpp>
#include <unordered_map>

namespace hotplace {
namespace io {
Expand Down
1 change: 0 additions & 1 deletion sdk/io/basic/zlib.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#define __HOTPLACE_SDK_IO_BASIC_ZLIB__

#include <sdk/base.hpp>
#include <sdk/io/stream/stream.hpp>

namespace hotplace {
namespace io {
Expand Down
3 changes: 1 addition & 2 deletions sdk/io/cbor/cbor_encode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
* 2023.09.01 Soo Han, Kim refactor
*/

#include <sdk/base/basic/ieee754.hpp>
#include <sdk/base/basic/variant.hpp>
#include <sdk/base.hpp>
#include <sdk/io/cbor/cbor_encode.hpp>
#include <sdk/io/system/types.hpp>

Expand Down
1 change: 0 additions & 1 deletion sdk/io/cbor/cbor_object.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
#include <deque>
#include <sdk/base.hpp>
#include <sdk/io/cbor/concise_binary_object_representation.hpp>
#include <sdk/io/stream/stream.hpp>

namespace hotplace {
namespace io {
Expand Down
1 change: 0 additions & 1 deletion sdk/io/cbor/concise_binary_object_representation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@

#include <deque>
#include <sdk/base.hpp>
#include <sdk/io/stream/stream.hpp>

namespace hotplace {
namespace io {
Expand Down
2 changes: 1 addition & 1 deletion sdk/io/stream/ansi_string.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* Date Name Description
*/

#include <sdk/base/stream/basic_stream.hpp>
#include <sdk/base.hpp>
#include <sdk/io/stream/string.hpp>
#include <sdk/io/string/string.hpp>

Expand Down
3 changes: 1 addition & 2 deletions sdk/io/stream/dump_memory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
* Date Name Description
*/

#include <sdk/base/basic/dump_memory.hpp>
#include <sdk/base/stream/basic_stream.hpp>
#include <sdk/base.hpp>
#include <sdk/io/stream/stream.hpp>

namespace hotplace {
Expand Down
5 changes: 1 addition & 4 deletions sdk/io/stream/printf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,7 @@
*/

#include <map>
#include <sdk/base/basic/base16.hpp>
#include <sdk/base/basic/ieee754.hpp>
#include <sdk/base/basic/valist.hpp>
#include <sdk/base/stl.hpp>
#include <sdk/base.hpp>
#include <sdk/io/stream/stream.hpp>
#include <sdk/io/stream/string.hpp>
#include <sdk/io/string/string.hpp>
Expand Down
5 changes: 1 addition & 4 deletions sdk/io/stream/stream.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@
#ifndef __HOTPLACE_SDK_STREAM_STREAM__
#define __HOTPLACE_SDK_STREAM_STREAM__

#include <sdk/base/basic/valist.hpp>
#include <sdk/base/stream.hpp>
#include <sdk/base/stream/basic_stream.hpp>
#include <sdk/base/stream/bufferio.hpp>
#include <sdk/base.hpp>

namespace hotplace {
namespace io {
Expand Down
2 changes: 1 addition & 1 deletion sdk/io/stream/string.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#ifndef __HOTPLACE_SDK_IO_STREAM_STRING__
#define __HOTPLACE_SDK_IO_STREAM_STRING__

#include <sdk/base/stream/bufferio.hpp>
#include <sdk/base.hpp>
#include <sdk/io/stream/stream.hpp>

namespace hotplace {
Expand Down
Loading

0 comments on commit 76381bb

Please sign in to comment.