From de8f6dd2fae43434f83e61e1afd0d6aa2a79301d Mon Sep 17 00:00:00 2001 From: josi Date: Fri, 19 Apr 2024 20:43:32 +0200 Subject: [PATCH] final commit --- PQ_TIIGER_TLS/CHANGES.md | 12 +- PQ_TIIGER_TLS/README.txt | 2 +- PQ_TIIGER_TLS/sal/tls_sal_m.xpp | 11 +- appendixes/KEX_KEM_key_gen_PC_A.txt | 133 ++++++++++++ appendixes/KEX_KEM_key_gen_PC_B.txt | 80 ++++++++ appendixes/Overovanie_certifikatov_PC_A.txt | 191 ++++++++++++++++++ appendixes/Overovanie_certifikatov_PC_B.txt | 177 ++++++++++++++++ ...ostup_kompilacie_projektu_PQ_TiigerTLS.txt | 2 +- 8 files changed, 602 insertions(+), 6 deletions(-) create mode 100644 appendixes/KEX_KEM_key_gen_PC_A.txt create mode 100644 appendixes/KEX_KEM_key_gen_PC_B.txt create mode 100644 appendixes/Overovanie_certifikatov_PC_A.txt create mode 100644 appendixes/Overovanie_certifikatov_PC_B.txt diff --git a/PQ_TIIGER_TLS/CHANGES.md b/PQ_TIIGER_TLS/CHANGES.md index e5fa255..09d4a73 100644 --- a/PQ_TIIGER_TLS/CHANGES.md +++ b/PQ_TIIGER_TLS/CHANGES.md @@ -240,4 +240,14 @@ All notable changes to this project will be documented in this file. ## 2024-04-15 ### Added -- *OQS_TEST_results2.txt* with results of testing on test.openquantumsafe.org server with new \ No newline at end of file +- *OQS_TEST_results2.txt* with results of testing on test.openquantumsafe.org server with new + +## 2024-04-18 +### Added + +- RDTSC instruction for time measuring of signature verification +- condition in function *SAL_initLib()* for correct compilation without PQ settings + +### Changed + +- *clock()* in client.cpp return values in seconds, not in ms \ No newline at end of file diff --git a/PQ_TIIGER_TLS/README.txt b/PQ_TIIGER_TLS/README.txt index c6051e6..864cfa0 100644 --- a/PQ_TIIGER_TLS/README.txt +++ b/PQ_TIIGER_TLS/README.txt @@ -24,7 +24,7 @@ Priklad pouzitia: --------------------------- - pridana RDTSC instrukcia na meranie casu pri overovani podpisu - oprava vypisu povodnej funkcie clock() - vysledok je v sekundach -- pridana podmienena kompilacia vo funkcii SAL_initLib() pre spravne +- pridana podmienka vo funkcii SAL_initLib() pre spravne skompilovanie kniznice bez PQ nastavenia 11.04.2024 diff --git a/PQ_TIIGER_TLS/sal/tls_sal_m.xpp b/PQ_TIIGER_TLS/sal/tls_sal_m.xpp index 28b8d2d..3409565 100644 --- a/PQ_TIIGER_TLS/sal/tls_sal_m.xpp +++ b/PQ_TIIGER_TLS/sal/tls_sal_m.xpp @@ -1,3 +1,8 @@ +/* +* JS update 18.04.2024 +* Pridana instrukcia _rdtsc() na meranie casu pri overovani certifikatov +*/ + /* * JS update 14.04.2024 * Pridana podpora pre algoritmy ML-KEM a ML-DSA @@ -41,8 +46,6 @@ #endif -#define CYCLES_PER_MSEC(t) ((t) * 1e9) - using namespace core; csprng RNG; // Global miracl core Crypto Strong RNG - could be a hardware source @@ -1568,7 +1571,6 @@ bool SAL_tlsSignatureVerify(int sigAlg,octad *BUFF,octad *SIG,octad *PUBKEY) //double start,elapsed; //start = millis(); uint64_t start, end; - double cpu_frequency = 3.8; start = _rdtsc(); switch (sigAlg) { case RSA_PKCS1_SHA256 : @@ -1645,9 +1647,12 @@ bool SAL_tlsSignatureVerify(int sigAlg,octad *BUFF,octad *SIG,octad *PUBKEY) } //elapsed=(millis()-start); //printf(" Verification= %.2lf ms\n", elapsed); + end = _rdtsc(); uint64_t elapsed_ticks = end - start; double elapsed_microseconds = (double)elapsed_ticks; + + // JS 3.8 je frekvencia pouziteho CPU, 1e6 transformuje hodnotu citacu na ms printf("Elapsed time: %.2f microseconds\n", elapsed_microseconds / (3.8 * 1e6)); return result; } diff --git a/appendixes/KEX_KEM_key_gen_PC_A.txt b/appendixes/KEX_KEM_key_gen_PC_A.txt new file mode 100644 index 0000000..bc6405f --- /dev/null +++ b/appendixes/KEX_KEM_key_gen_PC_A.txt @@ -0,0 +1,133 @@ +Vysledky merania casov generovania KEX/KEM algoritmov na pocitaci A + + X25519 + Key Generation 0.13 s + Public key size: 32 bytes + Secret key size: 32 bytes + SECP256R1 + Key Generation 0.23 s + Public key size: 65 bytes + Secret key size: 32 bytes + SECP384R1 + Key Generation 0.52 s + Public key size: 97 bytes + Secret key size: 48 bytes + + +Windows 11 +1.3.2024 +liboqs 0.9.2 + + KYBER512 + Key Generation 0.09 s + Public key size: 800 bytes + Secret key size: 1632 bytes + KYBER768 + Key Generation 0.10 s + Public key size: 1184 bytes + Secret key size: 2400 bytes + KYBER1024 + Key Generation 0.12 s + Public key size: 1568 bytes + Secret key size: 3168 bytes + HQC128 + Key Generation 0.11 s + Public key size: 2249 bytes + Secret key size: 2289 bytes + HQC192 + Key Generation 0.21 s + Public key size: 4522 bytes + Secret key size: 4562 bytes + HQC256 + Key Generation 0.35 s + Public key size: 7245 bytes + Secret key size: 7285 bytes + FRODO640AES + Key Generation 0.22 s + Public key size: 9616 bytes + Secret key size: 19888 bytes + FRODO640SHAKE + Key Generation 1.43 s + Public key size: 9616 bytes + Secret key size: 19888 bytes + FRODO976AES + Key Generation 0.39 s + Public key size: 15632 bytes + Secret key size: 31296 bytes + FRODO976SHAKE + Key Generation 3.14 s + Public key size: 15632 bytes + Secret key size: 31296 bytes + FRODO1344AES + Key Generation 0.64 s + Public key size: 21520 bytes + Secret key size: 43088 bytes + FRODO1344SHAKE + Key Generation 5.67 s + Public key size: 21520 bytes + Secret key size: 43088 bytes + +Windows 11 +14.04.2024 +liboqs 0.10.0 + + KYBER512 + Key Generation 0.09 s + Public key size: 800 bytes + Secret key size: 1632 bytes + KYBER768 + Key Generation 0.10 s + Public key size: 1184 bytes + Secret key size: 2400 bytes + KYBER1024 + Key Generation 0.12 s + Public key size: 1568 bytes + Secret key size: 3168 bytes + MLKEM512 + Key Generation 0.05 s + Public key size: 800 bytes + Secret key size: 1632 bytes + MLKEM768 + Key Generation 0.07 s + Public key size: 1184 bytes + Secret key size: 2400 bytes + MLKEM1024 + Key Generation 0.09 s + Public key size: 1568 bytes + Secret key size: 3168 bytes + HQC128 + Key Generation 1.32 s + Public key size: 2249 bytes + Secret key size: 2305 bytes + HQC192 + Key Generation 3.85 s + Public key size: 4522 bytes + Secret key size: 4586 bytes + HQC256 + Key Generation 6.95 s + Public key size: 7245 bytes + Secret key size: 7317 bytes + FRODO640AES + Key Generation 0.22 s + Public key size: 9616 bytes + Secret key size: 19888 bytes + FRODO640SHAKE + Key Generation 1.45 s + Public key size: 9616 bytes + Secret key size: 19888 bytes + FRODO976AES + Key Generation 0.39 s + Public key size: 15632 bytes + Secret key size: 31296 bytes + FRODO976SHAKE + Key Generation 3.20 s + Public key size: 15632 bytes + Secret key size: 31296 bytes + FRODO1344AES + Key Generation 0.66 s + Public key size: 21520 bytes + Secret key size: 43088 bytes + FRODO1344SHAKE + Key Generation 5.76 s + Public key size: 21520 bytes + Secret key size: 43088 bytes \ No newline at end of file diff --git a/appendixes/KEX_KEM_key_gen_PC_B.txt b/appendixes/KEX_KEM_key_gen_PC_B.txt new file mode 100644 index 0000000..c1f7834 --- /dev/null +++ b/appendixes/KEX_KEM_key_gen_PC_B.txt @@ -0,0 +1,80 @@ +Vysledky merania casov generovania KEX/KEM algoritmov na pocitaci B + + + X25519 + Key Generation 0.30 s + Public key size: 32 bytes + Secret key size: 32 bytes + SECP256R1 + Key Generation 0.59 s + Public key size: 65 bytes + Secret key size: 32 bytes + SECP384R1 + Key Generation 1.51 s + Public key size: 97 bytes + Secret key size: 48 bytes + +Windows 10 +16.4.2024 +liboqs 0.10.0 + + KYBER512 + Key Generation 0.35 s + Public key size: 800 bytes + Secret key size: 1632 bytes + KYBER768 + Key Generation 0.41 s + Public key size: 1184 bytes + Secret key size: 2400 bytes + KYBER1024 + Key Generation 0.44 s + Public key size: 1568 bytes + Secret key size: 3168 bytes + MLKEM512 + Key Generation 0.20 s + Public key size: 800 bytes + Secret key size: 1632 bytes + MLKEM768 + Key Generation 0.24 s + Public key size: 1184 bytes + Secret key size: 2400 bytes + MLKEM1024 + Key Generation 0.28 s + Public key size: 1568 bytes + Secret key size: 3168 bytes + HQC128 + Key Generation 2.70 s + Public key size: 2249 bytes + Secret key size: 2305 bytes + HQC192 + Key Generation 7.29 s + Public key size: 4522 bytes + Secret key size: 4586 bytes + HQC256 + Key Generation 14.93 s + Public key size: 7245 bytes + Secret key size: 7317 bytes + FRODO640AES + Key Generation 1.20 s + Public key size: 9616 bytes + Secret key size: 19888 bytes + FRODO640SHAKE + Key Generation 4.59 s + Public key size: 9616 bytes + Secret key size: 19888 bytes + FRODO976AES + Key Generation 1.33 s + Public key size: 15632 bytes + Secret key size: 31296 bytes + FRODO976SHAKE + Key Generation 9.28 s + Public key size: 15632 bytes + Secret key size: 31296 bytes + FRODO1344AES + Key Generation 3.58 s + Public key size: 21520 bytes + Secret key size: 43088 bytes + FRODO1344SHAKE + Key Generation 15.80 s + Public key size: 21520 bytes + Secret key size: 43088 bytes \ No newline at end of file diff --git a/appendixes/Overovanie_certifikatov_PC_A.txt b/appendixes/Overovanie_certifikatov_PC_A.txt new file mode 100644 index 0000000..3ad1f57 --- /dev/null +++ b/appendixes/Overovanie_certifikatov_PC_A.txt @@ -0,0 +1,191 @@ +Namerane hodnoty celkoveho trvania procesu overovania certifikatom aplikaciou +klienta z kniznicePQ_TIIGER_TLS + +Testovane na zariadeni A +liboqs 0.10.0 +18.04.2024 + +RSA_PSS_RSAE_SHA256 +Elapsed time: 0.20 microseconds +Elapsed time: 0.18 microseconds +Elapsed time: 0.18 microseconds + +Elapsed time: 0.21 microseconds +Elapsed time: 0.19 microseconds +Elapsed time: 0.18 microseconds + +Elapsed time: 0.29 microseconds +Elapsed time: 0.19 microseconds +Elapsed time: 0.20 microseconds + +ECDSA_SECP384R1_SHA384 +Elapsed time: 0.29 microseconds +Elapsed time: 0.72 microseconds +Elapsed time: 0.77 microseconds + +Elapsed time: 0.20 microseconds +Elapsed time: 0.72 microseconds +Elapsed time: 0.84 microseconds + +Elapsed time: 0.20 microseconds +Elapsed time: 0.72 microseconds +Elapsed time: 0.75 microseconds + + + +dilithium2 +Elapsed time: 0.12 microseconds +Elapsed time: 0.73 microseconds +Elapsed time: 0.07 microseconds + +Elapsed time: 0.08 microseconds +Elapsed time: 0.73 microseconds +Elapsed time: 0.08 microseconds + +Elapsed time: 0.08 microseconds +Elapsed time: 0.73 microseconds +Elapsed time: 0.07 microseconds + +Dilithium2 +Elapsed time: 0.13 microseconds +Elapsed time: 0.72 microseconds +Elapsed time: 0.11 microseconds + +Elapsed time: 0.12 microseconds +Elapsed time: 0.73 microseconds +Elapsed time: 0.11 microseconds + +Elapsed time: 0.13 microseconds +Elapsed time: 0.73 microseconds +Elapsed time: 0.11 microseconds + +Dilithium5 +Elapsed time: 0.21 microseconds +Elapsed time: 0.73 microseconds +Elapsed time: 0.28 microseconds + +Elapsed time: 0.20 microseconds +Elapsed time: 0.75 microseconds +Elapsed time: 0.19 microseconds + +Elapsed time: 0.20 microseconds +Elapsed time: 0.74 microseconds +Elapsed time: 0.19 microseconds + +falcon1024 +Elapsed time: 0.10 microseconds +Elapsed time: 0.74 microseconds +Elapsed time: 0.06 microseconds + +Elapsed time: 0.08 microseconds +Elapsed time: 0.74 microseconds +Elapsed time: 0.06 microseconds + +Elapsed time: 0.08 microseconds +Elapsed time: 0.74 microseconds +Elapsed time: 0.06 microseconds + +falcon512 +Elapsed time: 0.07 microseconds +Elapsed time: 0.73 microseconds +Elapsed time: 0.03 microseconds + +Elapsed time: 0.05 microseconds +Elapsed time: 0.74 microseconds +Elapsed time: 0.03 microseconds + +Elapsed time: 0.05 microseconds +Elapsed time: 0.75 microseconds +Elapsed time: 0.03 microseconds + + +mldsa44 +Elapsed time: 0.10 microseconds +Elapsed time: 0.73 microseconds +Elapsed time: 0.11 microseconds + +Elapsed time: 0.08 microseconds +Elapsed time: 0.74 microseconds +Elapsed time: 0.07 microseconds + +Elapsed time: 0.09 microseconds +Elapsed time: 0.74 microseconds +Elapsed time: 0.08 microseconds + +mldsa65 +Elapsed time: 0.14 microseconds +Elapsed time: 0.75 microseconds +Elapsed time: 0.11 microseconds + +Elapsed time: 0.13 microseconds +Elapsed time: 0.74 microseconds +Elapsed time: 0.11 microseconds + +Elapsed time: 0.13 microseconds +Elapsed time: 0.74 microseconds +Elapsed time: 0.17 microseconds + +mldsa87 +Elapsed time: 0.20 microseconds +Elapsed time: 0.73 microseconds +Elapsed time: 0.18 microseconds + +Elapsed time: 0.19 microseconds +Elapsed time: 0.74 microseconds +Elapsed time: 0.27 microseconds + +Elapsed time: 0.19 microseconds +Elapsed time: 0.74 microseconds +Elapsed time: 0.23 microseconds + +sphincssha2128fsimple +Elapsed time: 1.49 microseconds +Elapsed time: 0.73 microseconds +Elapsed time: 1.42 microseconds + +Elapsed time: 1.48 microseconds +Elapsed time: 0.73 microseconds +Elapsed time: 1.39 microseconds + +Elapsed time: 1.49 microseconds +Elapsed time: 0.74 microseconds +Elapsed time: 1.39 microseconds + +sphincssha2128ssimple +Elapsed time: 0.53 microseconds +Elapsed time: 0.74 microseconds +Elapsed time: 0.54 microseconds + +Elapsed time: 0.67 microseconds +Elapsed time: 0.73 microseconds +Elapsed time: 0.52 microseconds + +Elapsed time: 0.58 microseconds +Elapsed time: 0.73 microseconds +Elapsed time: 0.70 microseconds + +sphincsshake128fsimple +Elapsed time: 2.24 microseconds +Elapsed time: 0.72 microseconds +Elapsed time: 2.24 microseconds + +Elapsed time: 2.23 microseconds +Elapsed time: 0.74 microseconds +Elapsed time: 2.26 microseconds + +Elapsed time: 2.23 microseconds +Elapsed time: 0.72 microseconds +Elapsed time: 2.43 microseconds + + + + + + + + + + + + + diff --git a/appendixes/Overovanie_certifikatov_PC_B.txt b/appendixes/Overovanie_certifikatov_PC_B.txt new file mode 100644 index 0000000..98f006c --- /dev/null +++ b/appendixes/Overovanie_certifikatov_PC_B.txt @@ -0,0 +1,177 @@ +Namerane hodnoty celkoveho trvania procesu overovania certifikatom aplikaciou +klienta z kniznicePQ_TIIGER_TLS + +Testovane na zariadeni B +liboqs 0.10.0 +18.04.2024 + +ECDSA_SECP256R1_SHA256 +Elapsed time: 0.53 microseconds +Elapsed time: 0.43 microseconds +Elapsed time: 0.97 microseconds + +Elapsed time: 0.71 microseconds +Elapsed time: 0.51 microseconds +Elapsed time: 0.91 microseconds + +Elapsed time: 0.42 microseconds +Elapsed time: 0.59 microseconds +Elapsed time: 0.75 microseconds + +RSA_PSS_RSAE_SHA256 +Elapsed time: 0.42 microseconds +Elapsed time: 0.38 microseconds +Elapsed time: 0.42 microseconds + +Elapsed time: 1.04 microseconds +Elapsed time: 0.50 microseconds +Elapsed time: 0.41 microseconds + +Elapsed time: 0.59 microseconds +Elapsed time: 0.50 microseconds +Elapsed time: 0.50 microseconds + + + +DILITHIUM2 +Elapsed time: 0.42 microseconds +Elapsed time: 1.41 microseconds +Elapsed time: 0.18 microseconds + +Elapsed time: 0.45 microseconds +Elapsed time: 1.40 microseconds +Elapsed time: 0.21 microseconds + +Elapsed time: 0.45 microseconds +Elapsed time: 1.44 microseconds +Elapsed time: 0.81 microseconds + +DILITHIUM3 +Elapsed time: 0.68 microseconds +Elapsed time: 1.49 microseconds +Elapsed time: 0.33 microseconds + +Elapsed time: 0.68 microseconds +Elapsed time: 1.40 microseconds +Elapsed time: 0.33 microseconds + +Elapsed time: 0.68 microseconds +Elapsed time: 1.40 microseconds +Elapsed time: 0.35 microseconds + +DILITHIUM5 +Elapsed time: 1.12 microseconds +Elapsed time: 1.40 microseconds +Elapsed time: 0.40 microseconds + +Elapsed time: 1.02 microseconds +Elapsed time: 2.36 microseconds +Elapsed time: 0.62 microseconds + +Elapsed time: 1.07 microseconds +Elapsed time: 1.40 microseconds +Elapsed time: 0.52 microseconds + +FALCON1024 +Elapsed time: 0.59 microseconds +Elapsed time: 3.83 microseconds +Elapsed time: 0.35 microseconds + +Elapsed time: 0.18 microseconds +Elapsed time: 1.51 microseconds +Elapsed time: 0.15 microseconds + +Elapsed time: 0.28 microseconds +Elapsed time: 1.91 microseconds +Elapsed time: 0.19 microseconds + +FALCON512 +Elapsed time: 0.47 microseconds +Elapsed time: 4.07 microseconds +Elapsed time: 0.20 microseconds + +Elapsed time: 0.28 microseconds +Elapsed time: 1.41 microseconds +Elapsed time: 0.08 microseconds + +Elapsed time: 0.29 microseconds +Elapsed time: 3.69 microseconds +Elapsed time: 0.26 microseconds + +MLDSA44 +Elapsed time: 0.55 microseconds +Elapsed time: 3.73 microseconds +Elapsed time: 0.27 microseconds + +Elapsed time: 0.46 microseconds +Elapsed time: 3.07 microseconds +Elapsed time: 0.21 microseconds + +Elapsed time: 0.23 microseconds +Elapsed time: 1.92 microseconds +Elapsed time: 0.25 microseconds + +MLDSA65 +Elapsed time: 0.74 microseconds +Elapsed time: 1.48 microseconds +Elapsed time: 0.24 microseconds + +Elapsed time: 0.67 microseconds +Elapsed time: 2.50 microseconds +Elapsed time: 0.37 microseconds + +Elapsed time: 0.68 microseconds +Elapsed time: 1.42 microseconds +Elapsed time: 0.61 microseconds + +MLDSA87 +Elapsed time: 1.09 microseconds +Elapsed time: 1.42 microseconds +Elapsed time: 0.38 microseconds + +Elapsed time: 1.05 microseconds +Elapsed time: 1.50 microseconds +Elapsed time: 0.39 microseconds + +Elapsed time: 1.04 microseconds +Elapsed time: 1.42 microseconds +Elapsed time: 0.41 microseconds + +SPHINCS_SHA2_128F_SIMPLE +Elapsed time: 7.59 microseconds +Elapsed time: 2.27 microseconds +Elapsed time: 4.51 microseconds + +Elapsed time: 7.71 microseconds +Elapsed time: 1.40 microseconds +Elapsed time: 2.74 microseconds + +Elapsed time: 8.73 microseconds +Elapsed time: 2.24 microseconds +Elapsed time: 4.54 microseconds + +SPHINCS_SHA2_128S_SIMPLE +Elapsed time: 2.58 microseconds +Elapsed time: 1.44 microseconds +Elapsed time: 0.97 microseconds + +Elapsed time: 2.45 microseconds +Elapsed time: 4.38 microseconds +Elapsed time: 3.43 microseconds + +Elapsed time: 2.48 microseconds +Elapsed time: 2.30 microseconds +Elapsed time: 2.39 microseconds + +SPHINCS_SHAKE_128F_SIMPLE +Elapsed time: 10.59 microseconds +Elapsed time: 1.46 microseconds +Elapsed time: 4.11 microseconds + +Elapsed time: 10.41 microseconds +Elapsed time: 2.39 microseconds +Elapsed time: 6.33 microseconds + +Elapsed time: 10.92 microseconds +Elapsed time: 2.46 microseconds +Elapsed time: 6.58 microseconds \ No newline at end of file diff --git a/appendixes/Postup_kompilacie_projektu_PQ_TiigerTLS.txt b/appendixes/Postup_kompilacie_projektu_PQ_TiigerTLS.txt index c242a09..1fa0893 100644 --- a/appendixes/Postup_kompilacie_projektu_PQ_TiigerTLS.txt +++ b/appendixes/Postup_kompilacie_projektu_PQ_TiigerTLS.txt @@ -15,7 +15,7 @@ mingw32-make LINUX -cmake -G "Unix Makefiles" -DCMAKE_CXX_COMPILER=/usr/bin/gcc +cmake . -DCMAKE_CXX_COMPILER=/usr/bin/gcc make