You can install libffi7.so on raspberry OS from source. libffi7 source is Release libffi v3.3 · libffi/libffi · GitHub
wget "https://github.com/libffi/libffi/releases/download/v3.3/libffi-3.3.tar.gz"
tar zxf libffi-3.3.tar.gz
cd libffi-3.3
./configure
sudo make install
sudo ldconfig
After this the homeassistant can be run under python 3.9.x.