For your authentication failure error, please show where/how it gets triggered (and what is the expected result). For a more generic comment, have a look at https://github.com/OpenSC/OpenSC/commit/8fc679bf#commitcomment-2732558