Error in libcrypto when compiled with O2/O3

Hi, when I compile the firmware with O2 or O3 optimization, I start getting those errors below when trying to ssh into the router. It can happen several times in a row, but then it will connect. I see nothing weird in the logs and everything else seems to be functioning just fine.
Any ideas on what can be going on here?

ssh root@192.168.1.1
ssh_dispatch_run_fatal: Connection to 192.168.1.1 port 22: error in libcrypto
ssh root@192.168.1.1
ssh_dispatch_run_fatal: Connection to 192.168.1.1 port 22: error in libcrypto
ssh root@192.168.1.1
ssh_dispatch_run_fatal: Connection to 192.168.1.1 port 22: error in libcrypto

If you're on a `nix box trying to ssh in, try adding -v or -vv to see where things might be falling apart.

I'm guessing something on the far end isn't handling the key-exchange or encryption initiation right. Might end up having to compile libcrypto without the optimizations

Done that already, but the issue is not present in that case. Might be some timing issue. I will keep trying.

There were a couple things that came up on the Internet searching on the error string. Curious as to what comes up at the end as I've been thinking of switching from -Os myself

Do not let this stop you: it is just an annoyance. Everything else seems to be working for me on an R7800.

Hmm, the issue is now gone. Either the OS update or the latest build from master. Something has fixed it.

It showed up again and this time it took way more attempts to get back into the router. There is little info about it I could find on the Internet. ssh -vv printed this right before the failure and I am not sure if this is a client or server side issue.

ssh_dispatch_run_fatal: Connection to 192.168.1.1 port 22: error in libcrypto

Try https://www.google.com/search?q=ssh_dispatch_run_fatal%3A+error+in+libcrypto&oq=ssh_dispatch_run_fatal%3A+error+in+libcrypto

Not clear what your client is, but there seem to be problems with the Windows implementation, such as

https://github.com/PowerShell/Win32-OpenSSH/issues/522

It is MacOS and according to the link you provided (thx) this is a client issue after all. Weird that it never happens with Os optimization.