channels/smartcard: more code hardening