If the keyboard works fine in the BIOS settings screen then the problem is a Windows driver so . . .
go to Device Manager and uninstall the keyboard and reboot.
Now something you said is not clear.
“Both works if I go into the BIOS, but despite diagnostic tests, it still does not work.”
You are saying it works and it does not work. Diagnostic tests don’t fix anything they just alert you to problems.
So did the keyboard pass the diagnostic test? If yes then it is a driver issue.