Thanks for your reply.
I have tried running the command below:
$ ./config --prefix=/usr --openssldir=/etc/ssl --libdir=lib shared zlib-dynamic && sudo make install
after running
$ ./config zlib
$ make
$ sudo make install
but I still get the same error. I also tried reversing the commands as suggested by another user above and I got an error saying bad decrypt and also the data error as before. Any ideas on what should I check next?
EDIT: I got it working on Windows by running the AES decryption first and output the file, and then using zlib to decompress the output file again. Thanks for helping out anyway.
EDIT 2: Strange enough, I wasn't able to get the file to be verified from TP-Link's web GUI even though I ran the same commands as you to encrypt the file back.
openssl zlib -in config.tar | openssl aes-256-cbc -out config.bin -k ‘Archer C1200’
EDIT 3: I got the bad encrypt error again on Ubuntu or Debian but not on Windows. Perhaps this is related to the issue that I'm unable to encrypt the file back?