crypto_types.h 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  1. /*
  2. * crypto_types.h
  3. *
  4. * constants for cipher types and auth func types
  5. *
  6. * David A. McGrew
  7. * Cisco Systems, Inc.
  8. */
  9. /*
  10. *
  11. * Copyright(c) 2001-2006,2013 Cisco Systems, Inc.
  12. * All rights reserved.
  13. *
  14. * Redistribution and use in source and binary forms, with or without
  15. * modification, are permitted provided that the following conditions
  16. * are met:
  17. *
  18. * Redistributions of source code must retain the above copyright
  19. * notice, this list of conditions and the following disclaimer.
  20. *
  21. * Redistributions in binary form must reproduce the above
  22. * copyright notice, this list of conditions and the following
  23. * disclaimer in the documentation and/or other materials provided
  24. * with the distribution.
  25. *
  26. * Neither the name of the Cisco Systems, Inc. nor the names of its
  27. * contributors may be used to endorse or promote products derived
  28. * from this software without specific prior written permission.
  29. *
  30. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  31. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  32. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
  33. * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  34. * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
  35. * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  36. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  37. * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  38. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
  39. * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  40. * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
  41. * OF THE POSSIBILITY OF SUCH DAMAGE.
  42. *
  43. */
  44. #ifndef CRYPTO_TYPES_H
  45. #define CRYPTO_TYPES_H
  46. /**
  47. * @defgroup Algos Cryptographic Algorithms
  48. *
  49. *
  50. * This library provides several different cryptographic algorithms,
  51. * each of which can be selected by using the cipher_type_id_t and
  52. * auth_type_id_t. These algorithms are documented below.
  53. *
  54. * Authentication functions that use the Universal Security Transform
  55. * (UST) must be used in conjunction with a cipher other than the null
  56. * cipher. These functions require a per-message pseudorandom input
  57. * that is generated by the cipher.
  58. *
  59. * The identifiers STRONGHOLD_AUTH and STRONGHOLD_CIPHER identify the
  60. * strongest available authentication function and cipher,
  61. * respectively. They are resolved at compile time to the strongest
  62. * available algorithm. The stronghold algorithms can serve as did
  63. * the keep of a medieval fortification; they provide the strongest
  64. * defense (or the last refuge).
  65. *
  66. * @{
  67. */
  68. /**
  69. * @defgroup Ciphers Cipher Types
  70. *
  71. * @brief Each cipher type is identified by an unsigned integer. The
  72. * cipher types available in this edition of libSRTP are given
  73. * by the #defines below.
  74. *
  75. * A cipher_type_id_t is an identifier for a cipher_type; only values
  76. * given by the #defines above (or those present in the file
  77. * crypto_types.h) should be used.
  78. *
  79. * The identifier STRONGHOLD_CIPHER indicates the strongest available
  80. * cipher, allowing an application to choose the strongest available
  81. * algorithm without any advance knowledge about the avaliable
  82. * algorithms.
  83. *
  84. * @{
  85. */
  86. /**
  87. * @brief The null cipher performs no encryption.
  88. *
  89. * The NULL_CIPHER leaves its inputs unaltered, during both the
  90. * encryption and decryption operations. This cipher can be chosen
  91. * to indicate that no encryption is to be performed.
  92. */
  93. #define NULL_CIPHER 0
  94. /**
  95. * @brief AES Integer Counter Mode (AES ICM)
  96. *
  97. * AES ICM is the variant of counter mode that is used by Secure RTP.
  98. * This cipher uses a 16-, 24-, or 32-octet key concatenated with a
  99. * 14-octet offset (or salt) value.
  100. */
  101. #define AES_ICM 1
  102. /**
  103. * @brief AES-128 Integer Counter Mode (AES ICM)
  104. * AES-128 ICM is a deprecated alternate name for AES ICM.
  105. */
  106. #define AES_128_ICM AES_ICM
  107. /**
  108. * @brief SEAL 3.0
  109. *
  110. * SEAL is the Software-Optimized Encryption Algorithm of Coppersmith
  111. * and Rogaway. Nota bene: this cipher is IBM proprietary.
  112. */
  113. #define SEAL 2
  114. /**
  115. * @brief AES Cipher Block Chaining mode (AES CBC)
  116. *
  117. * AES CBC is the AES Cipher Block Chaining mode.
  118. * This cipher uses a 16-, 24-, or 32-octet key.
  119. */
  120. #define AES_CBC 3
  121. /**
  122. * @brief AES-128 Cipher Block Chaining mode (AES CBC)
  123. *
  124. * AES-128 CBC is a deprecated alternate name for AES CBC.
  125. */
  126. #define AES_128_CBC AES_CBC
  127. /**
  128. * @brief Strongest available cipher.
  129. *
  130. * This identifier resolves to the strongest cipher type available.
  131. */
  132. #define STRONGHOLD_CIPHER AES_ICM
  133. /**
  134. * @brief AES-192 Integer Counter Mode (AES ICM)
  135. * AES-192 ICM is a deprecated alternate name for AES ICM.
  136. */
  137. #define AES_192_ICM 4
  138. /**
  139. * @brief AES-256 Integer Counter Mode (AES ICM)
  140. * AES-256 ICM is a deprecated alternate name for AES ICM.
  141. */
  142. #define AES_256_ICM 5
  143. /**
  144. * @brief AES-128_GCM Galois Counter Mode (AES GCM)
  145. *
  146. * AES-128 GCM is the variant of galois counter mode that is used by
  147. * Secure RTP. This cipher uses a 16-octet key.
  148. */
  149. #define AES_128_GCM 6
  150. /**
  151. * @brief AES-256_GCM Galois Counter Mode (AES GCM)
  152. *
  153. * AES-256 GCM is the variant of galois counter mode that is used by
  154. * Secure RTP. This cipher uses a 32-octet key.
  155. */
  156. #define AES_256_GCM 7
  157. /**
  158. * @}
  159. */
  160. /**
  161. * @defgroup Authentication Authentication Function Types
  162. *
  163. * @brief Each authentication function type is identified by an
  164. * unsigned integer. The authentication function types available in
  165. * this edition of libSRTP are given by the #defines below.
  166. *
  167. * An auth_type_id_t is an identifier for an authentication function type;
  168. * only values given by the #defines above (or those present in the
  169. * file crypto_types.h) should be used.
  170. *
  171. * The identifier STRONGHOLD_AUTH indicates the strongest available
  172. * authentication function, allowing an application to choose the
  173. * strongest available algorithm without any advance knowledge about
  174. * the avaliable algorithms. The stronghold algorithms can serve as
  175. * did the keep of a medieval fortification; they provide the
  176. * strongest defense (or the last refuge).
  177. *
  178. * @{
  179. */
  180. /**
  181. * @brief The null authentication function performs no authentication.
  182. *
  183. * The NULL_AUTH function does nothing, and can be selected to indicate
  184. * that authentication should not be performed.
  185. */
  186. #define NULL_AUTH 0
  187. /**
  188. * @brief UST with TMMH Version 2
  189. *
  190. * UST_TMMHv2 implements the Truncated Multi-Modular Hash using
  191. * UST. This function must be used in conjunction with a cipher other
  192. * than the null cipher.
  193. * with a cipher.
  194. */
  195. #define UST_TMMHv2 1
  196. /**
  197. * @brief (UST) AES-128 XORMAC
  198. *
  199. * UST_AES_128_XMAC implements AES-128 XORMAC, using UST. Nota bene:
  200. * the XORMAC algorithm is IBM proprietary.
  201. */
  202. #define UST_AES_128_XMAC 2
  203. /**
  204. * @brief HMAC-SHA1
  205. *
  206. * HMAC_SHA1 implements the Hash-based MAC using the NIST Secure
  207. * Hash Algorithm version 1 (SHA1).
  208. */
  209. #define HMAC_SHA1 3
  210. /**
  211. * @brief Strongest available authentication function.
  212. *
  213. * This identifier resolves to the strongest available authentication
  214. * function.
  215. */
  216. #define STRONGHOLD_AUTH HMAC_SHA1
  217. /**
  218. * @}
  219. */
  220. /**
  221. * @}
  222. */
  223. #endif /* CRYPTO_TYPES_H */