Commit aeb611ef authored by jan.koester's avatar jan.koester
Browse files

first eorking version

parent c9231ea8
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -17,12 +17,14 @@ if(${CMAKE_HOST_SYSTEM_NAME} STREQUAL "Windows")
        windows/socket.cpp
        windows/udp.cpp
        windows/tcp.cpp
        windows/random.cpp
    )
else()
    list(APPEND netplussrc
        posix/socket.cpp
        posix/udp.cpp
        posix/tcp.cpp
        posix/random.cpp
    )
endif()

+1 −1
Original line number Diff line number Diff line
@@ -125,7 +125,7 @@ namespace netplus {

    // --- Helper Functions ---

    static void aes_self_check() {
    void aes_self_check() {
        // 1) S-Box / InvS-Box must be inverse permutations
        for (int x = 0; x < 256; ++x) {
            uint8_t y = S_BOX[x];
+0 −4
Original line number Diff line number Diff line
@@ -43,10 +43,6 @@ extern const uint8_t S_BOX[256];
extern const uint8_t INV_S_BOX[256];
extern const uint8_t RCON[10]; // Rcon values for key expansion (only 10 needed for AES-128)

extern "C" {
    static void aes_self_check();
}

class aes {
private:
    // Stores the expanded round keys (11 keys * 16 bytes = 176 bytes for AES-128)
+0 −11
Original line number Diff line number Diff line
@@ -350,17 +350,6 @@ namespace netplus {
        // n_prime = -N^{-1} mod 2^32 (uses least significant limb)
        uint32_t n_prime = netplus::rsa::calculateNPrime(mod.data[0]);

        // Helper: compute (2^(32*mod.used)) mod mod  == R mod N
        auto calculateRMod = [&](const bigInt& N) -> bigInt {
            bigInt r(N.used * 2 + 2);
            r.fromUint64(1);
            r.shiftLeft(N.used * 32);

            bigInt q(r.used + 1), rem(N.used + 2);
            netplus::rsa::divide(r, N, q, rem);
            return rem;
        };

        // Helper: compute (2^(64*mod.used)) mod mod == R^2 mod N
        auto calculateR2Mod = [&](const bigInt& N) -> bigInt {
            bigInt r(N.used * 4 + 2);
+1 −1
Original line number Diff line number Diff line
@@ -276,7 +276,7 @@ size_t netplus::x509cert::parseInternal(const uint8_t* data, size_t size, ASN1No
        int octets = length & 0x7F;

        // Defensive Check: If octets is unreasonably high or exceeds remaining buffer
        if (octets > sizeof(size_t) || cursor + octets > size) return 0;
        if (static_cast<size_t>(octets) > sizeof(size_t) || cursor + static_cast<size_t>(octets) > size) return 0;

        length = 0;
        for (int i = 0; i < octets; ++i) {
Loading