]> foleosoft.com Git - CryptoFoleo.git/commitdiff
Sun Aug 20 07:17:31 PM EDT 2023
authormiha-q <>
Sun, 20 Aug 2023 23:17:31 +0000 (19:17 -0400)
committermiha-q <>
Sun, 20 Aug 2023 23:17:31 +0000 (19:17 -0400)
bin/CryptoFoleo.hs
bin/libCryptoFoleo.so
src/rsa.c
test.bin [new file with mode: 0644]

index 9a3ba7a8dbca57d32334b26801c7ab2b402fcae6..8adc21ee383681d65767b1b7b78f5bc3603b65aa 100644 (file)
@@ -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)
index b885eda57b779e8852bbdff89734bff3f844473e..658bc466b9c3facc1252eeb87dad68519608c77b 100755 (executable)
Binary files a/bin/libCryptoFoleo.so and b/bin/libCryptoFoleo.so differ
index b0354d3ecda36b995291128f3b24a5ea6f6bd3c3..e8e31541683a5bad2d379439fc8936777a78a634 100644 (file)
--- 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 (file)
index 0000000..c5a9fe5
Binary files /dev/null and b/test.bin differ