diff --git a/certifikaty/vygenerovany_certifikat.pem b/certifikaty/vygenerovany_certifikat.pem deleted file mode 100644 index 25a6216..0000000 --- a/certifikaty/vygenerovany_certifikat.pem +++ /dev/null @@ -1,18 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIC9DCCAl2gAwIBAgIPOFnW4ztFVHh112J1efiUMA0GCSqGSIb3DQEBCwUAMHMx -CzAJBgNVBAYTAlNLMQowCAYDVQQIDAEtMQ8wDQYDVQQHDAZLb3NpY2UxETAPBgNV -BAoMCEF1dG9yaXRhMRIwEAYDVQQDDAlsb2NhbC5kZXYxIDAeBgkqhkiG9w0BCQEW -EWF1dG9yaXRhQHR1a2UuY29tMCIYDzIwMjAwMzE4MTIzMDM3WhgPMjAyNTAzMTgx -MjMwMzdaMHcxCzAJBgNVBAYTAlNSMQowCAYDVQQIDAEtMQ8wDQYDVQQHDAZLb3Np -Y2UxCjAIBgNVBAoMAS0xCjAIBgNVBAsMAS0xEjAQBgNVBAMMCWxvY2FsLmRldjEf -MB0GCSqGSIb3DQEJARYQa2xpZW50QGtsaWVudC5zazCCASIwDQYJKoZIhvcNAQEB -BQADggEPADCCAQoCggEBANhd9y+QBegPHmVd5/CJmhz4dJjNEqppJkOgxkxK98so -aJa/9DJ5vfBuYS4ghovuCB29kvbMcOcnZK+qE50YVzSRQzoeBOo7vOTzukSdm5Uh -Ja43FDAkUtEt4Z3cGpCMIjaRz+mFKmAyN7EiGeoAeOre1GNc6oqwYDNKQKfshG9Y -HUmO8AenFLTcLCRurwMSsXLTr8OyiLy2ZTuszn7pwisKSEiZFIdGwxSPZdKi5tOF -FxryCaKVD/Hn+NMWTaoX2gBED/4JggftY6YplQMvZyNu1Fz/YCFjq+9sEIfV2595 -E+9MuO/0q9k5/9xDlDt5S+PjSd38N1IaxShdxTBU3AECAwEAATANBgkqhkiG9w0B -AQsFAAOBgQB+YyoHZPpNX3Adu4YeKyyoGV7Bjw3vZwZS3qNCioecGOtO1w7KIsQc -idDf1mCY2PUVC7mrEENtbENK8TAFNYRkv3NOM0UD/KcmJpyo7UdTNZXNyvwlIXrf -2mQz1lE5/jXuDdZdCz5SvslB0vj65NiTOjjWt83KsLkpg9sKudkJrA== ------END CERTIFICATE----- diff --git a/certifikaty/vygenerovany_kluc.key b/certifikaty/vygenerovany_kluc.key deleted file mode 100644 index 01c764d..0000000 --- a/certifikaty/vygenerovany_kluc.key +++ /dev/null @@ -1,27 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -MIIEowIBAAKCAQEA2F33L5AF6A8eZV3n8ImaHPh0mM0SqmkmQ6DGTEr3yyholr/0 -Mnm98G5hLiCGi+4IHb2S9sxw5ydkr6oTnRhXNJFDOh4E6ju85PO6RJ2blSElrjcU -MCRS0S3hndwakIwiNpHP6YUqYDI3sSIZ6gB46t7UY1zqirBgM0pAp+yEb1gdSY7w -B6cUtNwsJG6vAxKxctOvw7KIvLZlO6zOfunCKwpISJkUh0bDFI9l0qLm04UXGvIJ -opUP8ef40xZNqhfaAEQP/gmCB+1jpimVAy9nI27UXP9gIWOr72wQh9Xbn3kT70y4 -7/Sr2Tn/3EOUO3lL4+NJ3fw3UhrFKF3FMFTcAQIDAQABAoIBABISdy0P2I5zhNRu -rYrX03mL/yEsL9zv/3Qyn52LvXrIm0PMMLdul8DXV2Kk8NgLP75MMVRP6zZDghNy -H0VF3TLU10qpazutVa/B89L7Xx1rsVwF2bfTsN8r9+ZZlhZwvgLU1wroRovWZfRz -prp246Kqjg7mmeiPptlh4FimVsF98U0Iz132z9KTxFufJ5wcTcGvz+Z+p5lVIeBY -hCdYWWLXXT3mjXVQjFGF13NuY2+CT2AL2EzrwN0/+tcytJMUh/ThBxU2PwPyMnZz -fTVddcJt5Ipg4m3LQfVZZX+XpckpEI8lkbsvOC86Y9Iu5FJmPd43X4qAnXgWLzgp -Cm9GVGECgYEA89vpdqNGYbRQR6TrlZ2kYCMyCMj1Op47jtDpW6zE11iDjszE2VWD -XwkWE55hj0tp073kCnJzPM1Y8CslVhDGzygx5wiNRupKE9vRSkYxwsXaJpF0SfYc -ZiaPvL+6MeRtLMZ0Fkk5HbjpwcTtJP7f2oQH/owxd/sWOGS/kWY5hcUCgYEA4yOo -Ewfde3jZY0OUiERq9OadLpaKI2ADJvkyKxZmWzGFUVJ/PVoTYPR1EQurXi1kLXXI -rDA5H+Lz27R+9gTT8K6u7Faanlhp3P65xPIuCiJ78Nh6TnG5NRt7A2P5XY6UGahT -Zzj5UQc4P796DAgB6CPYCCsn0Gxz+u4R3/gW3Q0CgYBIaNBWDf1kHaqI24uojXq1 -oT3GJgXLNhjxO09PjWmVmA7YZC0/a4jqu0P251yItBfka8o+3+Uf9Mmn5ufbOngO -Ix1OQNfSatc8NlVa/KTh9OXl9eLV42JjYqfjn/qlvfI9DWCDDZMMJFAk3VidV6EY -vYOyLeayfbgHXsMTZYtHEQKBgQCw+LkdisVATJpjwuXZfiUvhvb0s4oRod8S4Jn8 -BEnfx6euAu7saGAs7IrBqyvsBsXEvb6KmlAHzhZeGjXJjV1sa04TCi8SLKTe8QDg -uCiy8MdMkf5JXEYHYM/phl1mTY6KpyHEjRmDznI/CPsYoKyLqFHLm4Q72iRLYG5A -6NU3iQKBgByzyily3RuiAhC5+fsiZafqpTx7+9Tc6CZnuS0HlGH6WJ9b7fgXWKD9 -d252qQyaHGzHAtaF2tjzTwEbI3WIJmFU1y+XOXPDdue32saNNhXd6xF7FD1RK4az -T3hOyo14S4RPvpJp6KITPBLD6kUUQS8r/gcGXLWBDudsTFH1UgJy ------END RSA PRIVATE KEY----- diff --git a/kniznica/komunikacia.c b/kniznica/komunikacia.c index f6cd2c4..1d172ed 100644 --- a/kniznica/komunikacia.c +++ b/kniznica/komunikacia.c @@ -3,21 +3,14 @@ // Meno studenta: Tomas Lukac // // Veduci BP: prof. Ing. Milos Drutarovsky CSc. // // Skola: KEMT FEI TUKE // -// Datum poslednej upravy: 12.3.2020 // +// Datum poslednej upravy: 6.4.2020 // ////////////////////////////////////////////////// #include "komunikacia.h" #include "kryptografia.h" +#include "rs232.h" -hashovacia_funkcia h_funkcia; -int rs232_rozhranie; - -void nastav_funkciu(hashovacia_funkcia funkcia) -{ - h_funkcia = funkcia; -} - -int poslat_subor(WOLFSSL* ssl, WOLFSSL_CTX* ctx, char* cesta) +int poslat_subor(WOLFSSL* ssl, WOLFSSL_CTX* ctx, char* cesta, nastavenia_aplikacie *nastavenia) { int uspech; @@ -73,7 +66,7 @@ int poslat_subor(WOLFSSL* ssl, WOLFSSL_CTX* ctx, char* cesta) //generovanie a poslanie kontrolneho suctu serveru pre kontrolu byte* kontrolny_sucet; int velkost_kontrolneho_suctu; - kontrolny_sucet = generovat_kontrolny_sucet_suboru(h_funkcia, cesta, &velkost_kontrolneho_suctu); + kontrolny_sucet = generovat_kontrolny_sucet_suboru(nastavenia->funkcia, cesta, &velkost_kontrolneho_suctu); for(int i = 0; i < velkost_kontrolneho_suctu; i++) { kontrolny_sucet[i] = (char)kontrolny_sucet[i]; @@ -88,7 +81,7 @@ int poslat_subor(WOLFSSL* ssl, WOLFSSL_CTX* ctx, char* cesta) } } -int prijat_subor(WOLFSSL* ssl, WOLFSSL_CTX* ctx) +int prijat_subor(WOLFSSL* ssl, WOLFSSL_CTX* ctx, nastavenia_aplikacie* nastavenia) { int uspech; @@ -139,7 +132,7 @@ int prijat_subor(WOLFSSL* ssl, WOLFSSL_CTX* ctx) //vypocet vlastneho kontrolneho suctu byte* kontrolny_sucet; int velkost_kontrolneho_suctu; - kontrolny_sucet = generovat_kontrolny_sucet_suboru(h_funkcia, cesta, &velkost_kontrolneho_suctu); + kontrolny_sucet = generovat_kontrolny_sucet_suboru(nastavenia->funkcia, cesta, &velkost_kontrolneho_suctu); //prijem hashu, ktory vypocital server char* prijaty_kontrolny_sucet = calloc(velkost_kontrolneho_suctu, sizeof(char)); @@ -202,7 +195,11 @@ int pripojit_na_server(char *ip_adresa, int cislo_portu, int pocet_sekund) uspech = connect(cislo_soketu, (struct sockaddr*)&adresa, sizeof(adresa)); if(uspech < 0) { - if(errno == EINPROGRESS) + #if defined(_WIN32) + if(errno == WSAEINPROGRESS ) + #else + if(errno == EINPROGRESS ) + #endif { fprintf(stderr, "Nebolo mozne okamzite vytvorit spojenie\n"); do @@ -212,7 +209,11 @@ int pripojit_na_server(char *ip_adresa, int cislo_portu, int pocet_sekund) FD_ZERO(&sada_soketov); FD_SET(cislo_soketu, &sada_soketov); uspech = select(cislo_soketu + 1, NULL, &sada_soketov, NULL, &casovy_interval); + #if defined(_WIN32) + if (uspech < 0 && errno != WSAEINTR) + #else if (uspech < 0 && errno != EINTR) + #endif { fprintf(stderr, "Nastala chyba pri pokuse o vytvorenie spojenia\nCislo chyby: %d\nPopis: %s\n", errno, strerror(errno)); ukoncit_soket(cislo_soketu); @@ -287,15 +288,5 @@ int cakat_na_komunikaciu(int cislo_portu) return cislo_soketu; } -int rs232_otvorit_rozhranie(int cislo_rozhrania, int rychlost, const char* rezim, int riadenie_toku_dat) -{ - int uspech; - rs232_rozhranie = cislo_rozhrania; - uspech = RS232_OpenComport(cislo_rozhrania, rychlost, rezim, riadenie_toku_dat); - if(uspech == 1) - { - fprintf(stderr, "Nebolo mozne otvorit seriove rozhranie\n"); - return -1; - } -} + diff --git a/kniznica/komunikacia.h b/kniznica/komunikacia.h index 27fb43e..62593be 100644 --- a/kniznica/komunikacia.h +++ b/kniznica/komunikacia.h @@ -3,7 +3,7 @@ // Meno studenta: Tomas Lukac // // Veduci BP: prof. Ing. Milos Drutarovsky CSc. // // Skola: KEMT FEI TUKE // -// Datum poslednej upravy: 12.3.2020 // +// Datum poslednej upravy: 6.4.2020 // ////////////////////////////////////////////////// #ifndef __KOMUNIKACIA_H__ @@ -17,7 +17,6 @@ #include "kryptografia.h" #include "rs232.h" - #define VELKOST_CESTY 64 //velkost retazca, kt. uklada lokaciu suboru #define VELKOST_SUBOR 32 //velkost retazca, kt. uklada velkost prenasaneho suboru @@ -31,8 +30,6 @@ #include #define ukoncit_soket closesocket #define socklen_t int - #define EINPROGRESS WSAEINPROGRESS - #define EINTR WSAEINTR //hovori visual c prekladacu aby nalinkoval ws2_32 kniznicu //ak pouzivame minqw pragma sa ignoruje a musime ju zadat pri kompilaci manualne : -lws2_32 @@ -79,9 +76,7 @@ int cakat_na_komunikaciu(int cislo_portu); // RS232 KOMUNIKACNY KANAL // ///////////////////////////// -int rs232_otvorit_rozhranie(int cislo_rozhrania, int rychlost, const char* rezim, int riadenie_toku_dat); - - +//.. ////////////////////// // PRACA SO SUBORMI // @@ -94,7 +89,7 @@ int rs232_otvorit_rozhranie(int cislo_rozhrania, int rychlost, const char* rezim * @parameter char* cesta: ukazuje na retazec, ktory reprezentuje cestu k suboru * @vrati int : operacia bola uspesna(0), neuspesna(-1) */ -int poslat_subor(WOLFSSL* ssl, WOLFSSL_CTX* ctx, char* cesta); +int poslat_subor(WOLFSSL* ssl, WOLFSSL_CTX* ctx, char* cesta, nastavenia_aplikacie* nastavenia); /** * prijat_subor: realizuje prijem suboru @@ -102,14 +97,6 @@ int poslat_subor(WOLFSSL* ssl, WOLFSSL_CTX* ctx, char* cesta); * @parameter WOLFSSL_CTX* ctx : ukazuje na WOLFSSL_CTX strukturu * @vrati int : operacia bola uspesna(0), neuspesna(-1) */ -int prijat_subor(WOLFSSL* ssl, WOLFSSL_CTX* ctx); - -/** - * nastav_funkciu: nastavi hashovaciu funkciu ktora bude pouzita pri vypocte kontrolneho suctu suboru - * @paramater hashovacia_funkcia funkcia : nazov hashovacej funkcie - moznosti: funkcia_SHA, funkcia_SHA224, funkcia_SHA256, funkcia_SHA384, funkcia_SHA512, funkcia_BLAKE2B, funkcia_RIPEMD160 - */ -void nastav_funkciu(hashovacia_funkcia funkcia); - +int prijat_subor(WOLFSSL* ssl, WOLFSSL_CTX* ctx, nastavenia_aplikacie* nastavenia); #endif \ No newline at end of file diff --git a/kniznica/kryptografia.c b/kniznica/kryptografia.c index 38bc620..5da843c 100644 --- a/kniznica/kryptografia.c +++ b/kniznica/kryptografia.c @@ -3,10 +3,12 @@ // Meno studenta: Tomas Lukac // // Veduci BP: prof. Ing. Milos Drutarovsky CSc. // // Skola: KEMT FEI TUKE // -// Datum poslednej upravy: 12.3.2020 // +// Datum poslednej upravy: 6.4.2020 // ////////////////////////////////////////////////// #include "kryptografia.h" +#include + WOLFSSL_CTX* nastavit_ctx_klient() { @@ -42,6 +44,11 @@ void nastav_sifry(WOLFSSL_CTX* ctx, const char* sifry) wolfSSL_CTX_set_cipher_list(ctx, sifry); } +void nastav_funkciu(nastavenia_aplikacie* nastavenia, hashovacia_funkcia funkcia) +{ + nastavenia->funkcia = funkcia; +} + void zobraz_sifru(WOLFSSL* ssl) { printf ("Pouzita sifra: %s\n", wolfSSL_get_cipher(ssl)); @@ -630,4 +637,4 @@ void ukoncit_spojenie(WOLFSSL *ssl, WOLFSSL_CTX *ctx) wolfSSL_CTX_free(ctx); wolfSSL_Cleanup(); printf("Program bol ukonceny.\n"); -} +} \ No newline at end of file diff --git a/kniznica/kryptografia.h b/kniznica/kryptografia.h index 98bdf03..1e51c32 100644 --- a/kniznica/kryptografia.h +++ b/kniznica/kryptografia.h @@ -3,7 +3,7 @@ // Meno studenta: Tomas Lukac // // Veduci BP: prof. Ing. Milos Drutarovsky CSc. // // Skola: KEMT FEI TUKE // -// Datum poslednej upravy: 12.3.2020 // +// Datum poslednej upravy: 6.4.2020 // ////////////////////////////////////////////////// #ifndef __KRYPTOGRAFIA_H__ @@ -27,7 +27,11 @@ typedef enum hashovacia_funkcia { funkcia_SHA, funkcia_SHA224, funkcia_SHA256, funkcia_SHA384, funkcia_SHA512, funkcia_BLAKE2B, funkcia_RIPEMD160 -}hashovacia_funkcia; +} hashovacia_funkcia; + +typedef struct nastavenia_aplikacie { + hashovacia_funkcia funkcia; +} nastavenia_aplikacie; /** * generovat_hash: realizuje vypocet kontrolneho suctu zo suboru, ktoreho lokacia je predana v argumente @@ -106,6 +110,15 @@ void zobraz_sifru(WOLFSSL* ssl); */ void nastav_sifry(WOLFSSL_CTX* ctx, const char* sifry); + +/** + * nastav_funkciu: nastavi hashovaciu funkciu ktora bude pouzita pri vypocte kontrolneho suctu suboru + * @parameter nastavenia_aplikacie* nastavenia: reprezentuje nastavenia aplikacie: server alebo klient + * @paramater hashovacia_funkcia funkcia : nazov hashovacej funkcie + moznosti: funkcia_SHA, funkcia_SHA224, funkcia_SHA256, funkcia_SHA384, funkcia_SHA512, funkcia_BLAKE2B, funkcia_RIPEMD160 + */ +void nastav_funkciu(nastavenia_aplikacie* nastavenia, hashovacia_funkcia funkcia); + /** * nacitat_certifikaty: realizuje nacitanie certifikatov zo suborov do struktury WOLFSSL_CTX * @parameter WOLFSSL_CTX* ctx : ukazuje na WOLFSSL_CTX strukturu diff --git a/readme.txt b/readme.txt index 4ff3c78..3181455 100644 --- a/readme.txt +++ b/readme.txt @@ -2,49 +2,54 @@ Bakalarska praca Meno studenta: Tomas Lukac Veduci BP: prof. Ing. Milos Drutarovsky CSc. Skola: KEMT FEI TUKE -Datum poslednej upravy: 12.3.2020 +Datum poslednej upravy: 6.4.2020 +Verzia: 0.1 ---------------------------- Zoznam zdrojovych suborov certifikaty - |__autorita_ecc.pem - |__autorita_ecc.key - |__autorita_rsa.pem - |__autorita_rsa.key - |__server_ecc.pem - |__server_ecc.key - |__server_rsa.pem - |__server_rsa.key - |__klient_ecc.pem - |__klient_ecc.key - |__klient_rsa.pem - |__klient_rsa.key + autorita + |__autorita_ecc.pem + |__autorita_ecc.key + |__autorita_rsa.pem + |__autorita_rsa.key + server + |__server_ecc.pem + |__server_ecc.key + |__server_rsa.pem + |__server_rsa.key + klient + |__klient_ecc.pem + |__klient_ecc.key + |__klient_rsa.pem + |__klient_rsa.key kniznica |__komunikacia.h |__komunikacia.c |__kryptografia.h |__kryptografia.c - |__vstup.h - |__vstup.c tcpip_kanal |__klient.c |__server.c |__Makefile rs232_kanal |__klient.c + |__klient.txt |__server.c + |__server.txt |__Makefile Opis aplikacie Realizuje zabezpecenu vymenu sprav medzi klientom a serverom a autentizaciu servera klientom vyuzitim kniznice WolfSSL. Ako prvu je potrebne spustit aplikaciu na strane servera s prepinacom port s hodnotou, ktora urcuje ake bude cislo portu, na ktorom bude server - cakar na prichadzajucu komunikaciu. Dalsim potrebnym prepinacom je bud -n (nacitanie certifikatov z adresaru /certifikaty) alebo - -g (vygenerovanie a podpis certifikatov pomocou certifikatu a kluca autority, ktore sa nachadzaju taktiez v adresari /certifikaty). - Sukromne kluce a certifikaty su ulozene vo formate Privacy-Enhanced Mail (PEM). Nasledne je potrebne spustit aplikaciu na strane - klienta, ktora okrem predchadzajucich parametrov vyzaduje parameter pre ip adresu: -ip adresa. Po vytvoreni zabezpeceneho prenosoveho - kanalu sa klient pokusi odoslat subor, ktoreho lokacia mu bola predana pri spusteni pomocou parametru -s subor. Pred samotnym poslanim - klient najprv vyhotovi kontrolny sucet suboru, ktory odosle po zabezpecenom kanali serveru. Ten po prijati suboru overi ci sa zhoduje - prijaty kontrolny sucet s jeho, ktory vyhotovil po prijati suboru. Ak pri prijati suboru nenastala chyba a kontrolne sucty sa zhoduju - server oznami ze prijem bol uspesny a dalej caka na komunikaciu. Klientsky program po odoslani suboru ukonci svoju cinnost. + cakat na prichadzajucu komunikaciu, v pripade rs232 kanala je potrebne uviest cislo serioveho rozhrania (hodnoty: https://www.teuniz.net/RS-232/). + Dalsim potrebnym prepinacom je bud -n (nacitanie certifikatov z adresaru /certifikaty) alebo -g (vygenerovanie a podpis certifikatov + pomocou certifikatu a kluca autority, ktore sa nachadzaju taktiez v adresari /certifikaty).Sukromne kluce a certifikaty su ulozene vo formate DER. + Nasledne je potrebne spustit aplikaciu na strane klienta, ktora pri pouziti kanalu TCP_IP okrem predchadzajucich parametrov vyzaduje parameter + pre ip adresu: -ip adresa. Po vytvoreni zabezpeceneho prenosoveho kanalu sa klient pokusi odoslat subor, ktoreho lokacia mu bola predana pri + spusteni pomocou parametru -s subor. Pred samotnym poslanim klient najprv vyhotovi kontrolny sucet suboru, ktory odosle po zabezpecenom kanali + serveru. Ten po prijati suboru overi ci sa zhoduje prijaty kontrolny sucet s jeho, ktory vyhotovil po prijati suboru. Ak pri prijati suboru + nenastala chyba a kontrolne sucty sa zhoduju server oznami ze prijem bol uspesny a dalej caka na komunikaciu. + Klientsky program po odoslani suboru ukonci svoju cinnost. Generovanie certifikatov RSA (OpenSSL) openssl genrsa -out autorita_rsa.key 2048 @@ -80,27 +85,34 @@ Navod na prelozenie a spustenie (Linux) sudo make install 2. prelozenie programov (v podadresari tcpip_kanal alebo rs232_kanal) make all - 3. spustenie + 3. spustenie (prenosovy kanal TCP/IP) ./server -port port -n rsa|ecc ./server -port port -g rsa|ecc ./klient -ip 127.0.0.1 -port port -n rsa|ecc -s subor ./klient -ip 127.0.0.1 -port port -g rsa|ecc -s subor + 4. spustenie (prenosovy kanal RS232) + ./server -port seriove_rozhranie -n rsa|ecc + ./server -port seriove_rozhranie -g rsa|ecc + ./klient -port seriove_rozhranie -n rsa|ecc -s subor + ./klient -port seriove_rozhranie -g rsa|ecc -s subor Navod na prelozenie a spustenie (Windows) - 1. prelozenie programov (v podadresari tcpip_kanal alebo rs232_kanal) - mingw32-make all - 2. spustenie - server -port port -n rsa|ecc - server -port port -g rsa|ecc - klient -ip 127.0.0.1 -port port -n rsa|ecc -s subor - klient -ip 127.0.0.1 -port port -g rsa|ecc -s subor - -Zoznam DLL suborov potrebnych pre spustenie (Windows) - 1. vcruntime140.dll - 2. wolfssl.dll - 3. ws2_32.dll - Poznamka: - pre preklad na 64bit architekturach je nutne premennovat subory s koncovkami *_64.dll na nazvy DLLiek uvedenych vyssie - a povodne DLLka premenovat na ine nazvy, najlepsie *_32.dll + 1. skopirovanie potrebnych dll z adresara /wolfssl/64bit_kniznice/ , resp. /wolfssl/32bit_kniznice/ + do podadresara tcpip_kanal, resp. rs232_kanal + a) wolfssl.dll -> kniznica wolfssl + b) vcruntime140.dll -> visual c++ runtime + c) api-ms-win-crt-runtime-l1-1-0.dll + 2. prelozenie programov (v podadresari tcpip_kanal alebo rs232_kanal) + make all + 3. spustenie (prenosovy kanal TCP/IP) + server -port port -n rsa|ecc + server -port port -g rsa|ecc + klient -ip 127.0.0.1 -port port -n rsa|ecc -s subor + klient -ip 127.0.0.1 -port port -g rsa|ecc -s subor + 4. spustenie (prenosovy kanal RS232) + server -port seriove_rozhranie -n rsa|ecc + server -port seriove_rozhranie -g rsa|ecc + klient -port seriove_rozhranie -n rsa|ecc -s subor + klient -port seriove_rozhranie -g rsa|ecc -s subor \ No newline at end of file diff --git a/rs232_kanal/Makefile b/rs232_kanal/Makefile index d4dd89d..80aa1ea 100644 --- a/rs232_kanal/Makefile +++ b/rs232_kanal/Makefile @@ -2,28 +2,27 @@ ## Meno studenta: Tomas Lukac ## ## Veduci BP: prof. Ing. Milos Drutarovsky CSc. ## ## Skola: KEMT FEI TUKE ## -## Datum poslednej upravy: 12.3.2020 ## +## Datum poslednej upravy: 6.4.2020 ## ################################################## #prekladac CC = gcc #prepinace pre prekladac -CFLAGS = -Wcpp -I./../wolfssl_hlavickove_subory/ -LIB = -L. -lwolfssl +CFLAGS = -Wcpp -Werror -I./../wolfssl/ +LIB = ifeq ($(OS), Windows_NT) - LIB += -lws2_32 ifeq ($(PROCESSOR_ARCHITECTURE), AMD64) - LIB += -m64 + LIB += -L./../wolfssl/64bit_kniznice/ -lwolfssl -lws2_32 -m64 endif ifeq ($(PROCESSOR_ARCHITECTURE), x86) - LIB += -Os + LIB += -L./../wolfssl/32bit_kniznice/ -lwolfssl -lws2_32 -Os endif else UNAME_S := $(shell uname -s) ifeq ($(UNAME_S), Linux) - LIB += + LIB += -lwolfssl endif endif diff --git a/rs232_kanal/klient.c b/rs232_kanal/klient.c index 533d582..c23811f 100644 --- a/rs232_kanal/klient.c +++ b/rs232_kanal/klient.c @@ -3,7 +3,7 @@ // Meno studenta: Tomas Lukac // // Veduci BP: prof. Ing. Milos Drutarovsky CSc. // // Skola: KEMT FEI TUKE // -// Datum poslednej upravy: 12.3.2020 // +// Datum poslednej upravy: 6.4.2020 // ////////////////////////////////////////////////// #include @@ -17,7 +17,8 @@ #include #include #include -#define O_NOCTTY 0 +#define O_NOCTTY 0x8000 +#define O_NDELAY 0x4000 #else #include #endif @@ -26,55 +27,249 @@ #include "../kniznica/komunikacia.h" #include "../kniznica/rs232.h" -int rs232_poslat; +#define RSA_VELKOST 2048 +#define ECC_VELKOST 32 +#define RSA_EXPONENT 65537 + +//cesty ku suborom +#define RSA_KLUC "../certifikaty/klient/klient_rsa.key" +#define RSA_CERTIFIKAT "../certifikaty/klient/klient_rsa.pem" +#define ECC_KLUC "../certifikaty/klient/klient_ecc.key" +#define ECC_CERTIFIKAT "../certifikaty/klient/klient_ecc.pem" +#define VYGENEROVANY_KLUC "../certifikaty/klient/vygenerovany_kluc.key" +#define VYGENEROVANY_CERTIFIKAT "../certifikaty/klient/vygenerovany_certifikat.pem" +#define KOMUNIKACNY_SUBOR "klient.txt" + int rs232_prijat; +int cislo_rozhrania = 4; +int aktualne_data = 0; int rs232_citanie(WOLFSSL *ssl, char *buf, int sz, void *ctx) { - (void)ssl; - (void)ctx; int uspech = 0; - while(uspech <= 0) + + //ziskanie dat zo serioveho rozhrania + if(aktualne_data == 0) { - uspech = (int)read(rs232_prijat, buf, (size_t)sz); + FILE* f = fopen(KOMUNIKACNY_SUBOR, "ab"); + int nacitane_data = 0; + int prebieha_nacitanie = 0; + unsigned char znak; + + //kontrolne vzory, ktore jednoznacne identifikuju zaciatok a koniec spravy + unsigned char zaciatok_spravy[] = {0xAA, 0xAA, 0xAA, 0xAA}; + int zaciatok_spravy_pozicia = 0; //aktualna pozicia v kontrolnom vzore + unsigned char koniec_spravy[] = {0xBB, 0xBB, 0xBB, 0xBB}; + int koniec_spravy_pozicia = 0; //aktualna pozicia v kontrolnom vzore + + while(1) + { + uspech = RS232_PollComport(cislo_rozhrania, &znak, 1); + if(uspech > 0) + { + if((znak == zaciatok_spravy[zaciatok_spravy_pozicia]) && (zaciatok_spravy_pozicia <= 2)) + { + zaciatok_spravy_pozicia++; + } + else if((znak == zaciatok_spravy[zaciatok_spravy_pozicia]) && (zaciatok_spravy_pozicia > 2)) + { + //ak bol najdeny koniec kontrolneho vzoru, tak je zapnuta znacka, + //ktora urcuje ze prebieha nacitavanie spravy + prebieha_nacitanie = 1; + zaciatok_spravy_pozicia = 0; + } + else if((prebieha_nacitanie) && (znak == koniec_spravy[koniec_spravy_pozicia]) && (koniec_spravy_pozicia <= 2)) + { + koniec_spravy_pozicia++; + } + else if((prebieha_nacitanie) && (znak == koniec_spravy[koniec_spravy_pozicia]) && (koniec_spravy_pozicia > 2)) + { + //ak bol najdeny koniec kontrolneho vzoru, tak je vypnuta znacka, + //ktora urcuje ze prebieha nacitanie spravy + prebieha_nacitanie = 0; + break; + } + else + { + if(prebieha_nacitanie) + { + fwrite((char*)&znak, 1, uspech, f); + nacitane_data += uspech; + } + } + } + } + printf("Nacital som %d dat\n", nacitane_data); + aktualne_data = nacitane_data; + fclose(f); } + + //nacitanie dat zo suboru do buffera + uspech = 0; + while(uspech <= 0) + uspech = read(rs232_prijat, buf, sz); + aktualne_data -= uspech; return uspech; } int rs232_zapis(WOLFSSL *ssl, char *buf, int sz, void *ctx) { - (void)ssl; - (void)ctx; int uspech = 0; - uspech = (int) write(rs232_poslat, buf, (size_t)sz); + //kontrolne vzory, ktore jednoznacne identifikuju zaciatok a koniec spravy + unsigned char zaciatok_spravy[] = {0xAA, 0xAA, 0xAA, 0xAA}; + unsigned char koniec_spravy[] = {0xBB, 0xBB, 0xBB, 0xBB}; + RS232_SendBuf(cislo_rozhrania, (unsigned char*)zaciatok_spravy, sizeof(zaciatok_spravy)); + uspech = (int)RS232_SendBuf(cislo_rozhrania, (unsigned char*)buf, (size_t)sz); + RS232_SendBuf(cislo_rozhrania, (unsigned char*)koniec_spravy, sizeof(koniec_spravy)); + printf("Odoslal som %d %d\n", uspech, sz); + return uspech; } int main(int argc, char const *argv[]) { char rezim[]={'8','N','1', 0}; - int cislo_rozhrania = 4; int rychlost = 9600; WOLFSSL *ssl; WOLFSSL_CTX *ctx = NULL; + char* subor = NULL; + int zadane_rozhranie = 0; + int uvedeny_subor = 0; + int nacitanie_zo_suboru = 0; + int generovanie_certifikatu = 0; + nastavenia_aplikacie nastavenia; - rs232_poslat = open("server.txt", O_WRONLY | O_NOCTTY); - rs232_prijat = open("klient.txt", O_RDONLY | O_NOCTTY); + rs232_prijat = open(KOMUNIKACNY_SUBOR, O_RDWR | O_NOCTTY | O_NDELAY); int uspech; - /* uspech = rs232_otvorit_rozhranie(cislo_rozhrania, rychlost, rezim, 0); - if(uspech == -1) - { - return -1; - }*/ - if((ctx = nastavit_ctx_klient()) == NULL) { return -1; } - const char* subor_certifikat = "../certifikaty/klient/klient_rsa.pem"; - const char* subor_kluc = "../certifikaty/klient/klient_rsa.key"; - if(nacitat_certifikaty(ctx, subor_certifikat, subor_kluc) == -1) return -1; + else + { + for(int i = 0; i < argc; i++) + { + if( (!strcmp(argv[i], "-s")) ) + { + uvedeny_subor = 1; + if((argv[i+1] == NULL) ) + { + printf("Nezadali ste cestu ku suboru\n"); + return -1; + } + else + { + subor = argv[i+1]; + } + } + if( (!strcmp(argv[i], "-port")) ) + { + zadane_rozhranie = 1; + if((argv[i+1] == NULL)) + { + printf("Nezadali ste cislo serioveho rozhrania\n"); + return -1; + } + else + { + cislo_rozhrania = atoi(argv[i+1]); + if(RS232_OpenComport(cislo_rozhrania, rychlost, rezim, 1)) + { + fprintf(stderr, "Nebolo mozne otvorit seriove rozhranie\n"); + return -1; + } + } + } + else if( (!strcmp(argv[i], "-n")) ) + { + nacitanie_zo_suboru = 1; + if(generovanie_certifikatu) + { + fprintf(stderr, "Nie je mozne zvolit obidve metody nacitania certifikatov naraz\n"); + return -1; + } + if((argv[i+1] == NULL) || (i == argc-1)) + { + printf("Nezadali ste typ certifikatu ktory chcete nacitat zo suboru\n"); + return -1; + } + else if(!strcmp(argv[i+1], "rsa")) + { + wolfSSL_CTX_load_verify_locations(ctx, "../certifikaty/autorita/autorita_rsa.pem", NULL); + if(nacitat_certifikaty(ctx, RSA_CERTIFIKAT, RSA_KLUC) == -1) return -1; + wolfSSL_CTX_set_verify(ctx, SSL_VERIFY_PEER | SSL_VERIFY_FAIL_IF_NO_PEER_CERT, 0); + + } + else if(!strcmp(argv[i+1], "ecc")) + { + printf("jo\n"); + wolfSSL_CTX_load_verify_locations(ctx, "../certifikaty/autorita/autorita_ecc.pem", NULL); + if(nacitat_certifikaty(ctx, ECC_CERTIFIKAT, ECC_KLUC) == -1) return -1; + wolfSSL_CTX_set_verify(ctx, SSL_VERIFY_PEER | SSL_VERIFY_FAIL_IF_NO_PEER_CERT, 0); + + } + else + { + printf("Zadali ste nespravny typ certifikatu\n"); + return -1; + } + } + else if( (!strcmp(argv[i], "-g")) ) + { + generovanie_certifikatu = 1; + if(nacitanie_zo_suboru) + { + fprintf(stderr, "Nie je mozne zvolit obidve metody nacitania certifikatov naraz\n"); + return -1; + } + if((argv[i+1] == NULL) || (i == argc-1)) + { + printf("Nezadali ste typ certifikatu ktory chcete vygenerovat\n"); + return -1; + } + else if(!strcmp(argv[i+1], "rsa")) + { + wolfSSL_CTX_load_verify_locations(ctx, "../certifikaty/autorita/autorita_rsa.pem", NULL); + if(generovat_rsa_certifikat(RSA_VELKOST, RSA_EXPONENT, CTC_SHA256wRSA, "SR", "Kosice", "local.dev", "server@server.sk") == -1) return -1; + if(nacitat_certifikaty(ctx, VYGENEROVANY_CERTIFIKAT, VYGENEROVANY_KLUC) == -1) return -1; + + } + else if(!strcmp(argv[i+1], "ecc")) + { + wolfSSL_CTX_load_verify_locations(ctx, "../certifikaty/autorita/autorita_ecc.pem", NULL); + if(generovat_ecc_certifikat(ECC_VELKOST, ECC_SECP256R1, CTC_SHAwECDSA, "SR", "Kosice", "local.dev", "server@server.sk") == -1) return -1; + if(nacitat_certifikaty(ctx, VYGENEROVANY_CERTIFIKAT, VYGENEROVANY_KLUC) == -1) return -1; + } + else + { + printf("Zadali ste nespravny typ certifikatu\n"); + return -1; + } + } + } + } + + if(!zadane_rozhranie) + { + fprintf(stderr, "Nebol urcene seriove rozhranie\n"); + return -1; + } + else if(!generovanie_certifikatu && !nacitanie_zo_suboru) + { + fprintf(stderr, "Nebola zvolena metoda nacitania certifikatov\n"); + printf("Zadajde prepinac -g (generovanie), alebo -n (nacitanie_zo_suboru) s parametrom rsa alebo ecc\n"); + return -1; + } + else if(!uvedeny_subor) + { + fprintf(stderr, "Nebola uvedena cesta ku suboru na odoslanie\n"); + return -1; + } + + + //nastav_sifry(ctx, "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256"); + //wolfSSL_CTX_set_verify(ctx, SSL_VERIFY_NONE, 0); wolfSSL_SetIOSend(ctx, rs232_zapis); wolfSSL_SetIORecv(ctx, rs232_citanie); @@ -89,27 +284,26 @@ int main(int argc, char const *argv[]) wolfSSL_set_fd(ssl, rs232_prijat); wolfSSL_set_using_nonblock(ssl, rs232_prijat); - printf("bol som tu\n"); - - while(uspech != SSL_SUCCESS) + uspech = wolfSSL_connect(ssl); + if(uspech != SSL_SUCCESS) { - uspech |= wolfSSL_connect(ssl); - printf("bol sss\n"); - if(uspech != SSL_SUCCESS) - { - printf("Nepodarilo sa pripojit%d\n", uspech); - return -1; - } - else - { - printf("oukej\n"); - } + char* popis_chyby = calloc(100, sizeof(char)); + int chyba = wolfSSL_get_error(ssl, 0); + wolfSSL_ERR_error_string(chyba, popis_chyby); + fprintf(stderr, "Nastala chyba v spojeni.\nCislo chyby: %d\nDovod chyby: %s\n", chyba, popis_chyby); + printf("Skontrolujte certifikaty.\n"); + return -1; } - printf("bol som aj tu tu\n"); - - - wolfSSL_write(ssl, "nieco", 10); + zobraz_sifru(ssl); + zobraz_certifikat(ssl); + nastav_funkciu(&nastavenia, funkcia_BLAKE2B); + if(poslat_subor(ssl, ctx, subor, &nastavenia) == -1) return -1; + ukoncit_spojenie(ssl, ctx); + RS232_CloseComport(cislo_rozhrania); + + close(rs232_prijat); + close(open(KOMUNIKACNY_SUBOR, O_RDWR | O_NOCTTY | O_NDELAY)); return 0; } \ No newline at end of file diff --git a/rs232_kanal/klient.txt b/rs232_kanal/klient.txt index 75b83b4..a4ddae4 100644 Binary files a/rs232_kanal/klient.txt and b/rs232_kanal/klient.txt differ diff --git a/rs232_kanal/nieco.txt b/rs232_kanal/nieco.txt new file mode 100644 index 0000000..ac1a098 --- /dev/null +++ b/rs232_kanal/nieco.txt @@ -0,0 +1 @@ +jano \ No newline at end of file diff --git a/rs232_kanal/server.c b/rs232_kanal/server.c index 553ed6f..6f315d8 100644 --- a/rs232_kanal/server.c +++ b/rs232_kanal/server.c @@ -3,7 +3,7 @@ // Meno studenta: Tomas Lukac // // Veduci BP: prof. Ing. Milos Drutarovsky CSc. // // Skola: KEMT FEI TUKE // -// Datum poslednej upravy: 12.3.2020 // +// Datum poslednej upravy: 6.4.2020 // ////////////////////////////////////////////////// #include @@ -17,7 +17,8 @@ #include #include #include -#define O_NOCTTY 0 +#define O_NOCTTY 0x8000 +#define O_NDELAY 0x4000 #else #include #endif @@ -26,82 +27,267 @@ #include "../kniznica/komunikacia.h" #include "../kniznica/rs232.h" -int rs232_poslat; +#define RSA_VELKOST 2048 +#define ECC_VELKOST 32 +#define RSA_EXPONENT 65537 + +//cesty ku suborom +#define RSA_KLUC "../certifikaty/server/server_rsa.key" +#define RSA_CERTIFIKAT "../certifikaty/server/server_rsa.pem" +#define ECC_KLUC "../certifikaty/server/server_ecc.key" +#define ECC_CERTIFIKAT "../certifikaty/server/server_ecc.pem" +#define VYGENEROVANY_KLUC "../certifikaty/server/vygenerovany_kluc.key" +#define VYGENEROVANY_CERTIFIKAT "../certifikaty/server/vygenerovany_certifikat.pem" +#define KOMUNIKACNY_SUBOR "server.txt" + int rs232_prijat; +int cislo_rozhrania = 0; +int aktualne_data = 0; int rs232_citanie(WOLFSSL *ssl, char *buf, int sz, void *ctx) { int uspech = 0; - while(uspech <= 0) + + //ziskanie dat zo serioveho rozhrania + if(aktualne_data == 0) { - uspech = read(rs232_prijat, buf, sz); + FILE* f = fopen(KOMUNIKACNY_SUBOR, "ab"); + int nacitane_data = 0; + int prebieha_nacitanie = 0; + unsigned char znak; + + //kontrolne vzory, ktore jednoznacne identifikuju zaciatok a koniec spravy + unsigned char zaciatok_spravy[] = {0xAA, 0xAA, 0xAA, 0xAA}; + int zaciatok_spravy_pozicia = 0; //aktualna pozicia v kontrolnom vzore + unsigned char koniec_spravy[] = {0xBB, 0xBB, 0xBB, 0xBB}; + int koniec_spravy_pozicia = 0; //aktualna pozicia v kontrolnom vzore + + while(1) + { + uspech = RS232_PollComport(cislo_rozhrania, &znak, 1); + if(uspech > 0) + { + //ak bol najdeny koniec kontrolneho vzoru, tak je zapnuta znacka, + //ktora urcuje ze prebieha nacitavanie spravy + if((znak == zaciatok_spravy[zaciatok_spravy_pozicia]) && (zaciatok_spravy_pozicia <= 2)) + { + zaciatok_spravy_pozicia++; + } + else if((znak == zaciatok_spravy[zaciatok_spravy_pozicia]) && (zaciatok_spravy_pozicia > 2)) + { + prebieha_nacitanie = 1; + zaciatok_spravy_pozicia = 0; + } + else if((prebieha_nacitanie) && (znak == koniec_spravy[koniec_spravy_pozicia]) && (koniec_spravy_pozicia <= 2)) + { + koniec_spravy_pozicia++; + } + //ak bol najdeny koniec kontrolneho vzoru, tak je vypnuta znacka, + //ktora urcuje ze prebieha nacitanie spravy + else if((prebieha_nacitanie) && (znak == koniec_spravy[koniec_spravy_pozicia]) && (koniec_spravy_pozicia > 2)) + { + prebieha_nacitanie = 0; + break; + } + else + { + if(prebieha_nacitanie) + { + fwrite((char*)&znak, 1, uspech, f); + nacitane_data += uspech; + } + } + } + } + aktualne_data = nacitane_data; + printf("Nacital som %d dat\n", nacitane_data); + + fclose(f); } + + //nacitanie dat zo suboru do buffera + uspech = 0; + while(uspech <= 0) + uspech = read(rs232_prijat, buf, sz); + aktualne_data -= uspech; return uspech; } int rs232_zapis(WOLFSSL *ssl, char *buf, int sz, void *ctx) { int uspech = 0; - uspech = write(rs232_poslat, buf, sz); + + //kontrolne vzory, ktore jednoznacne identifikuju zaciatok a koniec spravy + unsigned char zaciatok_spravy[] = {0xAA, 0xAA, 0xAA, 0xAA}; + unsigned char koniec_spravy[] = {0xBB, 0xBB, 0xBB, 0xBB}; + + RS232_SendBuf(cislo_rozhrania, (unsigned char*)zaciatok_spravy, 4); + uspech = RS232_SendBuf(cislo_rozhrania, (unsigned char*)buf, sz); + RS232_SendBuf(cislo_rozhrania, (unsigned char*)koniec_spravy, 4); + printf("Odoslal som %d %d\n", uspech, sz); return uspech; -} +} int main(int argc, char const *argv[]) { WOLFSSL *ssl; WOLFSSL_CTX *ctx = NULL; - int cislo_rozhrania = 5; int rychlost = 9600; char rezim[]={'8','N','1', 0}; - - rs232_poslat = open("klient.txt", O_WRONLY | O_NOCTTY); - printf("%d\n", rs232_poslat); - rs232_prijat = open("server.txt", O_RDONLY | O_NOCTTY); - printf("%d\n", rs232_prijat); + int zadane_rozhranie = 0; + int generovanie_certifikatu = 0; + int nacitanie_zo_suboru = 0; + nastavenia_aplikacie nastavenia; + rs232_prijat = open(KOMUNIKACNY_SUBOR, O_RDWR | O_NOCTTY | O_NDELAY); int uspech; - /* uspech = rs232_otvorit_rozhranie(cislo_rozhrania, rychlost, rezim, 0); - if(uspech == -1) - { - return -1; - } -*/ if((ctx = nastavit_ctx_server()) == NULL) { return -1; } - const char* subor_certifikat = "../certifikaty/server/server_rsa.pem"; - const char* subor_kluc = "../certifikaty/server/server_rsa.key"; - if(nacitat_certifikaty(ctx, subor_certifikat, subor_kluc) == -1) return -1; + else + { + for(int i = 0; i < argc; i++) + { + if( (!strcmp(argv[i], "-port")) ) + { + zadane_rozhranie = 1; + if((argv[i+1] == NULL)) + { + printf("Nezadali ste cislo serioveho rozhrania\n"); + return -1; + } + else + { + cislo_rozhrania = atoi(argv[i+1]); + if(RS232_OpenComport(cislo_rozhrania, rychlost, rezim, 1)) + { + fprintf(stderr, "Nebolo mozne otvorit seriove rozhranie\n"); + return -1; + } + } + } + else if( (!strcmp(argv[i], "-n")) ) + { + nacitanie_zo_suboru = 1; + if(generovanie_certifikatu) + { + fprintf(stderr, "Nie je mozne zvolit obidve metody nacitania certifikatov naraz\n"); + return -1; + } + if((argv[i+1] == NULL) || (i == argc-1)) + { + printf("Nezadali ste typ certifikatu ktory chcete nacitat zo suboru\n"); + return -1; + } + else if(!strcmp(argv[i+1], "rsa")) + { + wolfSSL_CTX_load_verify_locations(ctx, "../certifikaty/autorita/autorita_rsa.pem", NULL); + if(nacitat_certifikaty(ctx, RSA_CERTIFIKAT, RSA_KLUC) == -1) return -1; + wolfSSL_CTX_set_verify(ctx, SSL_VERIFY_PEER | SSL_VERIFY_FAIL_IF_NO_PEER_CERT, 0); + + } + else if(!strcmp(argv[i+1], "ecc")) + { + printf("jo\n"); + wolfSSL_CTX_load_verify_locations(ctx, "../certifikaty/autorita/autorita_ecc.pem", NULL); + if(nacitat_certifikaty(ctx, ECC_CERTIFIKAT, ECC_KLUC) == -1) return -1; + wolfSSL_CTX_set_verify(ctx, SSL_VERIFY_PEER | SSL_VERIFY_FAIL_IF_NO_PEER_CERT, 0); + + } + else + { + printf("Zadali ste nespravny typ certifikatu\n"); + return -1; + } + } + else if( (!strcmp(argv[i], "-g")) ) + { + generovanie_certifikatu = 1; + if(nacitanie_zo_suboru) + { + fprintf(stderr, "Nie je mozne zvolit obidve metody nacitania certifikatov naraz\n"); + return -1; + } + if((argv[i+1] == NULL) || (i == argc-1)) + { + printf("Nezadali ste typ certifikatu ktory chcete vygenerovat\n"); + return -1; + } + else if(!strcmp(argv[i+1], "rsa")) + { + wolfSSL_CTX_load_verify_locations(ctx, "../certifikaty/autorita/autorita_rsa.pem", NULL); + if(generovat_rsa_certifikat(RSA_VELKOST, RSA_EXPONENT, CTC_SHA256wRSA, "SR", "Kosice", "local.dev", "server@server.sk") == -1) return -1; + if(nacitat_certifikaty(ctx, VYGENEROVANY_CERTIFIKAT, VYGENEROVANY_KLUC) == -1) return -1; + + } + else if(!strcmp(argv[i+1], "ecc")) + { + wolfSSL_CTX_load_verify_locations(ctx, "../certifikaty/autorita/autorita_ecc.pem", NULL); + if(generovat_ecc_certifikat(ECC_VELKOST, ECC_SECP256R1, CTC_SHAwECDSA, "SR", "Kosice", "local.dev", "server@server.sk") == -1) return -1; + if(nacitat_certifikaty(ctx, VYGENEROVANY_CERTIFIKAT, VYGENEROVANY_KLUC) == -1) return -1; + } + else + { + printf("Zadali ste nespravny typ certifikatu\n"); + return -1; + } + } + } + } + + if(!zadane_rozhranie) + { + fprintf(stderr, "Nebol urcene seriove rozhranie\n"); + return -1; + } + else if(!generovanie_certifikatu && !nacitanie_zo_suboru) + { + fprintf(stderr, "Nebola zvolena metoda nacitania certifikatov\n"); + printf("Zadajde prepinac -g (generovanie), alebo -n (nacitanie_zo_suboru) s parametrom rsa alebo ecc\n"); + return -1; + } + + //nastav_sifry(ctx, "TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256"); + //wolfSSL_CTX_set_verify(ctx, SSL_VERIFY_NONE, 0); wolfSSL_SetIOSend(ctx, rs232_zapis); wolfSSL_SetIORecv(ctx, rs232_citanie); - if ((ssl = wolfSSL_new(ctx)) == NULL) + while(1) { - printf("Nepodarilo sa vytvorit ssl relaciu\n"); - wolfSSL_CTX_free(ctx); - return -1; - } + printf("------------\n"); + if ((ssl = wolfSSL_new(ctx)) == NULL) + { + printf("Nepodarilo sa vytvorit ssl relaciu\n"); + wolfSSL_CTX_free(ctx); + return -1; + } + + wolfSSL_set_fd(ssl, rs232_prijat); + wolfSSL_set_using_nonblock(ssl, rs232_prijat); - wolfSSL_set_fd(ssl, rs232_prijat); - wolfSSL_set_using_nonblock(ssl, rs232_prijat); - - printf("bol som tu\n"); - while(uspech != SSL_SUCCESS) - { uspech = wolfSSL_accept(ssl); - printf("%d\n", uspech); + if(uspech != SSL_SUCCESS) + { + char* popis_chyby = calloc(100, sizeof(char)); + int chyba = wolfSSL_get_error(ssl, 0); + wolfSSL_ERR_error_string(chyba, popis_chyby); + fprintf(stderr, "Nastala chyba v spojeni.\nCislo chyby: %d\nDovod chyby: %s\n", chyba, popis_chyby); + printf("Skontrolujte certifikaty.\n"); + return -1; + } + zobraz_sifru(ssl); + zobraz_certifikat(ssl); + nastav_funkciu(&nastavenia, funkcia_BLAKE2B); + prijat_subor(ssl, ctx, &nastavenia); } - printf("bol som aj tu tu\n"); - - - char sprava[100]; - wolfSSL_read(ssl, sprava, 10); - printf("%s\n", sprava); - + RS232_CloseComport(cislo_rozhrania); + close(rs232_prijat); + close(open(KOMUNIKACNY_SUBOR, O_RDWR | O_NOCTTY | O_NDELAY)); + return 0; -} \ No newline at end of file +} diff --git a/rs232_kanal/server.txt b/rs232_kanal/server.txt index f50f1d9..6dc69ae 100644 Binary files a/rs232_kanal/server.txt and b/rs232_kanal/server.txt differ diff --git a/rs232_kanal/spustit_klient.bat b/rs232_kanal/spustit_klient.bat new file mode 100644 index 0000000..88e30ba --- /dev/null +++ b/rs232_kanal/spustit_klient.bat @@ -0,0 +1,16 @@ +:::::::::::::::::::::::::::::::::::::::::::::::::: +:: Bakalarska praca :: +:: Meno studenta: Tomas Lukac :: +:: Veduci BP: prof. Ing. Milos Drutarovsky CSc. :: +:: Skola: KEMT FEI TUKE :: +:: Datum poslednej upravy: 6.4.2020 :: +:::::::::::::::::::::::::::::::::::::::::::::::::: + +:: Program je mozne spustit s prepinacmi: +:: -port seriove_rozhranie +:: -g rsa|ecc sluzi na generovanie certifikatu +:: -n rsa|ecc sluzi na nacitanie uz vygenerovanych certifikatov z adresara /certifikaty +:: -s cesta-ku-suboru sluzi na nacitanie cesty k suboru, ktory chceme odoslat (este nie je) + +::Priklady spustenia: +klient -port 4 -n rsa -s nieco.txt diff --git a/rs232_kanal/spustit_server.bat b/rs232_kanal/spustit_server.bat new file mode 100644 index 0000000..8d46af1 --- /dev/null +++ b/rs232_kanal/spustit_server.bat @@ -0,0 +1,19 @@ +:::::::::::::::::::::::::::::::::::::::::::::::::: +:: Bakalarska praca :: +:: Meno studenta: Tomas Lukac :: +:: Veduci BP: prof. Ing. Milos Drutarovsky CSc. :: +:: Skola: KEMT FEI TUKE :: +:: Datum poslednej upravy: 6.4.2020 :: +:::::::::::::::::::::::::::::::::::::::::::::::::: + +:: Program server je mozne spustit s prepinacmi: +:: -port seriove_rozhranie +:: -g rsa|ecc sluzi na generovanie certifikatu +:: -n rsa|ecc sluzi na nacitanie uz vygenerovanych certifikatov z adresara /certifikaty + +del klient.txt +del server.txt +type nul >klient.txt +type nul >server.txt + +server -port 5 -n rsa \ No newline at end of file diff --git a/rs232_kanal/wolfssl.dll b/rs232_kanal/wolfssl.dll deleted file mode 100644 index 635a2d4..0000000 Binary files a/rs232_kanal/wolfssl.dll and /dev/null differ diff --git a/rs232_kanal/wolfssl_32.dll b/rs232_kanal/wolfssl_32.dll deleted file mode 100644 index 882927c..0000000 Binary files a/rs232_kanal/wolfssl_32.dll and /dev/null differ diff --git a/tcpip_kanal/Makefile b/tcpip_kanal/Makefile index 767b961..1f49917 100644 --- a/tcpip_kanal/Makefile +++ b/tcpip_kanal/Makefile @@ -3,38 +3,37 @@ ## Meno studenta: Tomas Lukac ## ## Veduci BP: prof. Ing. Milos Drutarovsky CSc. ## ## Skola: KEMT FEI TUKE ## -## Datum poslednej upravy: 12.3.2020 ## +## Datum poslednej upravy: 6.4.2020 ## ################################################## #prekladac CC = gcc #prepinace pre prekladac -CFLAGS = -Wcpp -I./../wolfssl_hlavickove_subory/ -LIB = -L. -lwolfssl +CFLAGS = -Wcpp -Werror -I./../wolfssl/ +LIB = ifeq ($(OS), Windows_NT) - LIB += -lws2_32 ifeq ($(PROCESSOR_ARCHITECTURE), AMD64) - LIB += -m64 + LIB += -L./../wolfssl/64bit_kniznice/ -lwolfssl -lws2_32 -m64 endif ifeq ($(PROCESSOR_ARCHITECTURE), x86) - LIB += -Os + LIB += -L./../wolfssl/32bit_kniznice/ -lwolfssl -lws2_32 -Os endif else UNAME_S := $(shell uname -s) ifeq ($(UNAME_S), Linux) - LIB += + LIB += -lwolfssl endif endif all: klient server -klient: klient.o kryptografia.o komunikacia.o - $(CC) $(CFLAGS) -o klient klient.o kryptografia.o komunikacia.o $(LIB) +klient: klient.o kryptografia.o komunikacia.o rs232.o + $(CC) $(CFLAGS) -o klient klient.o kryptografia.o komunikacia.o rs232.o $(LIB) -server: server.o kryptografia.o komunikacia.o - $(CC) $(CFLAGS) -o server server.o kryptografia.o komunikacia.o $(LIB) +server: server.o kryptografia.o komunikacia.o rs232.o + $(CC) $(CFLAGS) -o server server.o kryptografia.o komunikacia.o rs232.o $(LIB) klient.o: klient.c $(CC) $(CFLAGS) -c klient.c $(LIB) @@ -48,6 +47,9 @@ kryptografia.o: ../kniznica/kryptografia.c ../kniznica/kryptografia.h komunikacia.o: ../kniznica/komunikacia.c ../kniznica/komunikacia.h $(CC) $(CFLAGS) -c ../kniznica/komunikacia.c $(LIB) +rs232.o: ../kniznica/rs232.c ../kniznica/rs232.h + $(CC) $(CFLAGS) -c ../kniznica/rs232.c $(LIB) + .PHONY: clean clean-linux: diff --git a/tcpip_kanal/klient.c b/tcpip_kanal/klient.c index 142b408..af84afd 100644 --- a/tcpip_kanal/klient.c +++ b/tcpip_kanal/klient.c @@ -3,7 +3,7 @@ // Meno studenta: Tomas Lukac // // Veduci BP: prof. Ing. Milos Drutarovsky CSc. // // Skola: KEMT FEI TUKE // -// Datum poslednej upravy: 12.3.2020 // +// Datum poslednej upravy: 6.4.2020 // ////////////////////////////////////////////////// #include "../kniznica/kryptografia.h" @@ -31,6 +31,7 @@ int main(int argc, char** argv) int uvedeny_subor = 0; int ip = 0; int port = 0; + nastavenia_aplikacie nastavenia; #if defined (_WIN32) WSADATA d; @@ -45,8 +46,6 @@ int main(int argc, char** argv) int cislo_portu = 0; char* ip_adresa = NULL; char* subor = NULL; - const char *subor_certifikat = NULL; - const char *subor_kluc = NULL; WOLFSSL *ssl; WOLFSSL_CTX *ctx; if((ctx = nastavit_ctx_klient()) == NULL) @@ -200,8 +199,8 @@ int main(int argc, char** argv) } zobraz_sifru(ssl); zobraz_certifikat(ssl); - nastav_funkciu(funkcia_BLAKE2B); - if(poslat_subor(ssl, ctx, subor) == -1) return -1; + nastav_funkciu(&nastavenia, funkcia_BLAKE2B); + if(poslat_subor(ssl, ctx, subor, &nastavenia) == -1) return -1; ukoncit_spojenie(ssl, ctx); } diff --git a/tcpip_kanal/server.c b/tcpip_kanal/server.c index d373c37..4f34a36 100644 --- a/tcpip_kanal/server.c +++ b/tcpip_kanal/server.c @@ -3,7 +3,7 @@ // Meno studenta: Tomas Lukac // // Veduci BP: prof. Ing. Milos Drutarovsky CSc. // // Skola: KEMT FEI TUKE // -// Datum poslednej upravy: 12.3.2020 // +// Datum poslednej upravy: 6.4.2020 // ////////////////////////////////////////////////// #include "../kniznica/kryptografia.h" @@ -25,11 +25,11 @@ int main(int argc, char **argv) { - int autentizacia_klienta = 0; int generovanie_certifikatu = 0; int nacitanie_zo_suboru = 0; int port = 0; + nastavenia_aplikacie nastavenia; #if defined (_WIN32) WSADATA d; @@ -174,8 +174,8 @@ int main(int argc, char **argv) } zobraz_sifru(ssl); zobraz_certifikat(ssl); - nastav_funkciu(funkcia_BLAKE2B); - prijat_subor(ssl, ctx); + nastav_funkciu(&nastavenia, funkcia_BLAKE2B); + prijat_subor(ssl, ctx, &nastavenia); } } ukoncit_soket(cislo_soketu); diff --git a/tcpip_kanal/spustit_klient.bat b/tcpip_kanal/spustit_klient.bat index 7116547..49202ce 100644 --- a/tcpip_kanal/spustit_klient.bat +++ b/tcpip_kanal/spustit_klient.bat @@ -3,13 +3,13 @@ :: Meno studenta: Tomas Lukac :: :: Veduci BP: prof. Ing. Milos Drutarovsky CSc. :: :: Skola: KEMT FEI TUKE :: -:: Datum poslednej upravy: 9.3.2020 :: +:: Datum poslednej upravy: 6.4.2020 :: :::::::::::::::::::::::::::::::::::::::::::::::::: :: Program je mozne spustit s prepinacmi: :: -g rsa|ecc sluzi na generovanie certifikatu :: -n rsa|ecc sluzi na nacitanie uz vygenerovanych certifikatov z adresara /certifikaty -:: -s cesta-ku-suboru sluzi na nacitanie cesty k suboru, ktory chceme odoslat (este nie je) +:: -s cesta-ku-suboru sluzi na nacitanie cesty k suboru, ktory chceme odoslat ::Priklady spustenia: klient -ip 127.0.0.1 -port 8080 -n rsa diff --git a/tcpip_kanal/spustit_server.bat b/tcpip_kanal/spustit_server.bat index f5ee4aa..ef1c779 100644 --- a/tcpip_kanal/spustit_server.bat +++ b/tcpip_kanal/spustit_server.bat @@ -3,7 +3,7 @@ :: Meno studenta: Tomas Lukac :: :: Veduci BP: prof. Ing. Milos Drutarovsky CSc. :: :: Skola: KEMT FEI TUKE :: -:: Datum poslednej upravy: 9.3.2020 :: +:: Datum poslednej upravy: 6.4.2020 :: :::::::::::::::::::::::::::::::::::::::::::::::::: :: Program server je mozne spustit s prepinacmi: diff --git a/tcpip_kanal/vcruntime140.dll b/tcpip_kanal/vcruntime140.dll deleted file mode 100644 index e8270e1..0000000 Binary files a/tcpip_kanal/vcruntime140.dll and /dev/null differ diff --git a/tcpip_kanal/vcruntime140_64.dll b/tcpip_kanal/vcruntime140_64.dll deleted file mode 100644 index 2158687..0000000 Binary files a/tcpip_kanal/vcruntime140_64.dll and /dev/null differ diff --git a/tcpip_kanal/wolfssl.dll b/tcpip_kanal/wolfssl.dll deleted file mode 100644 index 635a2d4..0000000 Binary files a/tcpip_kanal/wolfssl.dll and /dev/null differ diff --git a/tcpip_kanal/wolfssl_32.dll b/tcpip_kanal/wolfssl_32.dll deleted file mode 100644 index 882927c..0000000 Binary files a/tcpip_kanal/wolfssl_32.dll and /dev/null differ diff --git a/teoria/serial.txt b/teoria/serial.txt deleted file mode 100644 index bd0cde0..0000000 --- a/teoria/serial.txt +++ /dev/null @@ -1,19 +0,0 @@ -seriove rozhranie - - prenasa data po jednom bite - vyhody: lacnejsie kable a mensie konektory - - vacsinou myslime rozhrania vyuzivajuce asynchronne seriove protokoly, napr. rs232 rozhranie , rozhrania na vstavanych - zariadeniach, a ine - - vacsina seriovych rozhrani su obojsmerne: mozu prijimat aj posielat data - - vyhody - 1. mozu si medzi sebou vymienat rozne typy informacii - aplikacie vyuzivajuce seriove rozhrania casto zahrnuju citacie senzory, prepinace alebo ine vstupy - riadenie motoru, rele, displeje a ine vystupy - 2. lacny a dostupny HW - ak nie je k dispozicii seriovy port, existuje usb/serial konvertor - 3. okrem start, stop a paritnych bitov pridanych do kazdeho prenasaneho bajtu, seriove rozhrania - nepridavaju ziadne informacie ku prenasanym datam, narozdiel od usb, ethernet, kt. pouzivaju sofistikovane protokoly - ktore definuju format prenasanych dat. hardware a firmware musia implementovat tieto protokoly, co pridava komplexnost - kt. niektore aplikacie nepotrebuju - 4. kable mzou byt dlhe - 5. jednotlive os poskytuju ovladace pre pristup k seriovym rozhraniam - program. jazyky poskytuju triedy, kniznice alebo ine nastroje na seriovu komunikaciu \ No newline at end of file diff --git a/wolfssl/32bit_kniznice/api-ms-win-crt-runtime-l1-1-0.dll b/wolfssl/32bit_kniznice/api-ms-win-crt-runtime-l1-1-0.dll new file mode 100644 index 0000000..3c9dc39 Binary files /dev/null and b/wolfssl/32bit_kniznice/api-ms-win-crt-runtime-l1-1-0.dll differ diff --git a/rs232_kanal/vcruntime140.dll b/wolfssl/32bit_kniznice/vcruntime140.dll similarity index 100% rename from rs232_kanal/vcruntime140.dll rename to wolfssl/32bit_kniznice/vcruntime140.dll diff --git a/wolfssl/32bit_kniznice/wolfssl.dll b/wolfssl/32bit_kniznice/wolfssl.dll new file mode 100644 index 0000000..6d16114 Binary files /dev/null and b/wolfssl/32bit_kniznice/wolfssl.dll differ diff --git a/wolfssl/64bit_kniznice/api-ms-win-crt-runtime-l1-1-0.dll b/wolfssl/64bit_kniznice/api-ms-win-crt-runtime-l1-1-0.dll new file mode 100644 index 0000000..ff1c19a Binary files /dev/null and b/wolfssl/64bit_kniznice/api-ms-win-crt-runtime-l1-1-0.dll differ diff --git a/rs232_kanal/vcruntime140_64.dll b/wolfssl/64bit_kniznice/vcruntime140.dll similarity index 100% rename from rs232_kanal/vcruntime140_64.dll rename to wolfssl/64bit_kniznice/vcruntime140.dll diff --git a/wolfssl/64bit_kniznice/wolfssl.dll b/wolfssl/64bit_kniznice/wolfssl.dll new file mode 100644 index 0000000..ce2da33 Binary files /dev/null and b/wolfssl/64bit_kniznice/wolfssl.dll differ diff --git a/wolfssl_hlavickove_subory/wolfssl/callbacks.h b/wolfssl/wolfssl/callbacks.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/callbacks.h rename to wolfssl/wolfssl/callbacks.h diff --git a/wolfssl_hlavickove_subory/wolfssl/certs_test.h b/wolfssl/wolfssl/certs_test.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/certs_test.h rename to wolfssl/wolfssl/certs_test.h diff --git a/wolfssl_hlavickove_subory/wolfssl/crl.h b/wolfssl/wolfssl/crl.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/crl.h rename to wolfssl/wolfssl/crl.h diff --git a/wolfssl_hlavickove_subory/wolfssl/error-ssl.h b/wolfssl/wolfssl/error-ssl.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/error-ssl.h rename to wolfssl/wolfssl/error-ssl.h diff --git a/wolfssl_hlavickove_subory/wolfssl/include.am b/wolfssl/wolfssl/include.am similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/include.am rename to wolfssl/wolfssl/include.am diff --git a/wolfssl_hlavickove_subory/wolfssl/internal.h b/wolfssl/wolfssl/internal.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/internal.h rename to wolfssl/wolfssl/internal.h diff --git a/wolfssl_hlavickove_subory/wolfssl/ocsp.h b/wolfssl/wolfssl/ocsp.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/ocsp.h rename to wolfssl/wolfssl/ocsp.h diff --git a/wolfssl_hlavickove_subory/wolfssl/openssl/aes.h b/wolfssl/wolfssl/openssl/aes.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/openssl/aes.h rename to wolfssl/wolfssl/openssl/aes.h diff --git a/wolfssl_hlavickove_subory/wolfssl/openssl/asn1.h b/wolfssl/wolfssl/openssl/asn1.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/openssl/asn1.h rename to wolfssl/wolfssl/openssl/asn1.h diff --git a/wolfssl_hlavickove_subory/wolfssl/openssl/bio.h b/wolfssl/wolfssl/openssl/bio.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/openssl/bio.h rename to wolfssl/wolfssl/openssl/bio.h diff --git a/wolfssl_hlavickove_subory/wolfssl/openssl/bn.h b/wolfssl/wolfssl/openssl/bn.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/openssl/bn.h rename to wolfssl/wolfssl/openssl/bn.h diff --git a/wolfssl_hlavickove_subory/wolfssl/openssl/buffer.h b/wolfssl/wolfssl/openssl/buffer.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/openssl/buffer.h rename to wolfssl/wolfssl/openssl/buffer.h diff --git a/wolfssl_hlavickove_subory/wolfssl/openssl/conf.h b/wolfssl/wolfssl/openssl/conf.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/openssl/conf.h rename to wolfssl/wolfssl/openssl/conf.h diff --git a/wolfssl_hlavickove_subory/wolfssl/openssl/crypto.h b/wolfssl/wolfssl/openssl/crypto.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/openssl/crypto.h rename to wolfssl/wolfssl/openssl/crypto.h diff --git a/wolfssl_hlavickove_subory/wolfssl/openssl/des.h b/wolfssl/wolfssl/openssl/des.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/openssl/des.h rename to wolfssl/wolfssl/openssl/des.h diff --git a/wolfssl_hlavickove_subory/wolfssl/openssl/dh.h b/wolfssl/wolfssl/openssl/dh.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/openssl/dh.h rename to wolfssl/wolfssl/openssl/dh.h diff --git a/wolfssl_hlavickove_subory/wolfssl/openssl/dsa.h b/wolfssl/wolfssl/openssl/dsa.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/openssl/dsa.h rename to wolfssl/wolfssl/openssl/dsa.h diff --git a/wolfssl_hlavickove_subory/wolfssl/openssl/ec.h b/wolfssl/wolfssl/openssl/ec.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/openssl/ec.h rename to wolfssl/wolfssl/openssl/ec.h diff --git a/wolfssl_hlavickove_subory/wolfssl/openssl/ec25519.h b/wolfssl/wolfssl/openssl/ec25519.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/openssl/ec25519.h rename to wolfssl/wolfssl/openssl/ec25519.h diff --git a/wolfssl_hlavickove_subory/wolfssl/openssl/ecdh.h b/wolfssl/wolfssl/openssl/ecdh.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/openssl/ecdh.h rename to wolfssl/wolfssl/openssl/ecdh.h diff --git a/wolfssl_hlavickove_subory/wolfssl/openssl/ecdsa.h b/wolfssl/wolfssl/openssl/ecdsa.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/openssl/ecdsa.h rename to wolfssl/wolfssl/openssl/ecdsa.h diff --git a/wolfssl_hlavickove_subory/wolfssl/openssl/ed25519.h b/wolfssl/wolfssl/openssl/ed25519.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/openssl/ed25519.h rename to wolfssl/wolfssl/openssl/ed25519.h diff --git a/wolfssl_hlavickove_subory/wolfssl/openssl/engine.h b/wolfssl/wolfssl/openssl/engine.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/openssl/engine.h rename to wolfssl/wolfssl/openssl/engine.h diff --git a/wolfssl_hlavickove_subory/wolfssl/openssl/err.h b/wolfssl/wolfssl/openssl/err.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/openssl/err.h rename to wolfssl/wolfssl/openssl/err.h diff --git a/wolfssl_hlavickove_subory/wolfssl/openssl/evp.h b/wolfssl/wolfssl/openssl/evp.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/openssl/evp.h rename to wolfssl/wolfssl/openssl/evp.h diff --git a/wolfssl_hlavickove_subory/wolfssl/openssl/hmac.h b/wolfssl/wolfssl/openssl/hmac.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/openssl/hmac.h rename to wolfssl/wolfssl/openssl/hmac.h diff --git a/wolfssl_hlavickove_subory/wolfssl/openssl/include.am b/wolfssl/wolfssl/openssl/include.am similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/openssl/include.am rename to wolfssl/wolfssl/openssl/include.am diff --git a/wolfssl_hlavickove_subory/wolfssl/openssl/lhash.h b/wolfssl/wolfssl/openssl/lhash.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/openssl/lhash.h rename to wolfssl/wolfssl/openssl/lhash.h diff --git a/wolfssl_hlavickove_subory/wolfssl/openssl/md4.h b/wolfssl/wolfssl/openssl/md4.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/openssl/md4.h rename to wolfssl/wolfssl/openssl/md4.h diff --git a/wolfssl_hlavickove_subory/wolfssl/openssl/md5.h b/wolfssl/wolfssl/openssl/md5.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/openssl/md5.h rename to wolfssl/wolfssl/openssl/md5.h diff --git a/wolfssl_hlavickove_subory/wolfssl/openssl/objects.h b/wolfssl/wolfssl/openssl/objects.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/openssl/objects.h rename to wolfssl/wolfssl/openssl/objects.h diff --git a/wolfssl_hlavickove_subory/wolfssl/openssl/ocsp.h b/wolfssl/wolfssl/openssl/ocsp.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/openssl/ocsp.h rename to wolfssl/wolfssl/openssl/ocsp.h diff --git a/wolfssl_hlavickove_subory/wolfssl/openssl/opensslconf.h b/wolfssl/wolfssl/openssl/opensslconf.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/openssl/opensslconf.h rename to wolfssl/wolfssl/openssl/opensslconf.h diff --git a/wolfssl_hlavickove_subory/wolfssl/openssl/opensslv.h b/wolfssl/wolfssl/openssl/opensslv.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/openssl/opensslv.h rename to wolfssl/wolfssl/openssl/opensslv.h diff --git a/wolfssl_hlavickove_subory/wolfssl/openssl/ossl_typ.h b/wolfssl/wolfssl/openssl/ossl_typ.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/openssl/ossl_typ.h rename to wolfssl/wolfssl/openssl/ossl_typ.h diff --git a/wolfssl_hlavickove_subory/wolfssl/openssl/pem.h b/wolfssl/wolfssl/openssl/pem.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/openssl/pem.h rename to wolfssl/wolfssl/openssl/pem.h diff --git a/wolfssl_hlavickove_subory/wolfssl/openssl/pkcs12.h b/wolfssl/wolfssl/openssl/pkcs12.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/openssl/pkcs12.h rename to wolfssl/wolfssl/openssl/pkcs12.h diff --git a/wolfssl_hlavickove_subory/wolfssl/openssl/pkcs7.h b/wolfssl/wolfssl/openssl/pkcs7.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/openssl/pkcs7.h rename to wolfssl/wolfssl/openssl/pkcs7.h diff --git a/wolfssl_hlavickove_subory/wolfssl/openssl/rand.h b/wolfssl/wolfssl/openssl/rand.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/openssl/rand.h rename to wolfssl/wolfssl/openssl/rand.h diff --git a/wolfssl_hlavickove_subory/wolfssl/openssl/rc4.h b/wolfssl/wolfssl/openssl/rc4.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/openssl/rc4.h rename to wolfssl/wolfssl/openssl/rc4.h diff --git a/wolfssl_hlavickove_subory/wolfssl/openssl/ripemd.h b/wolfssl/wolfssl/openssl/ripemd.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/openssl/ripemd.h rename to wolfssl/wolfssl/openssl/ripemd.h diff --git a/wolfssl_hlavickove_subory/wolfssl/openssl/rsa.h b/wolfssl/wolfssl/openssl/rsa.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/openssl/rsa.h rename to wolfssl/wolfssl/openssl/rsa.h diff --git a/wolfssl_hlavickove_subory/wolfssl/openssl/sha.h b/wolfssl/wolfssl/openssl/sha.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/openssl/sha.h rename to wolfssl/wolfssl/openssl/sha.h diff --git a/wolfssl_hlavickove_subory/wolfssl/openssl/ssl.h b/wolfssl/wolfssl/openssl/ssl.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/openssl/ssl.h rename to wolfssl/wolfssl/openssl/ssl.h diff --git a/wolfssl_hlavickove_subory/wolfssl/openssl/ssl23.h b/wolfssl/wolfssl/openssl/ssl23.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/openssl/ssl23.h rename to wolfssl/wolfssl/openssl/ssl23.h diff --git a/wolfssl_hlavickove_subory/wolfssl/openssl/stack.h b/wolfssl/wolfssl/openssl/stack.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/openssl/stack.h rename to wolfssl/wolfssl/openssl/stack.h diff --git a/wolfssl_hlavickove_subory/wolfssl/openssl/tls1.h b/wolfssl/wolfssl/openssl/tls1.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/openssl/tls1.h rename to wolfssl/wolfssl/openssl/tls1.h diff --git a/wolfssl_hlavickove_subory/wolfssl/openssl/ui.h b/wolfssl/wolfssl/openssl/ui.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/openssl/ui.h rename to wolfssl/wolfssl/openssl/ui.h diff --git a/wolfssl_hlavickove_subory/wolfssl/openssl/x509.h b/wolfssl/wolfssl/openssl/x509.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/openssl/x509.h rename to wolfssl/wolfssl/openssl/x509.h diff --git a/wolfssl_hlavickove_subory/wolfssl/openssl/x509_vfy.h b/wolfssl/wolfssl/openssl/x509_vfy.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/openssl/x509_vfy.h rename to wolfssl/wolfssl/openssl/x509_vfy.h diff --git a/wolfssl_hlavickove_subory/wolfssl/openssl/x509v3.h b/wolfssl/wolfssl/openssl/x509v3.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/openssl/x509v3.h rename to wolfssl/wolfssl/openssl/x509v3.h diff --git a/wolfssl_hlavickove_subory/wolfssl/options.h b/wolfssl/wolfssl/options.h similarity index 99% rename from wolfssl_hlavickove_subory/wolfssl/options.h rename to wolfssl/wolfssl/options.h index fd1bea0..ba3629d 100644 --- a/wolfssl_hlavickove_subory/wolfssl/options.h +++ b/wolfssl/wolfssl/options.h @@ -25,6 +25,12 @@ #ifndef WOLFSSL_OPTIONS_H #define WOLFSSL_OPTIONS_H + + +#ifdef __cplusplus +extern "C" { +#endif + #undef HAVE_FFDHE_2048 #define HAVE_FFDHE_2048 @@ -276,10 +282,6 @@ #undef HAVE___UINT128_T #define HAVE___UINT128_T -#ifdef __cplusplus -extern "C" { -#endif - #ifdef __cplusplus } diff --git a/wolfssl/wolfssl/options.h.in b/wolfssl/wolfssl/options.h.in new file mode 100644 index 0000000..29fa97e --- /dev/null +++ b/wolfssl/wolfssl/options.h.in @@ -0,0 +1,40 @@ +/* options.h.in + * + * Copyright (C) 2006-2019 wolfSSL Inc. + * + * This file is part of wolfSSL. + * + * wolfSSL is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * wolfSSL is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA + */ + + +/* default blank options for autoconf */ + +#ifndef WOLFSSL_OPTIONS_H +#define WOLFSSL_OPTIONS_H + + +#ifdef __cplusplus +extern "C" { +#endif + + +#ifdef __cplusplus +} +#endif + + +#endif /* WOLFSSL_OPTIONS_H */ + diff --git a/wolfssl_hlavickove_subory/wolfssl/sniffer.h b/wolfssl/wolfssl/sniffer.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/sniffer.h rename to wolfssl/wolfssl/sniffer.h diff --git a/wolfssl_hlavickove_subory/wolfssl/sniffer_error.h b/wolfssl/wolfssl/sniffer_error.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/sniffer_error.h rename to wolfssl/wolfssl/sniffer_error.h diff --git a/wolfssl_hlavickove_subory/wolfssl/sniffer_error.rc b/wolfssl/wolfssl/sniffer_error.rc similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/sniffer_error.rc rename to wolfssl/wolfssl/sniffer_error.rc diff --git a/wolfssl_hlavickove_subory/wolfssl/ssl.h b/wolfssl/wolfssl/ssl.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/ssl.h rename to wolfssl/wolfssl/ssl.h diff --git a/wolfssl_hlavickove_subory/wolfssl/test.h b/wolfssl/wolfssl/test.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/test.h rename to wolfssl/wolfssl/test.h diff --git a/wolfssl/wolfssl/user_settings.h b/wolfssl/wolfssl/user_settings.h new file mode 100644 index 0000000..177046f --- /dev/null +++ b/wolfssl/wolfssl/user_settings.h @@ -0,0 +1,25 @@ +#ifndef _WIN_USER_SETTINGS_H_ +#define _WIN_USER_SETTINGS_H_ + +/* Verify this is Windows */ +#ifndef _WIN32 +#error This user_settings.h header is only designed for Windows +#endif + #define OPENSSL_EXTRA + #define WOLFSSL_RIPEMD + #define HAVE_TLS_EXTENSIONS + #define WOLFSSL_CERT_GEN + #define WOLFSSL_KEY_GEN + #define WOLFSSL_CERT_REQ + #define HAVE_AESGCM + #define WOLFSSL_SHA384 + #define WOLFSSL_SHA512 + #define WOLFSSL_SHA224 + #define HAVE_BLAKE2 + #define HAVE_BLAKE2B + #define HAVE_SUPPORTED_CURVES + #define HAVE_ECC + #define ECC_TIMING_RESISTANT + #define WC_RSA_BLINDING +#endif /* _WIN_USER_SETTINGS_H_ */ + diff --git a/wolfssl_hlavickove_subory/wolfssl/version.h b/wolfssl/wolfssl/version.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/version.h rename to wolfssl/wolfssl/version.h diff --git a/wolfssl_hlavickove_subory/wolfssl/version.h.in b/wolfssl/wolfssl/version.h.in similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/version.h.in rename to wolfssl/wolfssl/version.h.in diff --git a/wolfssl_hlavickove_subory/wolfssl/wolfcrypt/aes.h b/wolfssl/wolfssl/wolfcrypt/aes.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/wolfcrypt/aes.h rename to wolfssl/wolfssl/wolfcrypt/aes.h diff --git a/wolfssl_hlavickove_subory/wolfssl/wolfcrypt/arc4.h b/wolfssl/wolfssl/wolfcrypt/arc4.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/wolfcrypt/arc4.h rename to wolfssl/wolfssl/wolfcrypt/arc4.h diff --git a/wolfssl_hlavickove_subory/wolfssl/wolfcrypt/asn.h b/wolfssl/wolfssl/wolfcrypt/asn.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/wolfcrypt/asn.h rename to wolfssl/wolfssl/wolfcrypt/asn.h diff --git a/wolfssl_hlavickove_subory/wolfssl/wolfcrypt/asn_public.h b/wolfssl/wolfssl/wolfcrypt/asn_public.h similarity index 99% rename from wolfssl_hlavickove_subory/wolfssl/wolfcrypt/asn_public.h rename to wolfssl/wolfssl/wolfcrypt/asn_public.h index 90cd6c3..1522144 100644 --- a/wolfssl_hlavickove_subory/wolfssl/wolfcrypt/asn_public.h +++ b/wolfssl/wolfssl/wolfcrypt/asn_public.h @@ -232,6 +232,8 @@ typedef struct WOLFSSL_ASN1_INTEGER { #endif #endif /* WOLFSSL_CERT_GEN || WOLFSSL_CERT_EXT */ +#ifdef WOLFSSL_CERT_GEN + #ifdef WOLFSSL_MULTI_ATTRIB #ifndef CTC_MAX_ATTRIB #define CTC_MAX_ATTRIB 4 @@ -344,10 +346,12 @@ WOLFSSL_API int wc_MakeCert_ex(Cert* cert, byte* derBuffer, word32 derSz, int keyType, void* key, WC_RNG* rng); WOLFSSL_API int wc_MakeCert(Cert*, byte* derBuffer, word32 derSz, RsaKey*, ecc_key*, WC_RNG*); +#ifdef WOLFSSL_CERT_REQ WOLFSSL_API int wc_MakeCertReq_ex(Cert*, byte* derBuffer, word32 derSz, int, void*); WOLFSSL_API int wc_MakeCertReq(Cert*, byte* derBuffer, word32 derSz, RsaKey*, ecc_key*); +#endif WOLFSSL_API int wc_SignCert_ex(int requestSz, int sType, byte* buffer, word32 buffSz, int keyType, void* key, WC_RNG* rng); @@ -427,6 +431,8 @@ WOLFSSL_API int wc_SetExtKeyUsageOID(Cert *cert, const char *oid, word32 sz, WC_RNG*); #endif +#endif /* WOLFSSL_CERT_GEN */ + WOLFSSL_API int wc_GetDateInfo(const byte* certDate, int certDateSz, const byte** date, byte* format, int* length); #ifndef NO_ASN_TIME @@ -486,6 +492,7 @@ WOLFSSL_API void wc_FreeDer(DerBuffer** pDer); WOLFSSL_API int wc_RsaPublicKeyDerSize(RsaKey* key, int with_header); #endif +#ifdef HAVE_ECC /* private key helpers */ WOLFSSL_API int wc_EccPrivateKeyDecode(const byte*, word32*, ecc_key*, word32); @@ -501,6 +508,7 @@ WOLFSSL_API void wc_FreeDer(DerBuffer** pDer); WOLFSSL_API int wc_EccPublicKeyToDer(ecc_key*, byte* output, word32 inLen, int with_AlgCurve); WOLFSSL_API int wc_EccPublicKeyDerSize(ecc_key*, int with_AlgCurve); +#endif #ifdef HAVE_ED25519 /* private key helpers */ diff --git a/wolfssl_hlavickove_subory/wolfssl/wolfcrypt/async.h b/wolfssl/wolfssl/wolfcrypt/async.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/wolfcrypt/async.h rename to wolfssl/wolfssl/wolfcrypt/async.h diff --git a/wolfssl_hlavickove_subory/wolfssl/wolfcrypt/blake2-impl.h b/wolfssl/wolfssl/wolfcrypt/blake2-impl.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/wolfcrypt/blake2-impl.h rename to wolfssl/wolfssl/wolfcrypt/blake2-impl.h diff --git a/wolfssl_hlavickove_subory/wolfssl/wolfcrypt/blake2-int.h b/wolfssl/wolfssl/wolfcrypt/blake2-int.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/wolfcrypt/blake2-int.h rename to wolfssl/wolfssl/wolfcrypt/blake2-int.h diff --git a/wolfssl_hlavickove_subory/wolfssl/wolfcrypt/blake2.h b/wolfssl/wolfssl/wolfcrypt/blake2.h similarity index 93% rename from wolfssl_hlavickove_subory/wolfssl/wolfcrypt/blake2.h rename to wolfssl/wolfssl/wolfcrypt/blake2.h index ba85cfd..bf34f31 100644 --- a/wolfssl_hlavickove_subory/wolfssl/wolfcrypt/blake2.h +++ b/wolfssl/wolfssl/wolfcrypt/blake2.h @@ -28,6 +28,8 @@ #include +#if defined(HAVE_BLAKE2) || defined(HAVE_BLAKE2S) + #include /* call old functions if using fips for the sake of hmac @wc_fips */ @@ -44,8 +46,10 @@ /* in bytes, variable digest size up to 512 bits (64 bytes) */ enum { +#ifdef HAVE_BLAKE2B BLAKE2B_ID = WC_HASH_TYPE_BLAKE2B, BLAKE2B_256 = 32, /* 256 bit type, SSL default */ +#endif #ifdef HAVE_BLAKE2S BLAKE2S_ID = WC_HASH_TYPE_BLAKE2S, BLAKE2S_256 = 32 /* 256 bit type */ @@ -53,11 +57,13 @@ enum { }; +#ifdef HAVE_BLAKE2B /* BLAKE2b digest */ typedef struct Blake2b { blake2b_state S[1]; /* our state */ word32 digestSz; /* digest size used on init */ } Blake2b; +#endif #ifdef HAVE_BLAKE2S /* BLAKE2s digest */ @@ -68,9 +74,11 @@ typedef struct Blake2s { #endif +#ifdef HAVE_BLAKE2B WOLFSSL_API int wc_InitBlake2b(Blake2b*, word32); WOLFSSL_API int wc_Blake2bUpdate(Blake2b*, const byte*, word32); WOLFSSL_API int wc_Blake2bFinal(Blake2b*, byte*, word32); +#endif #ifdef HAVE_BLAKE2S WOLFSSL_API int wc_InitBlake2s(Blake2s*, word32); @@ -83,5 +91,6 @@ WOLFSSL_API int wc_Blake2sFinal(Blake2s*, byte*, word32); } #endif +#endif /* HAVE_BLAKE2 || HAVE_BLAKE2S */ #endif /* WOLF_CRYPT_BLAKE2_H */ diff --git a/wolfssl_hlavickove_subory/wolfssl/wolfcrypt/camellia.h b/wolfssl/wolfssl/wolfcrypt/camellia.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/wolfcrypt/camellia.h rename to wolfssl/wolfssl/wolfcrypt/camellia.h diff --git a/wolfssl_hlavickove_subory/wolfssl/wolfcrypt/chacha.h b/wolfssl/wolfssl/wolfcrypt/chacha.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/wolfcrypt/chacha.h rename to wolfssl/wolfssl/wolfcrypt/chacha.h diff --git a/wolfssl_hlavickove_subory/wolfssl/wolfcrypt/chacha20_poly1305.h b/wolfssl/wolfssl/wolfcrypt/chacha20_poly1305.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/wolfcrypt/chacha20_poly1305.h rename to wolfssl/wolfssl/wolfcrypt/chacha20_poly1305.h diff --git a/wolfssl_hlavickove_subory/wolfssl/wolfcrypt/cmac.h b/wolfssl/wolfssl/wolfcrypt/cmac.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/wolfcrypt/cmac.h rename to wolfssl/wolfssl/wolfcrypt/cmac.h diff --git a/wolfssl_hlavickove_subory/wolfssl/wolfcrypt/coding.h b/wolfssl/wolfssl/wolfcrypt/coding.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/wolfcrypt/coding.h rename to wolfssl/wolfssl/wolfcrypt/coding.h diff --git a/wolfssl_hlavickove_subory/wolfssl/wolfcrypt/compress.h b/wolfssl/wolfssl/wolfcrypt/compress.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/wolfcrypt/compress.h rename to wolfssl/wolfssl/wolfcrypt/compress.h diff --git a/wolfssl_hlavickove_subory/wolfssl/wolfcrypt/cpuid.h b/wolfssl/wolfssl/wolfcrypt/cpuid.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/wolfcrypt/cpuid.h rename to wolfssl/wolfssl/wolfcrypt/cpuid.h diff --git a/wolfssl_hlavickove_subory/wolfssl/wolfcrypt/cryptocb.h b/wolfssl/wolfssl/wolfcrypt/cryptocb.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/wolfcrypt/cryptocb.h rename to wolfssl/wolfssl/wolfcrypt/cryptocb.h diff --git a/wolfssl_hlavickove_subory/wolfssl/wolfcrypt/curve25519.h b/wolfssl/wolfssl/wolfcrypt/curve25519.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/wolfcrypt/curve25519.h rename to wolfssl/wolfssl/wolfcrypt/curve25519.h diff --git a/wolfssl_hlavickove_subory/wolfssl/wolfcrypt/des3.h b/wolfssl/wolfssl/wolfcrypt/des3.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/wolfcrypt/des3.h rename to wolfssl/wolfssl/wolfcrypt/des3.h diff --git a/wolfssl_hlavickove_subory/wolfssl/wolfcrypt/dh.h b/wolfssl/wolfssl/wolfcrypt/dh.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/wolfcrypt/dh.h rename to wolfssl/wolfssl/wolfcrypt/dh.h diff --git a/wolfssl_hlavickove_subory/wolfssl/wolfcrypt/dsa.h b/wolfssl/wolfssl/wolfcrypt/dsa.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/wolfcrypt/dsa.h rename to wolfssl/wolfssl/wolfcrypt/dsa.h diff --git a/wolfssl_hlavickove_subory/wolfssl/wolfcrypt/ecc.h b/wolfssl/wolfssl/wolfcrypt/ecc.h similarity index 99% rename from wolfssl_hlavickove_subory/wolfssl/wolfcrypt/ecc.h rename to wolfssl/wolfssl/wolfcrypt/ecc.h index 5d2475d..7503064 100644 --- a/wolfssl_hlavickove_subory/wolfssl/wolfcrypt/ecc.h +++ b/wolfssl/wolfssl/wolfcrypt/ecc.h @@ -29,6 +29,8 @@ #include +#ifdef HAVE_ECC + #if defined(HAVE_FIPS) && \ defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION >= 2) #include @@ -727,4 +729,5 @@ int wc_ecc_gen_k(WC_RNG* rng, int size, mp_int* k, mp_int* order); } /* extern "C" */ #endif -#endif /* HAVE_ECC */ \ No newline at end of file +#endif /* HAVE_ECC */ +#endif /* WOLF_CRYPT_ECC_H */ diff --git a/wolfssl_hlavickove_subory/wolfssl/wolfcrypt/ed25519.h b/wolfssl/wolfssl/wolfcrypt/ed25519.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/wolfcrypt/ed25519.h rename to wolfssl/wolfssl/wolfcrypt/ed25519.h diff --git a/wolfssl_hlavickove_subory/wolfssl/wolfcrypt/error-crypt.h b/wolfssl/wolfssl/wolfcrypt/error-crypt.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/wolfcrypt/error-crypt.h rename to wolfssl/wolfssl/wolfcrypt/error-crypt.h diff --git a/wolfssl_hlavickove_subory/wolfssl/wolfcrypt/fe_operations.h b/wolfssl/wolfssl/wolfcrypt/fe_operations.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/wolfcrypt/fe_operations.h rename to wolfssl/wolfssl/wolfcrypt/fe_operations.h diff --git a/wolfssl_hlavickove_subory/wolfssl/wolfcrypt/fips.h b/wolfssl/wolfssl/wolfcrypt/fips.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/wolfcrypt/fips.h rename to wolfssl/wolfssl/wolfcrypt/fips.h diff --git a/wolfssl_hlavickove_subory/wolfssl/wolfcrypt/fips_test.h b/wolfssl/wolfssl/wolfcrypt/fips_test.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/wolfcrypt/fips_test.h rename to wolfssl/wolfssl/wolfcrypt/fips_test.h diff --git a/wolfssl_hlavickove_subory/wolfssl/wolfcrypt/ge_operations.h b/wolfssl/wolfssl/wolfcrypt/ge_operations.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/wolfcrypt/ge_operations.h rename to wolfssl/wolfssl/wolfcrypt/ge_operations.h diff --git a/wolfssl_hlavickove_subory/wolfssl/wolfcrypt/hash.h b/wolfssl/wolfssl/wolfcrypt/hash.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/wolfcrypt/hash.h rename to wolfssl/wolfssl/wolfcrypt/hash.h diff --git a/wolfssl_hlavickove_subory/wolfssl/wolfcrypt/hc128.h b/wolfssl/wolfssl/wolfcrypt/hc128.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/wolfcrypt/hc128.h rename to wolfssl/wolfssl/wolfcrypt/hc128.h diff --git a/wolfssl_hlavickove_subory/wolfssl/wolfcrypt/hmac.h b/wolfssl/wolfssl/wolfcrypt/hmac.h similarity index 98% rename from wolfssl_hlavickove_subory/wolfssl/wolfcrypt/hmac.h rename to wolfssl/wolfssl/wolfcrypt/hmac.h index 6bbfe57..02a7586 100644 --- a/wolfssl_hlavickove_subory/wolfssl/wolfcrypt/hmac.h +++ b/wolfssl/wolfssl/wolfcrypt/hmac.h @@ -68,7 +68,7 @@ enum { IPAD = 0x36, OPAD = 0x5C, -/* If any hash is not enabled, add the ID here. +/* If any hash is not enabled, add the ID here. */ #ifdef NO_MD5 WC_MD5 = WC_HASH_TYPE_MD5, #endif @@ -93,7 +93,6 @@ enum { WC_SHA3_384 = WC_HASH_TYPE_SHA3_384, WC_SHA3_512 = WC_HASH_TYPE_SHA3_512, #endif - */ #ifdef HAVE_PKCS11 HMAC_MAX_ID_LEN = 32, #endif diff --git a/wolfssl_hlavickove_subory/wolfssl/wolfcrypt/idea.h b/wolfssl/wolfssl/wolfcrypt/idea.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/wolfcrypt/idea.h rename to wolfssl/wolfssl/wolfcrypt/idea.h diff --git a/wolfssl_hlavickove_subory/wolfssl/wolfcrypt/include.am b/wolfssl/wolfssl/wolfcrypt/include.am similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/wolfcrypt/include.am rename to wolfssl/wolfssl/wolfcrypt/include.am diff --git a/wolfssl_hlavickove_subory/wolfssl/wolfcrypt/integer.h b/wolfssl/wolfssl/wolfcrypt/integer.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/wolfcrypt/integer.h rename to wolfssl/wolfssl/wolfcrypt/integer.h diff --git a/wolfssl_hlavickove_subory/wolfssl/wolfcrypt/logging.h b/wolfssl/wolfssl/wolfcrypt/logging.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/wolfcrypt/logging.h rename to wolfssl/wolfssl/wolfcrypt/logging.h diff --git a/wolfssl_hlavickove_subory/wolfssl/wolfcrypt/md2.h b/wolfssl/wolfssl/wolfcrypt/md2.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/wolfcrypt/md2.h rename to wolfssl/wolfssl/wolfcrypt/md2.h diff --git a/wolfssl_hlavickove_subory/wolfssl/wolfcrypt/md4.h b/wolfssl/wolfssl/wolfcrypt/md4.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/wolfcrypt/md4.h rename to wolfssl/wolfssl/wolfcrypt/md4.h diff --git a/wolfssl_hlavickove_subory/wolfssl/wolfcrypt/md5.h b/wolfssl/wolfssl/wolfcrypt/md5.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/wolfcrypt/md5.h rename to wolfssl/wolfssl/wolfcrypt/md5.h diff --git a/wolfssl_hlavickove_subory/wolfssl/wolfcrypt/mem_track.h b/wolfssl/wolfssl/wolfcrypt/mem_track.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/wolfcrypt/mem_track.h rename to wolfssl/wolfssl/wolfcrypt/mem_track.h diff --git a/wolfssl_hlavickove_subory/wolfssl/wolfcrypt/memory.h b/wolfssl/wolfssl/wolfcrypt/memory.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/wolfcrypt/memory.h rename to wolfssl/wolfssl/wolfcrypt/memory.h diff --git a/wolfssl_hlavickove_subory/wolfssl/wolfcrypt/misc.h b/wolfssl/wolfssl/wolfcrypt/misc.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/wolfcrypt/misc.h rename to wolfssl/wolfssl/wolfcrypt/misc.h diff --git a/wolfssl_hlavickove_subory/wolfssl/wolfcrypt/mpi_class.h b/wolfssl/wolfssl/wolfcrypt/mpi_class.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/wolfcrypt/mpi_class.h rename to wolfssl/wolfssl/wolfcrypt/mpi_class.h diff --git a/wolfssl_hlavickove_subory/wolfssl/wolfcrypt/mpi_superclass.h b/wolfssl/wolfssl/wolfcrypt/mpi_superclass.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/wolfcrypt/mpi_superclass.h rename to wolfssl/wolfssl/wolfcrypt/mpi_superclass.h diff --git a/wolfssl_hlavickove_subory/wolfssl/wolfcrypt/pkcs11.h b/wolfssl/wolfssl/wolfcrypt/pkcs11.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/wolfcrypt/pkcs11.h rename to wolfssl/wolfssl/wolfcrypt/pkcs11.h diff --git a/wolfssl_hlavickove_subory/wolfssl/wolfcrypt/pkcs12.h b/wolfssl/wolfssl/wolfcrypt/pkcs12.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/wolfcrypt/pkcs12.h rename to wolfssl/wolfssl/wolfcrypt/pkcs12.h diff --git a/wolfssl_hlavickove_subory/wolfssl/wolfcrypt/pkcs7.h b/wolfssl/wolfssl/wolfcrypt/pkcs7.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/wolfcrypt/pkcs7.h rename to wolfssl/wolfssl/wolfcrypt/pkcs7.h diff --git a/wolfssl_hlavickove_subory/wolfssl/wolfcrypt/poly1305.h b/wolfssl/wolfssl/wolfcrypt/poly1305.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/wolfcrypt/poly1305.h rename to wolfssl/wolfssl/wolfcrypt/poly1305.h diff --git a/wolfssl_hlavickove_subory/wolfssl/wolfcrypt/port/Espressif/esp32-crypt.h b/wolfssl/wolfssl/wolfcrypt/port/Espressif/esp32-crypt.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/wolfcrypt/port/Espressif/esp32-crypt.h rename to wolfssl/wolfssl/wolfcrypt/port/Espressif/esp32-crypt.h diff --git a/wolfssl_hlavickove_subory/wolfssl/wolfcrypt/port/Renesas/renesas-tsip-crypt.h b/wolfssl/wolfssl/wolfcrypt/port/Renesas/renesas-tsip-crypt.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/wolfcrypt/port/Renesas/renesas-tsip-crypt.h rename to wolfssl/wolfssl/wolfcrypt/port/Renesas/renesas-tsip-crypt.h diff --git a/wolfssl_hlavickove_subory/wolfssl/wolfcrypt/port/af_alg/afalg_hash.h b/wolfssl/wolfssl/wolfcrypt/port/af_alg/afalg_hash.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/wolfcrypt/port/af_alg/afalg_hash.h rename to wolfssl/wolfssl/wolfcrypt/port/af_alg/afalg_hash.h diff --git a/wolfssl_hlavickove_subory/wolfssl/wolfcrypt/port/af_alg/wc_afalg.h b/wolfssl/wolfssl/wolfcrypt/port/af_alg/wc_afalg.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/wolfcrypt/port/af_alg/wc_afalg.h rename to wolfssl/wolfssl/wolfcrypt/port/af_alg/wc_afalg.h diff --git a/wolfssl_hlavickove_subory/wolfssl/wolfcrypt/port/arm/cryptoCell.h b/wolfssl/wolfssl/wolfcrypt/port/arm/cryptoCell.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/wolfcrypt/port/arm/cryptoCell.h rename to wolfssl/wolfssl/wolfcrypt/port/arm/cryptoCell.h diff --git a/wolfssl_hlavickove_subory/wolfssl/wolfcrypt/port/atmel/atmel.h b/wolfssl/wolfssl/wolfcrypt/port/atmel/atmel.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/wolfcrypt/port/atmel/atmel.h rename to wolfssl/wolfssl/wolfcrypt/port/atmel/atmel.h diff --git a/wolfssl_hlavickove_subory/wolfssl/wolfcrypt/port/caam/caam_driver.h b/wolfssl/wolfssl/wolfcrypt/port/caam/caam_driver.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/wolfcrypt/port/caam/caam_driver.h rename to wolfssl/wolfssl/wolfcrypt/port/caam/caam_driver.h diff --git a/wolfssl_hlavickove_subory/wolfssl/wolfcrypt/port/caam/wolfcaam.h b/wolfssl/wolfssl/wolfcrypt/port/caam/wolfcaam.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/wolfcrypt/port/caam/wolfcaam.h rename to wolfssl/wolfssl/wolfcrypt/port/caam/wolfcaam.h diff --git a/wolfssl_hlavickove_subory/wolfssl/wolfcrypt/port/caam/wolfcaam_sha.h b/wolfssl/wolfssl/wolfcrypt/port/caam/wolfcaam_sha.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/wolfcrypt/port/caam/wolfcaam_sha.h rename to wolfssl/wolfssl/wolfcrypt/port/caam/wolfcaam_sha.h diff --git a/wolfssl_hlavickove_subory/wolfssl/wolfcrypt/port/cavium/cavium_nitrox.h b/wolfssl/wolfssl/wolfcrypt/port/cavium/cavium_nitrox.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/wolfcrypt/port/cavium/cavium_nitrox.h rename to wolfssl/wolfssl/wolfcrypt/port/cavium/cavium_nitrox.h diff --git a/wolfssl_hlavickove_subory/wolfssl/wolfcrypt/port/cavium/cavium_octeon_sync.h b/wolfssl/wolfssl/wolfcrypt/port/cavium/cavium_octeon_sync.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/wolfcrypt/port/cavium/cavium_octeon_sync.h rename to wolfssl/wolfssl/wolfcrypt/port/cavium/cavium_octeon_sync.h diff --git a/wolfssl_hlavickove_subory/wolfssl/wolfcrypt/port/devcrypto/wc_devcrypto.h b/wolfssl/wolfssl/wolfcrypt/port/devcrypto/wc_devcrypto.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/wolfcrypt/port/devcrypto/wc_devcrypto.h rename to wolfssl/wolfssl/wolfcrypt/port/devcrypto/wc_devcrypto.h diff --git a/wolfssl_hlavickove_subory/wolfssl/wolfcrypt/port/intel/quickassist.h b/wolfssl/wolfssl/wolfcrypt/port/intel/quickassist.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/wolfcrypt/port/intel/quickassist.h rename to wolfssl/wolfssl/wolfcrypt/port/intel/quickassist.h diff --git a/wolfssl_hlavickove_subory/wolfssl/wolfcrypt/port/intel/quickassist_mem.h b/wolfssl/wolfssl/wolfcrypt/port/intel/quickassist_mem.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/wolfcrypt/port/intel/quickassist_mem.h rename to wolfssl/wolfssl/wolfcrypt/port/intel/quickassist_mem.h diff --git a/wolfssl_hlavickove_subory/wolfssl/wolfcrypt/port/intel/quickassist_sync.h b/wolfssl/wolfssl/wolfcrypt/port/intel/quickassist_sync.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/wolfcrypt/port/intel/quickassist_sync.h rename to wolfssl/wolfssl/wolfcrypt/port/intel/quickassist_sync.h diff --git a/wolfssl_hlavickove_subory/wolfssl/wolfcrypt/port/nrf51.h b/wolfssl/wolfssl/wolfcrypt/port/nrf51.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/wolfcrypt/port/nrf51.h rename to wolfssl/wolfssl/wolfcrypt/port/nrf51.h diff --git a/wolfssl_hlavickove_subory/wolfssl/wolfcrypt/port/nxp/ksdk_port.h b/wolfssl/wolfssl/wolfcrypt/port/nxp/ksdk_port.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/wolfcrypt/port/nxp/ksdk_port.h rename to wolfssl/wolfssl/wolfcrypt/port/nxp/ksdk_port.h diff --git a/wolfssl_hlavickove_subory/wolfssl/wolfcrypt/port/pic32/pic32mz-crypt.h b/wolfssl/wolfssl/wolfcrypt/port/pic32/pic32mz-crypt.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/wolfcrypt/port/pic32/pic32mz-crypt.h rename to wolfssl/wolfssl/wolfcrypt/port/pic32/pic32mz-crypt.h diff --git a/wolfssl_hlavickove_subory/wolfssl/wolfcrypt/port/st/stm32.h b/wolfssl/wolfssl/wolfcrypt/port/st/stm32.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/wolfcrypt/port/st/stm32.h rename to wolfssl/wolfssl/wolfcrypt/port/st/stm32.h diff --git a/wolfssl_hlavickove_subory/wolfssl/wolfcrypt/port/st/stsafe.h b/wolfssl/wolfssl/wolfcrypt/port/st/stsafe.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/wolfcrypt/port/st/stsafe.h rename to wolfssl/wolfssl/wolfcrypt/port/st/stsafe.h diff --git a/wolfssl_hlavickove_subory/wolfssl/wolfcrypt/port/ti/ti-ccm.h b/wolfssl/wolfssl/wolfcrypt/port/ti/ti-ccm.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/wolfcrypt/port/ti/ti-ccm.h rename to wolfssl/wolfssl/wolfcrypt/port/ti/ti-ccm.h diff --git a/wolfssl_hlavickove_subory/wolfssl/wolfcrypt/port/ti/ti-hash.h b/wolfssl/wolfssl/wolfcrypt/port/ti/ti-hash.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/wolfcrypt/port/ti/ti-hash.h rename to wolfssl/wolfssl/wolfcrypt/port/ti/ti-hash.h diff --git a/wolfssl_hlavickove_subory/wolfssl/wolfcrypt/port/xilinx/xil-sha3.h b/wolfssl/wolfssl/wolfcrypt/port/xilinx/xil-sha3.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/wolfcrypt/port/xilinx/xil-sha3.h rename to wolfssl/wolfssl/wolfcrypt/port/xilinx/xil-sha3.h diff --git a/wolfssl_hlavickove_subory/wolfssl/wolfcrypt/pwdbased.h b/wolfssl/wolfssl/wolfcrypt/pwdbased.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/wolfcrypt/pwdbased.h rename to wolfssl/wolfssl/wolfcrypt/pwdbased.h diff --git a/wolfssl_hlavickove_subory/wolfssl/wolfcrypt/rabbit.h b/wolfssl/wolfssl/wolfcrypt/rabbit.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/wolfcrypt/rabbit.h rename to wolfssl/wolfssl/wolfcrypt/rabbit.h diff --git a/wolfssl_hlavickove_subory/wolfssl/wolfcrypt/random.h b/wolfssl/wolfssl/wolfcrypt/random.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/wolfcrypt/random.h rename to wolfssl/wolfssl/wolfcrypt/random.h diff --git a/wolfssl_hlavickove_subory/wolfssl/wolfcrypt/ripemd.h b/wolfssl/wolfssl/wolfcrypt/ripemd.h similarity index 97% rename from wolfssl_hlavickove_subory/wolfssl/wolfcrypt/ripemd.h rename to wolfssl/wolfssl/wolfcrypt/ripemd.h index 6f63296..cc9f130 100644 --- a/wolfssl_hlavickove_subory/wolfssl/wolfcrypt/ripemd.h +++ b/wolfssl/wolfssl/wolfcrypt/ripemd.h @@ -28,6 +28,8 @@ #include +#ifdef WOLFSSL_RIPEMD + #ifdef __cplusplus extern "C" { #endif @@ -61,4 +63,5 @@ WOLFSSL_API int wc_RipeMdFinal(RipeMd*, byte*); } /* extern "C" */ #endif +#endif /* WOLFSSL_RIPEMD */ #endif /* WOLF_CRYPT_RIPEMD_H */ diff --git a/wolfssl_hlavickove_subory/wolfssl/wolfcrypt/rsa.h b/wolfssl/wolfssl/wolfcrypt/rsa.h similarity index 98% rename from wolfssl_hlavickove_subory/wolfssl/wolfcrypt/rsa.h rename to wolfssl/wolfssl/wolfcrypt/rsa.h index e1056e3..d1c60ea 100644 --- a/wolfssl_hlavickove_subory/wolfssl/wolfcrypt/rsa.h +++ b/wolfssl/wolfssl/wolfcrypt/rsa.h @@ -99,7 +99,9 @@ enum { #ifdef WOLFSSL_ASYNC_CRYPT #include + #ifdef WOLFSSL_CERT_GEN #include + #endif #endif enum { @@ -167,7 +169,9 @@ struct RsaKey { #endif #ifdef WOLFSSL_ASYNC_CRYPT WC_ASYNC_DEV asyncDev; + #ifdef WOLFSSL_CERT_GEN CertSignCtx certSignCtx; /* context info for cert sign (MakeSignature) */ + #endif #endif /* WOLFSSL_ASYNC_CRYPT */ #ifdef WOLFSSL_XILINX_CRYPT word32 pubExp; /* to keep values in scope they are here in struct */ @@ -274,7 +278,9 @@ WOLFSSL_API int wc_RsaPublicKeyDecode(const byte* input, word32* inOutIdx, RsaKey*, word32); WOLFSSL_API int wc_RsaPublicKeyDecodeRaw(const byte* n, word32 nSz, const byte* e, word32 eSz, RsaKey* key); +#ifdef WOLFSSL_KEY_GEN WOLFSSL_API int wc_RsaKeyToDer(RsaKey*, byte* output, word32 inLen); +#endif #ifdef WC_RSA_BLINDING WOLFSSL_API int wc_RsaSetRNG(RsaKey* key, WC_RNG* rng); @@ -332,6 +338,7 @@ WOLFSSL_API int wc_RsaExportKey(RsaKey* key, WOLFSSL_API int wc_RsaKeyToPublicDer(RsaKey*, byte* output, word32 inLen); +#ifdef WOLFSSL_KEY_GEN WOLFSSL_API int wc_MakeRsaKey(RsaKey* key, int size, long e, WC_RNG* rng); WOLFSSL_API int wc_CheckProbablePrime_ex(const byte* p, word32 pSz, const byte* q, word32 qSz, @@ -341,6 +348,7 @@ WOLFSSL_API int wc_RsaKeyToPublicDer(RsaKey*, byte* output, word32 inLen); const byte* q, word32 qSz, const byte* e, word32 eSz, int nlen, int* isPrime); +#endif #endif /* HAVE_USER_RSA */ diff --git a/wolfssl_hlavickove_subory/wolfssl/wolfcrypt/selftest.h b/wolfssl/wolfssl/wolfcrypt/selftest.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/wolfcrypt/selftest.h rename to wolfssl/wolfssl/wolfcrypt/selftest.h diff --git a/wolfssl_hlavickove_subory/wolfssl/wolfcrypt/settings.h b/wolfssl/wolfssl/wolfcrypt/settings.h similarity index 99% rename from wolfssl_hlavickove_subory/wolfssl/wolfcrypt/settings.h rename to wolfssl/wolfssl/wolfcrypt/settings.h index 009923b..876f56a 100644 --- a/wolfssl_hlavickove_subory/wolfssl/wolfcrypt/settings.h +++ b/wolfssl/wolfssl/wolfcrypt/settings.h @@ -203,10 +203,7 @@ /* #define WOLFSSL_RENESAS_RX65N */ #include - -#ifdef WOLFSSL_USER_SETTINGS - #include "user_settings.h" -#endif +#include /* make sure old RNG name is used with CTaoCrypt FIPS */ @@ -1380,9 +1377,6 @@ extern void uITRON4_free(void *p) ; #endif #endif - #define OPENSSL_EXTRA - - #ifdef WOLFSSL_QL #ifndef WOLFSSL_SEP #define WOLFSSL_SEP @@ -1988,7 +1982,7 @@ extern void uITRON4_free(void *p) ; #endif /* warning for not using harden build options (default with ./configure) */ -#if 0 +#ifndef WC_NO_HARDEN #if (defined(USE_FAST_MATH) && !defined(TFM_TIMING_RESISTANT)) || \ (defined(HAVE_ECC) && !defined(ECC_TIMING_RESISTANT)) || \ (!defined(NO_RSA) && !defined(WC_RSA_BLINDING) && !defined(HAVE_FIPS) && \ diff --git a/wolfssl_hlavickove_subory/wolfssl/wolfcrypt/sha.h b/wolfssl/wolfssl/wolfcrypt/sha.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/wolfcrypt/sha.h rename to wolfssl/wolfssl/wolfcrypt/sha.h diff --git a/wolfssl_hlavickove_subory/wolfssl/wolfcrypt/sha256.h b/wolfssl/wolfssl/wolfcrypt/sha256.h similarity index 99% rename from wolfssl_hlavickove_subory/wolfssl/wolfcrypt/sha256.h rename to wolfssl/wolfssl/wolfcrypt/sha256.h index 9d20389..1d84a84 100644 --- a/wolfssl_hlavickove_subory/wolfssl/wolfcrypt/sha256.h +++ b/wolfssl/wolfssl/wolfcrypt/sha256.h @@ -202,6 +202,7 @@ WOLFSSL_API void wc_Sha256SizeSet(wc_Sha256*, word32); WOLFSSL_API int wc_Sha256GetFlags(wc_Sha256* sha256, word32* flags); #endif +#ifdef WOLFSSL_SHA224 /* avoid redefinition of structs */ #if !defined(HAVE_FIPS) || \ (defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION >= 2)) @@ -243,6 +244,8 @@ WOLFSSL_API int wc_Sha224Copy(wc_Sha224* src, wc_Sha224* dst); WOLFSSL_API int wc_Sha224GetFlags(wc_Sha224* sha224, word32* flags); #endif +#endif /* WOLFSSL_SHA224 */ + #ifdef __cplusplus } /* extern "C" */ #endif diff --git a/wolfssl_hlavickove_subory/wolfssl/wolfcrypt/sha3.h b/wolfssl/wolfssl/wolfcrypt/sha3.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/wolfcrypt/sha3.h rename to wolfssl/wolfssl/wolfcrypt/sha3.h diff --git a/wolfssl_hlavickove_subory/wolfssl/wolfcrypt/sha512.h b/wolfssl/wolfssl/wolfcrypt/sha512.h similarity index 96% rename from wolfssl_hlavickove_subory/wolfssl/wolfcrypt/sha512.h rename to wolfssl/wolfssl/wolfcrypt/sha512.h index 83adb41..e80b567 100644 --- a/wolfssl_hlavickove_subory/wolfssl/wolfcrypt/sha512.h +++ b/wolfssl/wolfssl/wolfcrypt/sha512.h @@ -29,6 +29,8 @@ #include +#if defined(WOLFSSL_SHA512) || defined(WOLFSSL_SHA384) + #if defined(HAVE_FIPS) && \ defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION >= 2) #include @@ -149,6 +151,7 @@ WOLFSSL_LOCAL void Transform_Sha512_Len(wc_Sha512* sha512, const byte* data, word32 len); #endif +#ifdef WOLFSSL_SHA512 WOLFSSL_API int wc_InitSha512(wc_Sha512*); WOLFSSL_API int wc_InitSha512_ex(wc_Sha512*, void*, int); @@ -165,6 +168,9 @@ WOLFSSL_API int wc_Sha512Copy(wc_Sha512* src, wc_Sha512* dst); WOLFSSL_API int wc_Sha512GetFlags(wc_Sha512* sha512, word32* flags); #endif +#endif /* WOLFSSL_SHA512 */ + +#if defined(WOLFSSL_SHA384) /* avoid redefinition of structs */ #if !defined(HAVE_FIPS) || \ @@ -211,9 +217,12 @@ WOLFSSL_API int wc_Sha384Copy(wc_Sha384* src, wc_Sha384* dst); WOLFSSL_API int wc_Sha384GetFlags(wc_Sha384* sha384, word32* flags); #endif +#endif /* WOLFSSL_SHA384 */ + #ifdef __cplusplus } /* extern "C" */ #endif +#endif /* WOLFSSL_SHA512 || WOLFSSL_SHA384 */ #endif /* WOLF_CRYPT_SHA512_H */ diff --git a/wolfssl_hlavickove_subory/wolfssl/wolfcrypt/signature.h b/wolfssl/wolfssl/wolfcrypt/signature.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/wolfcrypt/signature.h rename to wolfssl/wolfssl/wolfcrypt/signature.h diff --git a/wolfssl_hlavickove_subory/wolfssl/wolfcrypt/sp.h b/wolfssl/wolfssl/wolfcrypt/sp.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/wolfcrypt/sp.h rename to wolfssl/wolfssl/wolfcrypt/sp.h diff --git a/wolfssl_hlavickove_subory/wolfssl/wolfcrypt/sp_int.h b/wolfssl/wolfssl/wolfcrypt/sp_int.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/wolfcrypt/sp_int.h rename to wolfssl/wolfssl/wolfcrypt/sp_int.h diff --git a/wolfssl_hlavickove_subory/wolfssl/wolfcrypt/srp.h b/wolfssl/wolfssl/wolfcrypt/srp.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/wolfcrypt/srp.h rename to wolfssl/wolfssl/wolfcrypt/srp.h diff --git a/wolfssl_hlavickove_subory/wolfssl/wolfcrypt/tfm.h b/wolfssl/wolfssl/wolfcrypt/tfm.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/wolfcrypt/tfm.h rename to wolfssl/wolfssl/wolfcrypt/tfm.h diff --git a/wolfssl_hlavickove_subory/wolfssl/wolfcrypt/types.h b/wolfssl/wolfssl/wolfcrypt/types.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/wolfcrypt/types.h rename to wolfssl/wolfssl/wolfcrypt/types.h diff --git a/wolfssl_hlavickove_subory/wolfssl/wolfcrypt/visibility.h b/wolfssl/wolfssl/wolfcrypt/visibility.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/wolfcrypt/visibility.h rename to wolfssl/wolfssl/wolfcrypt/visibility.h diff --git a/wolfssl_hlavickove_subory/wolfssl/wolfcrypt/wc_encrypt.h b/wolfssl/wolfssl/wolfcrypt/wc_encrypt.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/wolfcrypt/wc_encrypt.h rename to wolfssl/wolfssl/wolfcrypt/wc_encrypt.h diff --git a/wolfssl_hlavickove_subory/wolfssl/wolfcrypt/wc_pkcs11.h b/wolfssl/wolfssl/wolfcrypt/wc_pkcs11.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/wolfcrypt/wc_pkcs11.h rename to wolfssl/wolfssl/wolfcrypt/wc_pkcs11.h diff --git a/wolfssl_hlavickove_subory/wolfssl/wolfcrypt/wc_port.h b/wolfssl/wolfssl/wolfcrypt/wc_port.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/wolfcrypt/wc_port.h rename to wolfssl/wolfssl/wolfcrypt/wc_port.h diff --git a/wolfssl_hlavickove_subory/wolfssl/wolfcrypt/wolfevent.h b/wolfssl/wolfssl/wolfcrypt/wolfevent.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/wolfcrypt/wolfevent.h rename to wolfssl/wolfssl/wolfcrypt/wolfevent.h diff --git a/wolfssl_hlavickove_subory/wolfssl/wolfcrypt/wolfmath.h b/wolfssl/wolfssl/wolfcrypt/wolfmath.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/wolfcrypt/wolfmath.h rename to wolfssl/wolfssl/wolfcrypt/wolfmath.h diff --git a/wolfssl_hlavickove_subory/wolfssl/wolfio.h b/wolfssl/wolfssl/wolfio.h similarity index 100% rename from wolfssl_hlavickove_subory/wolfssl/wolfio.h rename to wolfssl/wolfssl/wolfio.h diff --git a/wolfssl_hlavickove_subory/wolfssl/wolfcrypt/user_settings.h b/wolfssl_hlavickove_subory/wolfssl/wolfcrypt/user_settings.h deleted file mode 100644 index ca59ff6..0000000 --- a/wolfssl_hlavickove_subory/wolfssl/wolfcrypt/user_settings.h +++ /dev/null @@ -1,90 +0,0 @@ -#ifndef _WIN_USER_SETTINGS_H_ -#define _WIN_USER_SETTINGS_H_ - -/* Verify this is Windows */ -#ifndef _WIN32 -#error This user_settings.h header is only designed for Windows -#endif - -/* Configurations */ -#if defined(HAVE_FIPS) - /* FIPS */ - #define OPENSSL_EXTRA - #define HAVE_THREAD_LS - #define WOLFSSL_KEY_GEN - #define HAVE_AESGCM - #define HAVE_HASHDRBG - #define WOLFSSL_SHA384 - #define WOLFSSL_SHA512 - #define NO_PSK - #define NO_HC128 - #define NO_RC4 - #define NO_RABBIT - #define NO_DSA - #define NO_MD4 - #define WOLFSSL_CERT_GEN - #define WOLFSSL_KEY_GEN - - #if defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION >= 2) - #define WOLFSSL_SHA224 - #define WOLFSSL_SHA3 - #define WC_RSA_PSS - #define WC_RSA_NO_PADDING - #define HAVE_ECC - #define ECC_SHAMIR - #define HAVE_ECC_CDH - #define ECC_TIMING_RESISTANT - #define TFM_TIMING_RESISTANT - #define WOLFSSL_AES_COUNTER - #define WOLFSSL_AES_DIRECT - #define HAVE_AES_ECB - #define HAVE_AESCCM - #define WOLFSSL_CMAC - #define HAVE_HKDF - #define WOLFSSL_VALIDATE_ECC_IMPORT - #define WOLFSSL_VALIDATE_FFC_IMPORT - #define HAVE_FFDHE_Q - #define WOLFSSL_AESNI - #define HAVE_INTEL_RDSEED - #define FORCE_FAILURE_RDSEED - #define WOLFSSL_CERT_GEN - #define WOLFSSL_KEY_GEN - #endif /* FIPS v2 */ -#else - /* Enables blinding mode, to prevent timing attacks */ - #define WC_RSA_BLINDING - - #if defined(WOLFSSL_LIB) - /* The lib */ - #define OPENSSL_EXTRA - #define WOLFSSL_RIPEMD - #define WOLFSSL_SHA512 - #define NO_PSK - #define HAVE_EXTENDED_MASTER - #define WOLFSSL_SNIFFER - #define HAVE_TLS_EXTENSIONS - #define HAVE_SECURE_RENEGOTIATION - #define WOLFSSL_CERT_GEN - #define WOLFSSL_KEY_GEN - - #define HAVE_AESGCM - #define WOLFSSL_SHA384 - #define WOLFSSL_SHA512 - - #define HAVE_SUPPORTED_CURVES - #define HAVE_TLS_EXTENSIONS - - #define HAVE_ECC - #define ECC_SHAMIR - #define ECC_TIMING_RESISTANT - #else - /* The servers and clients */ - #define OPENSSL_EXTRA - #define NO_PSK - #define WOLFSSL_CERT_GEN - #define WOLFSSL_KEY_GEN - #endif -#endif /* HAVE_FIPS */ - -#endif /* _WIN_USER_SETTINGS_H_ */ -