Closed jmhodges closed 1 month ago
Previous to this patch, a busted Path configuration passed to crypto11 would cause nil pointer panics.
This is because attempt to check the nil pointer of the PKCS11Context interface would run into the usual "nil interface" problems where the pointer would not be technically "nil" but calling methods on it would cause nil pointer panics. See https://go.dev/tour/methods/12 and https://trstringer.com/go-nil-interface-and-interface-with-nil-concrete-value/ for details.
So, to handle this correctly, we need to return an error along with our interface context type.
It's pretty surprising that pkcs11.New can return nil, but we do what we must.
pkcs11.New
Updates AUT-283
Previous to this patch, a busted Path configuration passed to crypto11 would cause nil pointer panics.
This is because attempt to check the nil pointer of the PKCS11Context interface would run into the usual "nil interface" problems where the pointer would not be technically "nil" but calling methods on it would cause nil pointer panics. See https://go.dev/tour/methods/12 and https://trstringer.com/go-nil-interface-and-interface-with-nil-concrete-value/ for details.
So, to handle this correctly, we need to return an error along with our interface context type.
It's pretty surprising that
pkcs11.New
can return nil, but we do what we must.Updates AUT-283