pkcs11x.h 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. /*
  2. * Copyright (c) 2012 Red Hat Inc.
  3. *
  4. * Redistribution and use in source and binary forms, with or without
  5. * modification, are permitted provided that the following conditions
  6. * are met:
  7. *
  8. * * Redistributions of source code must retain the above
  9. * copyright notice, this list of conditions and the
  10. * following disclaimer.
  11. * * Redistributions in binary form must reproduce the
  12. * above copyright notice, this list of conditions and
  13. * the following disclaimer in the documentation and/or
  14. * other materials provided with the distribution.
  15. * * The names of contributors to this software may not be
  16. * used to endorse or promote products derived from this
  17. * software without specific prior written permission.
  18. *
  19. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  20. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  21. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
  22. * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  23. * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
  24. * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
  25. * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
  26. * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
  27. * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  28. * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
  29. * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
  30. * DAMAGE.
  31. *
  32. * Author: Stef Walter <stefw@redhat.com>
  33. */
  34. #ifndef PKCS11_X_H_
  35. #define PKCS11_X_H_ 1
  36. #if defined(__cplusplus)
  37. extern "C" {
  38. #endif
  39. /* -------------------------------------------------------------------
  40. * NSS TRUST OBJECTS
  41. *
  42. * And related, non-standard
  43. */
  44. /* Define this if you want the NSS specific symbols */
  45. #define CRYPTOKI_NSS_VENDOR_DEFINED 1
  46. #ifdef CRYPTOKI_NSS_VENDOR_DEFINED
  47. /* Various NSS objects */
  48. #define CKO_NSS_CRL 0xce534351UL
  49. #define CKO_NSS_SMIME 0xce534352UL
  50. #define CKO_NSS_TRUST 0xce534353UL
  51. #define CKO_NSS_BUILTIN_ROOT_LIST 0xce534354UL
  52. #define CKO_NSS_NEWSLOT 0xce534355UL
  53. #define CKO_NSS_DELSLOT 0xce534356UL
  54. /* Various NSS key types */
  55. #define CKK_NSS_PKCS8 0xce534351UL
  56. /* Various NSS attributes */
  57. #define CKA_NSS_URL 0xce534351UL
  58. #define CKA_NSS_EMAIL 0xce534352UL
  59. #define CKA_NSS_SMIME_INFO 0xce534353UL
  60. #define CKA_NSS_SMIME_TIMESTAMP 0xce534354UL
  61. #define CKA_NSS_PKCS8_SALT 0xce534355UL
  62. #define CKA_NSS_PASSWORD_CHECK 0xce534356UL
  63. #define CKA_NSS_EXPIRES 0xce534357UL
  64. #define CKA_NSS_KRL 0xce534358UL
  65. #define CKA_NSS_PQG_COUNTER 0xce534364UL
  66. #define CKA_NSS_PQG_SEED 0xce534365UL
  67. #define CKA_NSS_PQG_H 0xce534366UL
  68. #define CKA_NSS_PQG_SEED_BITS 0xce534367UL
  69. #define CKA_NSS_MODULE_SPEC 0xce534368UL
  70. #define CKA_NSS_MOZILLA_CA_POLICY 0xce534372UL
  71. #define CKA_NSS_SERVER_DISTRUST_AFTER 0xce534373UL
  72. #define CKA_NSS_EMAIL_DISTRUST_AFTER 0xce534374UL
  73. /* NSS trust attributes */
  74. #define CKA_TRUST_DIGITAL_SIGNATURE 0xce536351UL
  75. #define CKA_TRUST_NON_REPUDIATION 0xce536352UL
  76. #define CKA_TRUST_KEY_ENCIPHERMENT 0xce536353UL
  77. #define CKA_TRUST_DATA_ENCIPHERMENT 0xce536354UL
  78. #define CKA_TRUST_KEY_AGREEMENT 0xce536355UL
  79. #define CKA_TRUST_KEY_CERT_SIGN 0xce536356UL
  80. #define CKA_TRUST_CRL_SIGN 0xce536357UL
  81. #define CKA_TRUST_SERVER_AUTH 0xce536358UL
  82. #define CKA_TRUST_CLIENT_AUTH 0xce536359UL
  83. #define CKA_TRUST_CODE_SIGNING 0xce53635aUL
  84. #define CKA_TRUST_EMAIL_PROTECTION 0xce53635bUL
  85. #define CKA_TRUST_IPSEC_END_SYSTEM 0xce53635cUL
  86. #define CKA_TRUST_IPSEC_TUNNEL 0xce53635dUL
  87. #define CKA_TRUST_IPSEC_USER 0xce53635eUL
  88. #define CKA_TRUST_TIME_STAMPING 0xce53635fUL
  89. #define CKA_TRUST_STEP_UP_APPROVED 0xce536360UL
  90. #define CKA_CERT_SHA1_HASH 0xce5363b4UL
  91. #define CKA_CERT_MD5_HASH 0xce5363b5UL
  92. /* NSS trust values */
  93. typedef CK_ULONG CK_TRUST;
  94. #define CKT_NSS_TRUSTED 0xce534351UL
  95. #define CKT_NSS_TRUSTED_DELEGATOR 0xce534352UL
  96. #define CKT_NSS_MUST_VERIFY_TRUST 0xce534353UL
  97. #define CKT_NSS_NOT_TRUSTED 0xce53435AUL
  98. #define CKT_NSS_TRUST_UNKNOWN 0xce534355UL
  99. #define CKT_NSS_VALID_DELEGATOR 0xce53435BUL
  100. /* NSS specific mechanisms */
  101. #define CKM_NSS_AES_KEY_WRAP 0xce534351UL
  102. #define CKM_NSS_AES_KEY_WRAP_PAD 0xce534352UL
  103. /* NSS specific return values */
  104. #define CKR_NSS_CERTDB_FAILED 0xce534351UL
  105. #define CKR_NSS_KEYDB_FAILED 0xce534352UL
  106. #endif /* CRYPTOKI_NSS_VENDOR_DEFINED */
  107. /* Define this if you want the vendor specific symbols */
  108. #define CRYPTOKI_X_VENDOR_DEFINED 1
  109. #ifdef CRYPTOKI_X_VENDOR_DEFINED
  110. #define CKA_X_VENDOR (CKA_VENDOR_DEFINED | 0x58444700UL)
  111. #define CKO_X_VENDOR (CKA_VENDOR_DEFINED | 0x58444700UL)
  112. /* -------------------------------------------------------------------
  113. * BLOCKLISTS
  114. */
  115. #define CKA_X_DISTRUSTED (CKA_X_VENDOR + 100)
  116. /* -------------------------------------------------------------------
  117. * CERTIFICATE EXTENSIONS
  118. *
  119. * For attaching certificate extensions to certificates
  120. */
  121. #define CKO_X_CERTIFICATE_EXTENSION (CKO_X_VENDOR + 200)
  122. /* From the 2.40 draft */
  123. #ifndef CKA_PUBLIC_KEY_INFO
  124. #define CKA_PUBLIC_KEY_INFO 0x00000129UL
  125. #endif
  126. #endif /* CRYPTOKI_X_VENDOR_DEFINED */
  127. /* Define this if you want the vendor specific symbols */
  128. #define CRYPTOKI_RU_TEAM_TC26_VENDOR_DEFINED 1
  129. #ifdef CRYPTOKI_RU_TEAM_TC26_VENDOR_DEFINED
  130. /* See https://tc26.ru/standarts/perevody/guidelines-the-pkcs-11-extensions-for-implementing-the-gost-r-34-10-2012-and-gost-r-34-11-2012-russian-standards-.html */
  131. #define NSSCK_VENDOR_PKCS11_RU_TEAM 0xD4321000 /* 0x80000000 | 0x54321000 */
  132. #define CK_VENDOR_PKCS11_RU_TEAM_TC26 NSSCK_VENDOR_PKCS11_RU_TEAM
  133. /* GOST KEY TYPES */
  134. #define CKK_GOSTR3410_512 (CK_VENDOR_PKCS11_RU_TEAM_TC26 |0x003)
  135. #define CKK_KUZNECHIK (CK_VENDOR_PKCS11_RU_TEAM_TC26 |0x004)
  136. #define CKK_MAGMA (CK_VENDOR_PKCS11_RU_TEAM_TC26 |0x005)
  137. /* PKCS #5 PRF Functions */
  138. #define CKP_PKCS5_PBKD2_HMAC_GOSTR3411_2012_512 (CK_VENDOR_PKCS11_RU_TEAM_TC26 |0x003)
  139. /* GOST MECHANISMS */
  140. #define CKM_GOSTR3410_512_KEY_PAIR_GEN (CK_VENDOR_PKCS11_RU_TEAM_TC26 |0x005)
  141. #define CKM_GOSTR3410_512 (CK_VENDOR_PKCS11_RU_TEAM_TC26 |0x006)
  142. #define CKM_GOSTR3410_2012_DERIVE (CK_VENDOR_PKCS11_RU_TEAM_TC26 |0x007)
  143. #define CKM_GOSTR3410_WITH_GOSTR3411_2012_256 (CK_VENDOR_PKCS11_RU_TEAM_TC26 |0x008)
  144. #define CKM_GOSTR3410_WITH_GOSTR3411_2012_512 (CK_VENDOR_PKCS11_RU_TEAM_TC26 |0x009)
  145. #define CKM_GOSTR3410_PUBLIC_KEY_DERIVE (CK_VENDOR_PKCS11_RU_TEAM_TC26 |0x00A)
  146. #define CKM_GOSTR3411_2012_256 (CK_VENDOR_PKCS11_RU_TEAM_TC26 |0x012)
  147. #define CKM_GOSTR3411_2012_512 (CK_VENDOR_PKCS11_RU_TEAM_TC26 |0x013)
  148. #define CKM_GOSTR3411_2012_256_HMAC (CK_VENDOR_PKCS11_RU_TEAM_TC26 |0x014)
  149. #define CKM_GOSTR3411_2012_512_HMAC (CK_VENDOR_PKCS11_RU_TEAM_TC26 |0x015)
  150. #define CKM_TLS_GOST_PRF_2012_256 (CK_VENDOR_PKCS11_RU_TEAM_TC26 |0x016)
  151. #define CKM_TLS_GOST_PRF_2012_512 (CK_VENDOR_PKCS11_RU_TEAM_TC26 |0x017)
  152. #define CKM_TLS_GOST_MASTER_KEY_DERIVE_2012_256 (CK_VENDOR_PKCS11_RU_TEAM_TC26 |0x018)
  153. #define CKM_KDF_4357 (CK_VENDOR_PKCS11_RU_TEAM_TC26 |0x025)
  154. #define CKM_KDF_GOSTR3411_2012_256 (CK_VENDOR_PKCS11_RU_TEAM_TC26 |0x026)
  155. #endif /* CRYPTOKI_RU_TEAM_TC26_VENDOR_DEFINED */
  156. #if defined(__cplusplus)
  157. }
  158. #endif
  159. #endif /* PKCS11_X_H_ */