summaryrefslogtreecommitdiff
path: root/src/gen-mech-list.sh
blob: 1b4edf1f697e002f68f56e99bbf762a3f1797f98 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/bin/sh

HEADER=$(pkg-config --cflags-only-I p11-kit-1|awk '{print $1}'|sed 's/-I//g')
HEADER="${HEADER}/p11-kit/pkcs11.h"

echo "const char *mech_list[] = {"

# Exclude duplicate and uninteresting entries
EXCLUDED="(CKM_VENDOR_DEFINED\s|CKM_CAST128_MAC\s|CKM_CAST128_KEY_GEN\s|CKM_CAST128_ECB\s|CKM_CAST128_CBC\s|CKM_CAST128_MAC_GENERAL\s|CKM_CAST128_CBC_PAD\s|CKM_PBE_MD5_CAST128_CBC\s|CKM_PBE_SHA1_CAST128_CBC\s|CKM_EC_KEY_PAIR_GEN\s)"

cat ${HEADER}|grep -E "define\sCKM_"|grep -vE "${EXCLUDED}"|awk '{print "\t["$3"] = \""$2"\","}'


echo "};"