From daf63f2cf66669b3555f2f15498a0aa2db234b2f Mon Sep 17 00:00:00 2001 From: Stef Walter Date: Tue, 21 May 2013 21:44:22 +0200 Subject: constants: Tweaks and add mechanisms --- common/constants.c | 428 +++++++++++++++++++++--------------------- common/tests/test-constants.c | 70 +++---- 2 files changed, 245 insertions(+), 253 deletions(-) (limited to 'common') diff --git a/common/constants.c b/common/constants.c index ef92810..3ff93bd 100644 --- a/common/constants.c +++ b/common/constants.c @@ -104,7 +104,7 @@ const p11_constant p11_constant_types[] = { /* CT (CKA_SUBPRIME_BITS) */ CT (CKA_SUB_PRIME_BITS, "subprime-bits") CT (CKA_VALUE_BITS, "value-bits") - CT (CKA_VALUE_LEN, "vaule-len") + CT (CKA_VALUE_LEN, "value-len") CT (CKA_EXTRACTABLE, "extractable") CT (CKA_LOCAL, "local") CT (CKA_NEVER_EXTRACTABLE, "never-extractable") @@ -366,229 +366,229 @@ const p11_constant p11_constant_returns[] = { }; const p11_constant p11_constant_mechanisms[] = { - CT (CKM_RSA_PKCS_KEY_PAIR_GEN, NULL) - CT (CKM_RSA_PKCS, NULL) - CT (CKM_RSA_9796, NULL) - CT (CKM_RSA_X_509, NULL) - CT (CKM_MD2_RSA_PKCS, NULL) - CT (CKM_MD5_RSA_PKCS, NULL) - CT (CKM_SHA1_RSA_PKCS, NULL) - CT (CKM_RIPEMD128_RSA_PKCS, NULL) - CT (CKM_RIPEMD160_RSA_PKCS, NULL) - CT (CKM_RSA_PKCS_OAEP, NULL) - CT (CKM_RSA_X9_31_KEY_PAIR_GEN, NULL) - CT (CKM_RSA_X9_31, NULL) - CT (CKM_SHA1_RSA_X9_31, NULL) - CT (CKM_RSA_PKCS_PSS, NULL) - CT (CKM_SHA1_RSA_PKCS_PSS, NULL) - CT (CKM_DSA_KEY_PAIR_GEN, NULL) - CT (CKM_DSA, NULL) - CT (CKM_DSA_SHA1, NULL) - CT (CKM_DH_PKCS_KEY_PAIR_GEN, NULL) - CT (CKM_DH_PKCS_DERIVE, NULL) - CT (CKM_X9_42_DH_KEY_PAIR_GEN, NULL) - CT (CKM_X9_42_DH_DERIVE, NULL) - CT (CKM_X9_42_DH_HYBRID_DERIVE, NULL) - CT (CKM_X9_42_MQV_DERIVE, NULL) - CT (CKM_SHA256_RSA_PKCS, NULL) - CT (CKM_SHA384_RSA_PKCS, NULL) - CT (CKM_SHA512_RSA_PKCS, NULL) - CT (CKM_SHA256_RSA_PKCS_PSS, NULL) - CT (CKM_SHA384_RSA_PKCS_PSS, NULL) - CT (CKM_SHA512_RSA_PKCS_PSS, NULL) - CT (CKM_RC2_KEY_GEN, NULL) - CT (CKM_RC2_ECB, NULL) - CT (CKM_RC2_CBC, NULL) - CT (CKM_RC2_MAC, NULL) - CT (CKM_RC2_MAC_GENERAL, NULL) - CT (CKM_RC2_CBC_PAD, NULL) - CT (CKM_RC4_KEY_GEN, NULL) - CT (CKM_RC4, NULL) - CT (CKM_DES_KEY_GEN, NULL) - CT (CKM_DES_ECB, NULL) - CT (CKM_DES_CBC, NULL) - CT (CKM_DES_MAC, NULL) - CT (CKM_DES_MAC_GENERAL, NULL) - CT (CKM_DES_CBC_PAD, NULL) - CT (CKM_DES2_KEY_GEN, NULL) - CT (CKM_DES3_KEY_GEN, NULL) - CT (CKM_DES3_ECB, NULL) - CT (CKM_DES3_CBC, NULL) - CT (CKM_DES3_MAC, NULL) - CT (CKM_DES3_MAC_GENERAL, NULL) - CT (CKM_DES3_CBC_PAD, NULL) - CT (CKM_CDMF_KEY_GEN, NULL) - CT (CKM_CDMF_ECB, NULL) - CT (CKM_CDMF_CBC, NULL) - CT (CKM_CDMF_MAC, NULL) - CT (CKM_CDMF_MAC_GENERAL, NULL) - CT (CKM_CDMF_CBC_PAD, NULL) - CT (CKM_DES_OFB64, NULL) - CT (CKM_DES_OFB8, NULL) - CT (CKM_DES_CFB64, NULL) - CT (CKM_DES_CFB8, NULL) - CT (CKM_MD2, NULL) - CT (CKM_MD2_HMAC, NULL) - CT (CKM_MD2_HMAC_GENERAL, NULL) - CT (CKM_MD5, NULL) - CT (CKM_MD5_HMAC, NULL) - CT (CKM_MD5_HMAC_GENERAL, NULL) - CT (CKM_SHA_1, NULL) - CT (CKM_SHA_1_HMAC, NULL) - CT (CKM_SHA_1_HMAC_GENERAL, NULL) - CT (CKM_RIPEMD128, NULL) - CT (CKM_RIPEMD128_HMAC, NULL) - CT (CKM_RIPEMD128_HMAC_GENERAL, NULL) - CT (CKM_RIPEMD160, NULL) - CT (CKM_RIPEMD160_HMAC, NULL) - CT (CKM_RIPEMD160_HMAC_GENERAL, NULL) - CT (CKM_SHA256, NULL) - CT (CKM_SHA256_HMAC, NULL) - CT (CKM_SHA256_HMAC_GENERAL, NULL) - CT (CKM_SHA384, NULL) - CT (CKM_SHA384_HMAC, NULL) - CT (CKM_SHA384_HMAC_GENERAL, NULL) - CT (CKM_SHA512, NULL) - CT (CKM_SHA512_HMAC, NULL) - CT (CKM_SHA512_HMAC_GENERAL, NULL) - CT (CKM_CAST_KEY_GEN, NULL) - CT (CKM_CAST_ECB, NULL) - CT (CKM_CAST_CBC, NULL) - CT (CKM_CAST_MAC, NULL) - CT (CKM_CAST_MAC_GENERAL, NULL) - CT (CKM_CAST_CBC_PAD, NULL) - CT (CKM_CAST3_KEY_GEN, NULL) - CT (CKM_CAST3_ECB, NULL) - CT (CKM_CAST3_CBC, NULL) - CT (CKM_CAST3_MAC, NULL) - CT (CKM_CAST3_MAC_GENERAL, NULL) - CT (CKM_CAST3_CBC_PAD, NULL) - CT (CKM_CAST5_KEY_GEN, NULL) + CT (CKM_RSA_PKCS_KEY_PAIR_GEN, "rsa-pkcs-key-pair-gen") + CT (CKM_RSA_PKCS, "rsa-pkcs") + CT (CKM_RSA_9796, "rsa-9796") + CT (CKM_RSA_X_509, "rsa-x-509") + CT (CKM_MD2_RSA_PKCS, "md2-rsa-pkcs") + CT (CKM_MD5_RSA_PKCS, "md5-rsa-pkcs") + CT (CKM_SHA1_RSA_PKCS, "sha1-rsa-pkcs") + CT (CKM_RIPEMD128_RSA_PKCS, "ripemd128-rsa-pkcs") + CT (CKM_RIPEMD160_RSA_PKCS, "ripemd160-rsa-pkcs") + CT (CKM_RSA_PKCS_OAEP, "rsa-pkcs-oaep") + CT (CKM_RSA_X9_31_KEY_PAIR_GEN, "rsa-x9-31-key-pair-gen") + CT (CKM_RSA_X9_31, "rsa-x9-31") + CT (CKM_SHA1_RSA_X9_31, "sha1-rsa-x9-31") + CT (CKM_RSA_PKCS_PSS, "rsa-pkcs-pss") + CT (CKM_SHA1_RSA_PKCS_PSS, "sha1-rsa-pkcs-pss") + CT (CKM_DSA_KEY_PAIR_GEN, "dsa-key-pair-gen") + CT (CKM_DSA, NULL) /* "dsa" */ + CT (CKM_DSA_SHA1, "dsa-sha1") + CT (CKM_DH_PKCS_KEY_PAIR_GEN, "dh-pkcs-key-pair-gen") + CT (CKM_DH_PKCS_DERIVE, "dh-pkcs-derive") + CT (CKM_X9_42_DH_KEY_PAIR_GEN, "x9-42-dh-key-pair-gen") + CT (CKM_X9_42_DH_DERIVE, "x9-42-dh-derive") + CT (CKM_X9_42_DH_HYBRID_DERIVE, "x9-42-dh-hybrid-derive") + CT (CKM_X9_42_MQV_DERIVE, "x9-42-mqv-derive") + CT (CKM_SHA256_RSA_PKCS, "sha256-rsa-pkcs") + CT (CKM_SHA384_RSA_PKCS, "sha384-rsa-pkcs") + CT (CKM_SHA512_RSA_PKCS, "sha512-rsa-pkcs") + CT (CKM_SHA256_RSA_PKCS_PSS, "sha256-rsa-pkcs-pss") + CT (CKM_SHA384_RSA_PKCS_PSS, "sha384-rsa-pkcs-pss") + CT (CKM_SHA512_RSA_PKCS_PSS, "sha512-rsa-pkcs-pss") + CT (CKM_RC2_KEY_GEN, "rc2-key-gen") + CT (CKM_RC2_ECB, "rc2-ecb") + CT (CKM_RC2_CBC, "rc2-cbc") + CT (CKM_RC2_MAC, "rc2-mac") + CT (CKM_RC2_MAC_GENERAL, "rc2-mac-general") + CT (CKM_RC2_CBC_PAD, "rc2-cbc-pad") + CT (CKM_RC4_KEY_GEN, "rc4-key-gen") + CT (CKM_RC4, NULL) /* "rc4" */ + CT (CKM_DES_KEY_GEN, "des-key-gen") + CT (CKM_DES_ECB, "des-ecb") + CT (CKM_DES_CBC, "des-cbc") + CT (CKM_DES_MAC, "des-mac") + CT (CKM_DES_MAC_GENERAL, "des-mac-general") + CT (CKM_DES_CBC_PAD, "des-cbc-pad") + CT (CKM_DES2_KEY_GEN, "des2-key-gen") + CT (CKM_DES3_KEY_GEN, "des3-key-gen") + CT (CKM_DES3_ECB, "des3-ecb") + CT (CKM_DES3_CBC, "des3-cbc") + CT (CKM_DES3_MAC, "des3-mac") + CT (CKM_DES3_MAC_GENERAL, "des3-mac-general") + CT (CKM_DES3_CBC_PAD, "des3-cbc-pad") + CT (CKM_CDMF_KEY_GEN, "cdmf-key-gen") + CT (CKM_CDMF_ECB, "cdmf-ecb") + CT (CKM_CDMF_CBC, "cdmf-cbc") + CT (CKM_CDMF_MAC, "cdmf-mac") + CT (CKM_CDMF_MAC_GENERAL, "cdmf-mac-general") + CT (CKM_CDMF_CBC_PAD, "cdmf-cbc-pad") + CT (CKM_DES_OFB64, "des-ofb64") + CT (CKM_DES_OFB8, "des-ofb8") + CT (CKM_DES_CFB64, "des-cfb64") + CT (CKM_DES_CFB8, "des-cfb8") + CT (CKM_MD2, "md2") + CT (CKM_MD2_HMAC, "md2-hmac") + CT (CKM_MD2_HMAC_GENERAL, "md2-hmac-general") + CT (CKM_MD5, "md5") + CT (CKM_MD5_HMAC, "md5-hmac") + CT (CKM_MD5_HMAC_GENERAL, "md5-hmac-general") + CT (CKM_SHA_1, "sha-1") + CT (CKM_SHA_1_HMAC, "sha-1-hmac") + CT (CKM_SHA_1_HMAC_GENERAL, "sha-1-hmac-general") + CT (CKM_RIPEMD128, "ripemd128") + CT (CKM_RIPEMD128_HMAC, "ripemd128-hmac") + CT (CKM_RIPEMD128_HMAC_GENERAL, "ripemd128-hmac-general") + CT (CKM_RIPEMD160, "ripemd160") + CT (CKM_RIPEMD160_HMAC, "ripemd160-hmac") + CT (CKM_RIPEMD160_HMAC_GENERAL, "ripemd160-hmac-general") + CT (CKM_SHA256, "sha256") + CT (CKM_SHA256_HMAC, "sha256-hmac") + CT (CKM_SHA256_HMAC_GENERAL, "sha256-hmac-general") + CT (CKM_SHA384, "sha384") + CT (CKM_SHA384_HMAC, "sha384-hmac") + CT (CKM_SHA384_HMAC_GENERAL, "sha384-hmac-general") + CT (CKM_SHA512, "sha512") + CT (CKM_SHA512_HMAC, "sha512-hmac") + CT (CKM_SHA512_HMAC_GENERAL, "sha512-hmac-general") + CT (CKM_CAST_KEY_GEN, "cast-key-gen") + CT (CKM_CAST_ECB, "cast-ecb") + CT (CKM_CAST_CBC, "cast-cbc") + CT (CKM_CAST_MAC, "cast-mac") + CT (CKM_CAST_MAC_GENERAL, "cast-mac-general") + CT (CKM_CAST_CBC_PAD, "cast-cbc-pad") + CT (CKM_CAST3_KEY_GEN, "cast3-key-gen") + CT (CKM_CAST3_ECB, "cast3-ecb") + CT (CKM_CAST3_CBC, "cast3-cbc") + CT (CKM_CAST3_MAC, "cast3-mac") + CT (CKM_CAST3_MAC_GENERAL, "cast3-mac-general") + CT (CKM_CAST3_CBC_PAD, "cast3-cbc-pad") + CT (CKM_CAST5_KEY_GEN, "cast5-key-gen") /* CT (CKM_CAST128_KEY_GEN) */ - CT (CKM_CAST5_ECB, NULL) + CT (CKM_CAST5_ECB, "cast5-ecb") /* CT (CKM_CAST128_ECB) */ - CT (CKM_CAST5_CBC, NULL) + CT (CKM_CAST5_CBC, "cast5-cbc") /* CT (CKM_CAST128_CBC) */ - CT (CKM_CAST5_MAC, NULL) + CT (CKM_CAST5_MAC, "cast5-mac") /* CT (CKM_CAST128_MAC) */ - CT (CKM_CAST5_MAC_GENERAL, NULL) + CT (CKM_CAST5_MAC_GENERAL, "cast5-mac-general") /* CT (CKM_CAST128_MAC_GENERAL) */ - CT (CKM_CAST5_CBC_PAD, NULL) + CT (CKM_CAST5_CBC_PAD, "cast5-cbc-pad") /* CT (CKM_CAST128_CBC_PAD) */ - CT (CKM_RC5_KEY_GEN, NULL) - CT (CKM_RC5_ECB, NULL) - CT (CKM_RC5_CBC, NULL) - CT (CKM_RC5_MAC, NULL) - CT (CKM_RC5_MAC_GENERAL, NULL) - CT (CKM_RC5_CBC_PAD, NULL) - CT (CKM_IDEA_KEY_GEN, NULL) - CT (CKM_IDEA_ECB, NULL) - CT (CKM_IDEA_CBC, NULL) - CT (CKM_IDEA_MAC, NULL) - CT (CKM_IDEA_MAC_GENERAL, NULL) - CT (CKM_IDEA_CBC_PAD, NULL) - CT (CKM_GENERIC_SECRET_KEY_GEN, NULL) - CT (CKM_CONCATENATE_BASE_AND_KEY, NULL) - CT (CKM_CONCATENATE_BASE_AND_DATA, NULL) - CT (CKM_CONCATENATE_DATA_AND_BASE, NULL) - CT (CKM_XOR_BASE_AND_DATA, NULL) - CT (CKM_EXTRACT_KEY_FROM_KEY, NULL) - CT (CKM_SSL3_PRE_MASTER_KEY_GEN, NULL) - CT (CKM_SSL3_MASTER_KEY_DERIVE, NULL) - CT (CKM_SSL3_KEY_AND_MAC_DERIVE, NULL) - CT (CKM_SSL3_MASTER_KEY_DERIVE_DH, NULL) - CT (CKM_TLS_PRE_MASTER_KEY_GEN, NULL) - CT (CKM_TLS_MASTER_KEY_DERIVE, NULL) - CT (CKM_TLS_KEY_AND_MAC_DERIVE, NULL) - CT (CKM_TLS_MASTER_KEY_DERIVE_DH, NULL) + CT (CKM_RC5_KEY_GEN, "rc5-key-gen") + CT (CKM_RC5_ECB, "rc5-ecb") + CT (CKM_RC5_CBC, "rc5-cbc") + CT (CKM_RC5_MAC, "rc5-mac") + CT (CKM_RC5_MAC_GENERAL, "rc5-mac-general") + CT (CKM_RC5_CBC_PAD, "rc5-cbc-pad") + CT (CKM_IDEA_KEY_GEN, "idea-key-gen") + CT (CKM_IDEA_ECB, "idea-ecb") + CT (CKM_IDEA_CBC, "idea-cbc") + CT (CKM_IDEA_MAC, "idea-mac") + CT (CKM_IDEA_MAC_GENERAL, "idea-mac-general") + CT (CKM_IDEA_CBC_PAD, "idea-cbc-pad") + CT (CKM_GENERIC_SECRET_KEY_GEN, "generic-secret-key-gen") + CT (CKM_CONCATENATE_BASE_AND_KEY, "concatenate-base-and-key") + CT (CKM_CONCATENATE_BASE_AND_DATA, "concatenate-base-and-data") + CT (CKM_CONCATENATE_DATA_AND_BASE, "concatenate-data-and-base") + CT (CKM_XOR_BASE_AND_DATA, "xor-base-and-data") + CT (CKM_EXTRACT_KEY_FROM_KEY, "extract-key-from-key") + CT (CKM_SSL3_PRE_MASTER_KEY_GEN, "ssl3-pre-master-key-gen") + CT (CKM_SSL3_MASTER_KEY_DERIVE, "ssl3-master-key-derive") + CT (CKM_SSL3_KEY_AND_MAC_DERIVE, "ssl3-key-and-mac-derive") + CT (CKM_SSL3_MASTER_KEY_DERIVE_DH, "ssl3-master-key-derive-dh") + CT (CKM_TLS_PRE_MASTER_KEY_GEN, "tls-pre-master-key-gen") + CT (CKM_TLS_MASTER_KEY_DERIVE, "tls-master-key-derive") + CT (CKM_TLS_KEY_AND_MAC_DERIVE, "tls-key-and-mac-derive") + CT (CKM_TLS_MASTER_KEY_DERIVE_DH, "tls-master-key-derive-dh") /* CT (CKM_TLS_PRF) */ - CT (CKM_SSL3_MD5_MAC, NULL) - CT (CKM_SSL3_SHA1_MAC, NULL) - CT (CKM_MD5_KEY_DERIVATION, NULL) - CT (CKM_MD2_KEY_DERIVATION, NULL) - CT (CKM_SHA1_KEY_DERIVATION, NULL) - CT (CKM_SHA256_KEY_DERIVATION, NULL) - CT (CKM_SHA384_KEY_DERIVATION, NULL) - CT (CKM_SHA512_KEY_DERIVATION, NULL) - CT (CKM_PBE_MD2_DES_CBC, NULL) - CT (CKM_PBE_MD5_DES_CBC, NULL) - CT (CKM_PBE_MD5_CAST_CBC, NULL) - CT (CKM_PBE_MD5_CAST3_CBC, NULL) - CT (CKM_PBE_MD5_CAST5_CBC, NULL) + CT (CKM_SSL3_MD5_MAC, "ssl3-md5-mac") + CT (CKM_SSL3_SHA1_MAC, "ssl3-sha1-mac") + CT (CKM_MD5_KEY_DERIVATION, "md5-key-derivation") + CT (CKM_MD2_KEY_DERIVATION, "md2-key-derivation") + CT (CKM_SHA1_KEY_DERIVATION, "sha1-key-derivation") + CT (CKM_SHA256_KEY_DERIVATION, "sha256-key-derivation") + CT (CKM_SHA384_KEY_DERIVATION, "sha384-key-derivation") + CT (CKM_SHA512_KEY_DERIVATION, "sha512-key-derivation") + CT (CKM_PBE_MD2_DES_CBC, "pbe-md2-des-cbc") + CT (CKM_PBE_MD5_DES_CBC, "pbe-md5-des-cbc") + CT (CKM_PBE_MD5_CAST_CBC, "pbe-md5-cast-cbc") + CT (CKM_PBE_MD5_CAST3_CBC, "pbe-md5-cast3-cbc") + CT (CKM_PBE_MD5_CAST5_CBC, "pbe-md5-cast5-cbc") /* CT (CKM_PBE_MD5_CAST128_CBC) */ - CT (CKM_PBE_SHA1_CAST5_CBC, NULL) + CT (CKM_PBE_SHA1_CAST5_CBC, "pbe-sha1-cast5-cbc") /* CT (CKM_PBE_SHA1_CAST128_CBC) */ - CT (CKM_PBE_SHA1_RC4_128, NULL) - CT (CKM_PBE_SHA1_RC4_40, NULL) - CT (CKM_PBE_SHA1_DES3_EDE_CBC, NULL) - CT (CKM_PBE_SHA1_DES2_EDE_CBC, NULL) - CT (CKM_PBE_SHA1_RC2_128_CBC, NULL) - CT (CKM_PBE_SHA1_RC2_40_CBC, NULL) - CT (CKM_PKCS5_PBKD2, NULL) - CT (CKM_PBA_SHA1_WITH_SHA1_HMAC, NULL) - CT (CKM_WTLS_PRE_MASTER_KEY_GEN, NULL) - CT (CKM_WTLS_MASTER_KEY_DERIVE, NULL) - CT (CKM_WTLS_MASTER_KEY_DERIVE_DH_ECC, NULL) - CT (CKM_WTLS_PRF, NULL) - CT (CKM_WTLS_SERVER_KEY_AND_MAC_DERIVE, NULL) - CT (CKM_WTLS_CLIENT_KEY_AND_MAC_DERIVE, NULL) - CT (CKM_KEY_WRAP_LYNKS, NULL) - CT (CKM_KEY_WRAP_SET_OAEP, NULL) - CT (CKM_CMS_SIG, NULL) - CT (CKM_SKIPJACK_KEY_GEN, NULL) - CT (CKM_SKIPJACK_ECB64, NULL) - CT (CKM_SKIPJACK_CBC64, NULL) - CT (CKM_SKIPJACK_OFB64, NULL) - CT (CKM_SKIPJACK_CFB64, NULL) - CT (CKM_SKIPJACK_CFB32, NULL) - CT (CKM_SKIPJACK_CFB16, NULL) - CT (CKM_SKIPJACK_CFB8, NULL) - CT (CKM_SKIPJACK_WRAP, NULL) - CT (CKM_SKIPJACK_PRIVATE_WRAP, NULL) - CT (CKM_SKIPJACK_RELAYX, NULL) - CT (CKM_KEA_KEY_PAIR_GEN, NULL) - CT (CKM_KEA_KEY_DERIVE, NULL) - CT (CKM_FORTEZZA_TIMESTAMP, NULL) - CT (CKM_BATON_KEY_GEN, NULL) - CT (CKM_BATON_ECB128, NULL) - CT (CKM_BATON_ECB96, NULL) - CT (CKM_BATON_CBC128, NULL) - CT (CKM_BATON_COUNTER, NULL) - CT (CKM_BATON_SHUFFLE, NULL) - CT (CKM_BATON_WRAP, NULL) - CT (CKM_ECDSA_KEY_PAIR_GEN, NULL) + CT (CKM_PBE_SHA1_RC4_128, "pbe-sha1-rc4-128") + CT (CKM_PBE_SHA1_RC4_40, "pbe-sha1-rc4-40") + CT (CKM_PBE_SHA1_DES3_EDE_CBC, "pbe-sha1-des3-ede-cbc") + CT (CKM_PBE_SHA1_DES2_EDE_CBC, "pbe-sha1-des2-ede-cbc") + CT (CKM_PBE_SHA1_RC2_128_CBC, "pbe-sha1-rc2-128-cbc") + CT (CKM_PBE_SHA1_RC2_40_CBC, "pbe-sha1-rc2-40-cbc") + CT (CKM_PKCS5_PBKD2, "pkcs5-pbkd2") + CT (CKM_PBA_SHA1_WITH_SHA1_HMAC, "pba-sha1-with-sha1-hmac") + CT (CKM_WTLS_PRE_MASTER_KEY_GEN, "wtls-pre-master-key-gen") + CT (CKM_WTLS_MASTER_KEY_DERIVE, "wtls-master-key-derive") + CT (CKM_WTLS_MASTER_KEY_DERIVE_DH_ECC, "wtls-master-key-derive-dh-ecc") + CT (CKM_WTLS_PRF, "wtls-prf") + CT (CKM_WTLS_SERVER_KEY_AND_MAC_DERIVE, "wtls-server-key-and-mac-derive") + CT (CKM_WTLS_CLIENT_KEY_AND_MAC_DERIVE, "wtls-client-key-and-mac-derive") + CT (CKM_KEY_WRAP_LYNKS, "key-wrap-lynks") + CT (CKM_KEY_WRAP_SET_OAEP, "key-wrap-set-oaep") + CT (CKM_CMS_SIG, "cms-sig") + CT (CKM_SKIPJACK_KEY_GEN, "skipjack-key-gen") + CT (CKM_SKIPJACK_ECB64, "skipjack-ecb64") + CT (CKM_SKIPJACK_CBC64, "skipjack-cbc64") + CT (CKM_SKIPJACK_OFB64, "skipjack-ofb64") + CT (CKM_SKIPJACK_CFB64, "skipjack-cfb64") + CT (CKM_SKIPJACK_CFB32, "skipjack-cfb32") + CT (CKM_SKIPJACK_CFB16, "skipjack-cfb16") + CT (CKM_SKIPJACK_CFB8, "skipjack-cfb8") + CT (CKM_SKIPJACK_WRAP, "skipjack-wrap") + CT (CKM_SKIPJACK_PRIVATE_WRAP, "skipjack-private-wrap") + CT (CKM_SKIPJACK_RELAYX, "skipjack-relayx") + CT (CKM_KEA_KEY_PAIR_GEN, "kea-key-pair-gen") + CT (CKM_KEA_KEY_DERIVE, "kea-key-derive") + CT (CKM_FORTEZZA_TIMESTAMP, "fortezza-timestamp") + CT (CKM_BATON_KEY_GEN, "baton-key-gen") + CT (CKM_BATON_ECB128, "baton-ecb128") + CT (CKM_BATON_ECB96, "baton-ecb96") + CT (CKM_BATON_CBC128, "baton-cbc128") + CT (CKM_BATON_COUNTER, "baton-counter") + CT (CKM_BATON_SHUFFLE, "baton-shuffle") + CT (CKM_BATON_WRAP, "baton-wrap") + CT (CKM_ECDSA_KEY_PAIR_GEN, "ecdsa-key-pair-gen") /* CT (CKM_EC_KEY_PAIR_GEN) */ - CT (CKM_ECDSA, NULL) - CT (CKM_ECDSA_SHA1, NULL) - CT (CKM_ECDH1_DERIVE, NULL) - CT (CKM_ECDH1_COFACTOR_DERIVE, NULL) - CT (CKM_ECMQV_DERIVE, NULL) - CT (CKM_JUNIPER_KEY_GEN, NULL) - CT (CKM_JUNIPER_ECB128, NULL) - CT (CKM_JUNIPER_CBC128, NULL) - CT (CKM_JUNIPER_COUNTER, NULL) - CT (CKM_JUNIPER_SHUFFLE, NULL) - CT (CKM_JUNIPER_WRAP, NULL) - CT (CKM_FASTHASH, NULL) - CT (CKM_AES_KEY_GEN, NULL) - CT (CKM_AES_ECB, NULL) - CT (CKM_AES_CBC, NULL) - CT (CKM_AES_MAC, NULL) - CT (CKM_AES_MAC_GENERAL, NULL) - CT (CKM_AES_CBC_PAD, NULL) - CT (CKM_BLOWFISH_KEY_GEN, NULL) - CT (CKM_BLOWFISH_CBC, NULL) - CT (CKM_TWOFISH_KEY_GEN, NULL) - CT (CKM_TWOFISH_CBC, NULL) - CT (CKM_DES_ECB_ENCRYPT_DATA, NULL) - CT (CKM_DES_CBC_ENCRYPT_DATA, NULL) - CT (CKM_DES3_ECB_ENCRYPT_DATA, NULL) - CT (CKM_DES3_CBC_ENCRYPT_DATA, NULL) - CT (CKM_AES_ECB_ENCRYPT_DATA, NULL) - CT (CKM_AES_CBC_ENCRYPT_DATA, NULL) - CT (CKM_DSA_PARAMETER_GEN, NULL) - CT (CKM_DH_PKCS_PARAMETER_GEN, NULL) - CT (CKM_X9_42_DH_PARAMETER_GEN, NULL) + CT (CKM_ECDSA, "ecdsa") + CT (CKM_ECDSA_SHA1, "ecdsa-sha1") + CT (CKM_ECDH1_DERIVE, "ecdh1-derive") + CT (CKM_ECDH1_COFACTOR_DERIVE, "ecdh1-cofactor-derive") + CT (CKM_ECMQV_DERIVE, "ecmqv-derive") + CT (CKM_JUNIPER_KEY_GEN, "juniper-key-gen") + CT (CKM_JUNIPER_ECB128, "juniper-ecb128") + CT (CKM_JUNIPER_CBC128, "juniper-cbc128") + CT (CKM_JUNIPER_COUNTER, "juniper-counter") + CT (CKM_JUNIPER_SHUFFLE, "juniper-shuffle") + CT (CKM_JUNIPER_WRAP, "juniper-wrap") + CT (CKM_FASTHASH, "fasthash") + CT (CKM_AES_KEY_GEN, "aes-key-gen") + CT (CKM_AES_ECB, "aes-ecb") + CT (CKM_AES_CBC, "aes-cbc") + CT (CKM_AES_MAC, "aes-mac") + CT (CKM_AES_MAC_GENERAL, "aes-mac-general") + CT (CKM_AES_CBC_PAD, "aes-cbc-pad") + CT (CKM_BLOWFISH_KEY_GEN, "blowfish-key-gen") + CT (CKM_BLOWFISH_CBC, "blowfish-cbc") + CT (CKM_TWOFISH_KEY_GEN, "twofish-key-gen") + CT (CKM_TWOFISH_CBC, "twofish-cbc") + CT (CKM_DES_ECB_ENCRYPT_DATA, "des-ecb-encrypt-data") + CT (CKM_DES_CBC_ENCRYPT_DATA, "des-cbc-encrypt-data") + CT (CKM_DES3_ECB_ENCRYPT_DATA, "des3-ecb-encrypt-data") + CT (CKM_DES3_CBC_ENCRYPT_DATA, "des3-cbc-encrypt-data") + CT (CKM_AES_ECB_ENCRYPT_DATA, "aes-ecb-encrypt-data") + CT (CKM_AES_CBC_ENCRYPT_DATA, "aes-cbc-encrypt-data") + CT (CKM_DSA_PARAMETER_GEN, "dsa-parameter-gen") + CT (CKM_DH_PKCS_PARAMETER_GEN, "dh-pkcs-parameter-gen") + CT (CKM_X9_42_DH_PARAMETER_GEN, "x9-42-dh-parameter-gen") { CKA_INVALID }, }; diff --git a/common/tests/test-constants.c b/common/tests/test-constants.c index 76c44d2..9adc81a 100644 --- a/common/tests/test-constants.c +++ b/common/tests/test-constants.c @@ -44,56 +44,38 @@ #include "debug.h" static void -test_constants (void) +test_constants (void *arg) { - const p11_constant *constant; + const p11_constant *constant = arg; p11_dict *nicks, *names; CK_ULONG check; - int i, j; - - static const p11_constant *constants[] = { - p11_constant_types, - p11_constant_classes, - p11_constant_trusts, - p11_constant_certs, - p11_constant_keys, - p11_constant_asserts, - p11_constant_categories, - p11_constant_mechanisms, - p11_constant_users, - p11_constant_states, - p11_constant_returns, - NULL - }; + int i; nicks = p11_constant_reverse (true); names = p11_constant_reverse (false); - for (j = 0; constants[j] != NULL; j++) { - constant = constants[j]; - for (i = 1; constant[i].value != CKA_INVALID; i++) { - if (constant[i].value < constant[i - 1].value) - assert_fail ("attr constant out of order", constant[i].name); - } - for (i = 0; constant[i].value != CKA_INVALID; i++) { - assert_ptr_not_null (constant[i].name); - - if (constant[i].nick) { - assert_str_eq (constant[i].nick, - p11_constant_nick (constant, constant[i].value)); - } + for (i = 1; constant[i].value != CKA_INVALID; i++) { + if (constant[i].value < constant[i - 1].value) + assert_fail ("attr constant out of order", constant[i].name); + } + for (i = 0; constant[i].value != CKA_INVALID; i++) { + assert_ptr_not_null (constant[i].name); - assert_str_eq (constant[i].name, - p11_constant_name (constant, constant[i].value)); + if (constant[i].nick) { + assert_str_eq (constant[i].nick, + p11_constant_nick (constant, constant[i].value)); + } - if (constant[i].nick) { - check = p11_constant_resolve (nicks, constant[i].nick); - assert_num_eq (constant[i].value, check); - } + assert_str_eq (constant[i].name, + p11_constant_name (constant, constant[i].value)); - check = p11_constant_resolve (names, constant[i].name); + if (constant[i].nick) { + check = p11_constant_resolve (nicks, constant[i].nick); assert_num_eq (constant[i].value, check); } + + check = p11_constant_resolve (names, constant[i].name); + assert_num_eq (constant[i].value, check); } p11_dict_free (names); @@ -104,7 +86,17 @@ int main (int argc, char *argv[]) { - p11_test (test_constants, "/constants/all"); + p11_testx (test_constants, (void *)p11_constant_types, "/constants/types"); + p11_testx (test_constants, (void *)p11_constant_classes, "/constants/classes"); + p11_testx (test_constants, (void *)p11_constant_trusts, "/constants/trusts"); + p11_testx (test_constants, (void *)p11_constant_certs, "/constants/certs"); + p11_testx (test_constants, (void *)p11_constant_keys, "/constants/keys"); + p11_testx (test_constants, (void *)p11_constant_asserts, "/constants/asserts"); + p11_testx (test_constants, (void *)p11_constant_categories, "/constants/categories"); + p11_testx (test_constants, (void *)p11_constant_mechanisms, "/constants/mechanisms"); + p11_testx (test_constants, (void *)p11_constant_users, "/constants/users"); + p11_testx (test_constants, (void *)p11_constant_states, "/constants/states"); + p11_testx (test_constants, (void *)p11_constant_returns, "/constants/returns"); return p11_test_run (argc, argv); } -- cgit v1.1