From: miha-q <> Date: Sun, 20 Aug 2023 23:17:31 +0000 (-0400) Subject: Sun Aug 20 07:17:31 PM EDT 2023 X-Git-Url: http://www.foleosoft.com/?a=commitdiff_plain;h=e35766b0b167d648ab32c9f52967f4e010372e42;p=CryptoFoleo.git Sun Aug 20 07:17:31 PM EDT 2023 --- diff --git a/bin/CryptoFoleo.hs b/bin/CryptoFoleo.hs index 9a3ba7a..8adc21e 100644 --- a/bin/CryptoFoleo.hs +++ b/bin/CryptoFoleo.hs @@ -186,13 +186,13 @@ dhke v = do bsPtr <- BI.create modSize (\ptr -> MU.copyBytes ptr (castPtr secretPtr) modSize) c_free secretPtr return bsPtr - else if Prelude.length v == 1 then do + else if Prelude.length v == 1 && (BS.length (v !! 0)) == modSize then do useAsCString (v !! 0) $ \secretPtr -> do sharePtr <- c_dhke (castPtr secretPtr) nullPtr bsPtr <- BI.create modSize (\ptr -> MU.copyBytes ptr (castPtr sharePtr) modSize) c_free sharePtr return bsPtr - else if Prelude.length v == 2 then do + else if Prelude.length v == 2 && (BS.length (v !! 0)) == modSize && (BS.length (v !! 1)) == modSize then do useAsCString (v !! 0) $ \secretPtr -> do useAsCString (v !! 1) $ \sharePtr -> do keyPtr <- c_dhke (castPtr secretPtr) (castPtr sharePtr) diff --git a/bin/libCryptoFoleo.so b/bin/libCryptoFoleo.so index b885eda..658bc46 100755 Binary files a/bin/libCryptoFoleo.so and b/bin/libCryptoFoleo.so differ diff --git a/src/rsa.c b/src/rsa.c index b0354d3..e8e3154 100644 --- a/src/rsa.c +++ b/src/rsa.c @@ -720,4 +720,4 @@ uint16_t foleo_rsa_modsize(rsakey_t* key) { return (key->bitWidth / 8) + (key->b void rand_mode(uint8_t, uint8_t*); -#endif +#endif \ No newline at end of file diff --git a/test.bin b/test.bin new file mode 100644 index 0000000..c5a9fe5 Binary files /dev/null and b/test.bin differ