gpgscm: Make function more general.