feat: port GIP protocol and auth stack
Port the GIP protocol and authentication layers from medusalix/xone into the C++ stack: - crypto: SHA-256/HMAC (CommonCrypto), RSA PKCS#1 (Security.framework), and a self-contained P-256 ECDH validated against OpenSSL vectors - auth: v1 (RSA) and v2 (ECDH) handshake state machine - gip: header/varint/chunk handling and packet dispatch, with the kernel device model replaced by transport + client_listener interfaces Adds test_crypto, test_auth, and test_gip suites. Co-Authored-By: deepseek (deepseek/deepseek-v4-pro-0813): ported crypto, auth, and GIP
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
#pragma once
|
||||
|
||||
// ==============================================================================
|
||||
// Minimal printf-style logger
|
||||
// ==============================================================================
|
||||
// Replaces the kernel's dev_dbg/dev_err from medusalix/xone. Writes to
|
||||
// stderr; the Swift app layer can redirect or swallow it later.
|
||||
// ==============================================================================
|
||||
|
||||
#include <cstdarg>
|
||||
#include <cstdio>
|
||||
|
||||
namespace xone {
|
||||
|
||||
enum class log_level {
|
||||
debug = 0,
|
||||
info,
|
||||
warn,
|
||||
error,
|
||||
};
|
||||
|
||||
inline auto log_msg(log_level level, char const* fmt, ...) -> void
|
||||
{
|
||||
char const* tag = "?";
|
||||
switch (level) {
|
||||
case log_level::debug:
|
||||
tag = "debug";
|
||||
break;
|
||||
case log_level::info:
|
||||
tag = "info";
|
||||
break;
|
||||
case log_level::warn:
|
||||
tag = "warn";
|
||||
break;
|
||||
case log_level::error:
|
||||
tag = "error";
|
||||
break;
|
||||
}
|
||||
|
||||
std::fprintf(stderr, "[%s] ", tag);
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
std::vfprintf(stderr, fmt, ap);
|
||||
va_end(ap);
|
||||
std::fprintf(stderr, "\n");
|
||||
}
|
||||
|
||||
} // namespace xone
|
||||
Reference in New Issue
Block a user