void pkcs11_mechanism_list(FILE * outfile, const char *url, unsigned int flags, common_info_st * info) { int ret; int idx; unsigned long mechanism; const char *str; pkcs11_common(info); FIX(url, outfile, 0, info); idx = 0; do { ret = gnutls_pkcs11_token_get_mechanism(url, idx++, &mechanism); if (ret >= 0) { str = NULL; if (mechanism <= sizeof(mech_list) / sizeof(mech_list[0])) str = mech_list[mechanism]; if (str == NULL) str = "UNKNOWN"; fprintf(outfile, "[0x%.4lx] %s\n", mechanism, str); } } while (ret >= 0); return; }
static unsigned verify_eddsa_presence(void) { unsigned i; unsigned long mechanism; int ret; i = 0; do { ret = gnutls_pkcs11_token_get_mechanism("pkcs11:", i++, &mechanism); if (ret >= 0 && mechanism == 0x1057 /* CKM_EDDSA */) return 1; } while(ret>=0); return 0; }