Have the same problem on a Win 10 PC. When it asks for the password and entering it shows the error code 4000, unable to update iPhone. It wouldn't update normally in iTunes without the error.I found a similar issue but this was also there from 15.4 as well.
If I tried to update using itunes, it won't work, it will ask for my unlock code, then give error 4000. Last night I tried doing an update in recovery mode, at which point, it seemed to work but then when the phone rebooted, it got stuck at the apple logo. Not sure what happened but glad I have icloud backups, haha.
Downloaded the .ipsw 3 times, uninstalled iTunes, installed iTunes, no help. Had to update OTA.
This has occurred on the last two updates.