Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

444 lines
22 KiB

  1. Crypto++: a C++ Class Library of Cryptographic Schemes
  2. Version 5.6.1 (8/9/2010, SVN r520)
  3. Crypto++ Library is a free C++ class library of cryptographic schemes.
  4. Currently the library contains the following algorithms:
  5. algorithm type name
  6. authenticated encryption schemes GCM, CCM, EAX
  7. high speed stream ciphers Panama, Sosemanuk, Salsa20, XSalsa20
  8. AES and AES candidates AES (Rijndael), RC6, MARS, Twofish, Serpent,
  9. CAST-256
  10. IDEA, Triple-DES (DES-EDE2 and DES-EDE3),
  11. other block ciphers Camellia, SEED, RC5, Blowfish, TEA, XTEA,
  12. Skipjack, SHACAL-2
  13. block cipher modes of operation ECB, CBC, CBC ciphertext stealing (CTS),
  14. CFB, OFB, counter mode (CTR)
  15. message authentication codes VMAC, HMAC, GMAC, CMAC, CBC-MAC, DMAC,
  16. Two-Track-MAC
  17. SHA-1, SHA-2 (SHA-224, SHA-256, SHA-384, and
  18. hash functions SHA-512), Tiger, WHIRLPOOL, RIPEMD-128,
  19. RIPEMD-256, RIPEMD-160, RIPEMD-320
  20. RSA, DSA, ElGamal, Nyberg-Rueppel (NR),
  21. public-key cryptography Rabin-Williams (RW), LUC, LUCELG,
  22. DLIES (variants of DHAES), ESIGN
  23. padding schemes for public-key PKCS#1 v2.0, OAEP, PSS, PSSR, IEEE P1363
  24. systems EMSA2 and EMSA5
  25. Diffie-Hellman (DH), Unified Diffie-Hellman
  26. key agreement schemes (DH2), Menezes-Qu-Vanstone (MQV), LUCDIF,
  27. XTR-DH
  28. elliptic curve cryptography ECDSA, ECNR, ECIES, ECDH, ECMQV
  29. insecure or obsolescent MD2, MD4, MD5, Panama Hash, DES, ARC4, SEAL
  30. algorithms retained for backwards 3.0, WAKE, WAKE-OFB, DESX (DES-XEX3), RC2,
  31. compatibility and historical SAFER, 3-WAY, GOST, SHARK, CAST-128, Square
  32. value
  33. Other features include:
  34. * pseudo random number generators (PRNG): ANSI X9.17 appendix C, RandomPool
  35. * password based key derivation functions: PBKDF1 and PBKDF2 from PKCS #5,
  36. PBKDF from PKCS #12 appendix B
  37. * Shamir's secret sharing scheme and Rabin's information dispersal algorithm
  38. (IDA)
  39. * fast multi-precision integer (bignum) and polynomial operations
  40. * finite field arithmetics, including GF(p) and GF(2^n)
  41. * prime number generation and verification
  42. * useful non-cryptographic algorithms
  43. + DEFLATE (RFC 1951) compression/decompression with gzip (RFC 1952) and
  44. zlib (RFC 1950) format support
  45. + hex, base-32, and base-64 coding/decoding
  46. + 32-bit CRC and Adler32 checksum
  47. * class wrappers for these operating system features (optional):
  48. + high resolution timers on Windows, Unix, and Mac OS
  49. + Berkeley and Windows style sockets
  50. + Windows named pipes
  51. + /dev/random, /dev/urandom, /dev/srandom
  52. + Microsoft's CryptGenRandom on Windows
  53. * A high level interface for most of the above, using a filter/pipeline
  54. metaphor
  55. * benchmarks and validation testing
  56. * x86, x86-64 (x64), MMX, and SSE2 assembly code for the most commonly used
  57. algorithms, with run-time CPU feature detection and code selection
  58. * some versions are available in FIPS 140-2 validated form
  59. You are welcome to use it for any purpose without paying me, but see
  60. License.txt for the fine print.
  61. The following compilers are supported for this release. Please visit
  62. http://www.cryptopp.com the most up to date build instructions and porting notes.
  63. * MSVC 6.0 - 2010
  64. * GCC 3.3 - 4.5
  65. * C++Builder 2010
  66. * Intel C++ Compiler 9 - 11.1
  67. * Sun Studio 12u1, Express 11/08, Express 06/10
  68. *** Important Usage Notes ***
  69. 1. If a constructor for A takes a pointer to an object B (except primitive
  70. types such as int and char), then A owns B and will delete B at A's
  71. destruction. If a constructor for A takes a reference to an object B,
  72. then the caller retains ownership of B and should not destroy it until
  73. A no longer needs it.
  74. 2. Crypto++ is thread safe at the class level. This means you can use
  75. Crypto++ safely in a multithreaded application, but you must provide
  76. synchronization when multiple threads access a common Crypto++ object.
  77. *** MSVC-Specific Information ***
  78. On Windows, Crypto++ can be compiled into 3 forms: a static library
  79. including all algorithms, a DLL with only FIPS Approved algorithms, and
  80. a static library with only algorithms not in the DLL.
  81. (FIPS Approved means Approved according to the FIPS 140-2 standard.)
  82. The DLL may be used by itself, or it may be used together with the second
  83. form of the static library. MSVC project files are included to build
  84. all three forms, and sample applications using each of the three forms
  85. are also included.
  86. To compile Crypto++ with MSVC, open the "cryptest.dsw" (for MSVC 6 and MSVC .NET
  87. 2003) or "cryptest.sln" (for MSVC 2005 - 2010) workspace file and build one or
  88. more of the following projects:
  89. cryptopp - This builds the DLL. Please note that if you wish to use Crypto++
  90. as a FIPS validated module, you must use a pre-built DLL that has undergone
  91. the FIPS validation process instead of building your own.
  92. dlltest - This builds a sample application that only uses the DLL.
  93. cryptest Non-DLL-Import Configuration - This builds the full static library
  94. along with a full test driver.
  95. cryptest DLL-Import Configuration - This builds a static library containing
  96. only algorithms not in the DLL, along with a full test driver that uses
  97. both the DLL and the static library.
  98. To use the Crypto++ DLL in your application, #include "dll.h" before including
  99. any other Crypto++ header files, and place the DLL in the same directory as
  100. your .exe file. dll.h includes the line #pragma comment(lib, "cryptopp")
  101. so you don't have to explicitly list the import library in your project
  102. settings. To use a static library form of Crypto++, make the "cryptlib"
  103. project a dependency of your application project, or specify it as
  104. an additional library to link with in your project settings.
  105. In either case you should check the compiler options to
  106. make sure that the library and your application are using the same C++
  107. run-time libraries and calling conventions.
  108. *** DLL Memory Management ***
  109. Because it's possible for the Crypto++ DLL to delete objects allocated
  110. by the calling application, they must use the same C++ memory heap. Three
  111. methods are provided to achieve this.
  112. 1. The calling application can tell Crypto++ what heap to use. This method
  113. is required when the calling application uses a non-standard heap.
  114. 2. Crypto++ can tell the calling application what heap to use. This method
  115. is required when the calling application uses a statically linked C++ Run
  116. Time Library. (Method 1 does not work in this case because the Crypto++ DLL
  117. is initialized before the calling application's heap is initialized.)
  118. 3. Crypto++ can automatically use the heap provided by the calling application's
  119. dynamically linked C++ Run Time Library. The calling application must
  120. make sure that the dynamically linked C++ Run Time Library is initialized
  121. before Crypto++ is loaded. (At this time it is not clear if it is possible
  122. to control the order in which DLLs are initialized on Windows 9x machines,
  123. so it might be best to avoid using this method.)
  124. When Crypto++ attaches to a new process, it searches all modules loaded
  125. into the process space for exported functions "GetNewAndDeleteForCryptoPP"
  126. and "SetNewAndDeleteFromCryptoPP". If one of these functions is found,
  127. Crypto++ uses methods 1 or 2, respectively, by calling the function.
  128. Otherwise, method 3 is used.
  129. *** GCC-Specific Information ***
  130. A makefile is included for you to compile Crypto++ with GCC. Make sure
  131. you are using GNU Make and GNU ld. The make process will produce two files,
  132. libcryptopp.a and cryptest.exe. Run "cryptest.exe v" for the validation
  133. suite.
  134. *** Documentation and Support ***
  135. Crypto++ is documented through inline comments in header files, which are
  136. processed through Doxygen to produce an HTML reference manual. You can find
  137. a link to the manual from http://www.cryptopp.com. Also at that site is
  138. the Crypto++ FAQ, which you should browse through before attempting to
  139. use this library, because it will likely answer many of questions that
  140. may come up.
  141. If you run into any problems, please try the Crypto++ mailing list.
  142. The subscription information and the list archive are available on
  143. http://www.cryptopp.com. You can also email me directly by visiting
  144. http://www.weidai.com, but you will probably get a faster response through
  145. the mailing list.
  146. *** History ***
  147. 1.0 - First public release. Withdrawn at the request of RSA DSI.
  148. - included Blowfish, BBS, DES, DH, Diamond, DSA, ElGamal, IDEA,
  149. MD5, RC4, RC5, RSA, SHA, WAKE, secret sharing, DEFLATE compression
  150. - had a serious bug in the RSA key generation code.
  151. 1.1 - Removed RSA, RC4, RC5
  152. - Disabled calls to RSAREF's non-public functions
  153. - Minor bugs fixed
  154. 2.0 - a completely new, faster multiprecision integer class
  155. - added MD5-MAC, HAVAL, 3-WAY, TEA, SAFER, LUC, Rabin, BlumGoldwasser,
  156. elliptic curve algorithms
  157. - added the Lucas strong probable primality test
  158. - ElGamal encryption and signature schemes modified to avoid weaknesses
  159. - Diamond changed to Diamond2 because of key schedule weakness
  160. - fixed bug in WAKE key setup
  161. - SHS class renamed to SHA
  162. - lots of miscellaneous optimizations
  163. 2.1 - added Tiger, HMAC, GOST, RIPE-MD160, LUCELG, LUCDIF, XOR-MAC,
  164. OAEP, PSSR, SHARK
  165. - added precomputation to DH, ElGamal, DSA, and elliptic curve algorithms
  166. - added back RC5 and a new RSA
  167. - optimizations in elliptic curves over GF(p)
  168. - changed Rabin to use OAEP and PSSR
  169. - changed many classes to allow copy constructors to work correctly
  170. - improved exception generation and handling
  171. 2.2 - added SEAL, CAST-128, Square
  172. - fixed bug in HAVAL (padding problem)
  173. - fixed bug in triple-DES (decryption order was reversed)
  174. - fixed bug in RC5 (couldn't handle key length not a multiple of 4)
  175. - changed HMAC to conform to RFC-2104 (which is not compatible
  176. with the original HMAC)
  177. - changed secret sharing and information dispersal to use GF(2^32)
  178. instead of GF(65521)
  179. - removed zero knowledge prover/verifier for graph isomorphism
  180. - removed several utility classes in favor of the C++ standard library
  181. 2.3 - ported to EGCS
  182. - fixed incomplete workaround of min/max conflict in MSVC
  183. 3.0 - placed all names into the "CryptoPP" namespace
  184. - added MD2, RC2, RC6, MARS, RW, DH2, MQV, ECDHC, CBC-CTS
  185. - added abstract base classes PK_SimpleKeyAgreementDomain and
  186. PK_AuthenticatedKeyAgreementDomain
  187. - changed DH and LUCDIF to implement the PK_SimpleKeyAgreementDomain
  188. interface and to perform domain parameter and key validation
  189. - changed interfaces of PK_Signer and PK_Verifier to sign and verify
  190. messages instead of message digests
  191. - changed OAEP to conform to PKCS#1 v2.0
  192. - changed benchmark code to produce HTML tables as output
  193. - changed PSSR to track IEEE P1363a
  194. - renamed ElGamalSignature to NR and changed it to track IEEE P1363
  195. - renamed ECKEP to ECMQVC and changed it to track IEEE P1363
  196. - renamed several other classes for clarity
  197. - removed support for calling RSAREF
  198. - removed option to compile old SHA (SHA-0)
  199. - removed option not to throw exceptions
  200. 3.1 - added ARC4, Rijndael, Twofish, Serpent, CBC-MAC, DMAC
  201. - added interface for querying supported key lengths of symmetric ciphers
  202. and MACs
  203. - added sample code for RSA signature and verification
  204. - changed CBC-CTS to be compatible with RFC 2040
  205. - updated SEAL to version 3.0 of the cipher specification
  206. - optimized multiprecision squaring and elliptic curves over GF(p)
  207. - fixed bug in MARS key setup
  208. - fixed bug with attaching objects to Deflator
  209. 3.2 - added DES-XEX3, ECDSA, DefaultEncryptorWithMAC
  210. - renamed DES-EDE to DES-EDE2 and TripleDES to DES-EDE3
  211. - optimized ARC4
  212. - generalized DSA to allow keys longer than 1024 bits
  213. - fixed bugs in GF2N and ModularArithmetic that can cause calculation errors
  214. - fixed crashing bug in Inflator when given invalid inputs
  215. - fixed endian bug in Serpent
  216. - fixed padding bug in Tiger
  217. 4.0 - added Skipjack, CAST-256, Panama, SHA-2 (SHA-256, SHA-384, and SHA-512),
  218. and XTR-DH
  219. - added a faster variant of Rabin's Information Dispersal Algorithm (IDA)
  220. - added class wrappers for these operating system features:
  221. - high resolution timers on Windows, Unix, and MacOS
  222. - Berkeley and Windows style sockets
  223. - Windows named pipes
  224. - /dev/random and /dev/urandom on Linux and FreeBSD
  225. - Microsoft's CryptGenRandom on Windows
  226. - added support for SEC 1 elliptic curve key format and compressed points
  227. - added support for X.509 public key format (subjectPublicKeyInfo) for
  228. RSA, DSA, and elliptic curve schemes
  229. - added support for DER and OpenPGP signature format for DSA
  230. - added support for ZLIB compressed data format (RFC 1950)
  231. - changed elliptic curve encryption to use ECIES (as defined in SEC 1)
  232. - changed MARS key schedule to reflect the latest specification
  233. - changed BufferedTransformation interface to support multiple channels
  234. and messages
  235. - changed CAST and SHA-1 implementations to use public domain source code
  236. - fixed bug in StringSource
  237. - optmized multi-precision integer code for better performance
  238. 4.1 - added more support for the recommended elliptic curve parameters in SEC 2
  239. - added Panama MAC, MARC4
  240. - added IV stealing feature to CTS mode
  241. - added support for PKCS #8 private key format for RSA, DSA, and elliptic
  242. curve schemes
  243. - changed Deflate, MD5, Rijndael, and Twofish to use public domain code
  244. - fixed a bug with flushing compressed streams
  245. - fixed a bug with decompressing stored blocks
  246. - fixed a bug with EC point decompression using non-trinomial basis
  247. - fixed a bug in NetworkSource::GeneralPump()
  248. - fixed a performance issue with EC over GF(p) decryption
  249. - fixed syntax to allow GCC to compile without -fpermissive
  250. - relaxed some restrictions in the license
  251. 4.2 - added support for longer HMAC keys
  252. - added MD4 (which is not secure so use for compatibility purposes only)
  253. - added compatibility fixes/workarounds for STLport 4.5, GCC 3.0.2,
  254. and MSVC 7.0
  255. - changed MD2 to use public domain code
  256. - fixed a bug with decompressing multiple messages with the same object
  257. - fixed a bug in CBC-MAC with MACing multiple messages with the same object
  258. - fixed a bug in RC5 and RC6 with zero-length keys
  259. - fixed a bug in Adler32 where incorrect checksum may be generated
  260. 5.0 - added ESIGN, DLIES, WAKE-OFB, PBKDF1 and PBKDF2 from PKCS #5
  261. - added key validation for encryption and signature public/private keys
  262. - renamed StreamCipher interface to SymmetricCipher, which is now implemented
  263. by both stream ciphers and block cipher modes including ECB and CBC
  264. - added keying interfaces to support resetting of keys and IVs without
  265. having to destroy and recreate objects
  266. - changed filter interface to support non-blocking input/output
  267. - changed SocketSource and SocketSink to use overlapped I/O on Microsoft Windows
  268. - grouped related classes inside structs to help templates, for example
  269. AESEncryption and AESDecryption are now AES::Encryption and AES::Decryption
  270. - where possible, typedefs have been added to improve backwards
  271. compatibility when the CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY macro is defined
  272. - changed Serpent, HAVAL and IDEA to use public domain code
  273. - implemented SSE2 optimizations for Integer operations
  274. - fixed a bug in HMAC::TruncatedFinal()
  275. - fixed SKIPJACK byte ordering following NIST clarification dated 5/9/02
  276. 5.01 - added known answer test for X9.17 RNG in FIPS 140 power-up self test
  277. - submitted to NIST/CSE, but not publicly released
  278. 5.02 - changed EDC test to MAC integrity check using HMAC/SHA1
  279. - improved performance of integrity check
  280. - added blinding to defend against RSA timing attack
  281. 5.03 - created DLL version of Crypto++ for FIPS 140-2 validation
  282. - fixed vulnerabilities in GetNextIV for CTR and OFB modes
  283. 5.0.4 - Removed DES, SHA-256, SHA-384, SHA-512 from DLL
  284. 5.1 - added PSS padding and changed PSSR to track IEEE P1363a draft standard
  285. - added blinding for RSA and Rabin to defend against timing attacks
  286. on decryption operations
  287. - changed signing and decryption APIs to support the above
  288. - changed WaitObjectContainer to allow waiting for more than 64
  289. objects at a time on Win32 platforms
  290. - fixed a bug in CBC and ECB modes with processing non-aligned data
  291. - fixed standard conformance bugs in DLIES (DHAES mode) and RW/EMSA2
  292. signature scheme (these fixes are not backwards compatible)
  293. - fixed a number of compiler warnings, minor bugs, and portability problems
  294. - removed Sapphire
  295. 5.2 - merged in changes for 5.01 - 5.0.4
  296. - added support for using encoding parameters and key derivation parameters
  297. with public key encryption (implemented by OAEP and DL/ECIES)
  298. - added Camellia, SHACAL-2, Two-Track-MAC, Whirlpool, RIPEMD-320,
  299. RIPEMD-128, RIPEMD-256, Base-32 coding, FIPS variant of CFB mode
  300. - added ThreadUserTimer for timing thread CPU usage
  301. - added option for password-based key derivation functions
  302. to iterate until a mimimum elapsed thread CPU time is reached
  303. - added option (on by default) for DEFLATE compression to detect
  304. uncompressible files and process them more quickly
  305. - improved compatibility and performance on 64-bit platforms,
  306. including Alpha, IA-64, x86-64, PPC64, Sparc64, and MIPS64
  307. - fixed ONE_AND_ZEROS_PADDING to use 0x80 instead 0x01 as padding.
  308. - fixed encoding/decoding of PKCS #8 privateKeyInfo to properly
  309. handle optional attributes
  310. 5.2.1 - fixed bug in the "dlltest" DLL testing program
  311. - fixed compiling with STLport using VC .NET
  312. - fixed compiling with -fPIC using GCC
  313. - fixed compiling with -msse2 on systems without memalign()
  314. - fixed inability to instantiate PanamaMAC
  315. - fixed problems with inline documentation
  316. 5.2.2 - added SHA-224
  317. - put SHA-256, SHA-384, SHA-512, RSASSA-PSS into DLL
  318. 5.2.3 - fixed issues with FIPS algorithm test vectors
  319. - put RSASSA-ISO into DLL
  320. 5.3 - ported to MSVC 2005 with support for x86-64
  321. - added defense against AES timing attacks, and more AES test vectors
  322. - changed StaticAlgorithmName() of Rijndael to "AES", CTR to "CTR"
  323. 5.4 - added Salsa20
  324. - updated Whirlpool to version 3.0
  325. - ported to GCC 4.1, Sun C++ 5.8, and Borland C++Builder 2006
  326. 5.5 - added VMAC and Sosemanuk (with x86-64 and SSE2 assembly)
  327. - improved speed of integer arithmetic, AES, SHA-512, Tiger, Salsa20,
  328. Whirlpool, and PANAMA cipher using assembly (x86-64, MMX, SSE2)
  329. - optimized Camellia and added defense against timing attacks
  330. - updated benchmarks code to show cycles per byte and to time key/IV setup
  331. - started using OpenMP for increased multi-core speed
  332. - enabled GCC optimization flags by default in GNUmakefile
  333. - added blinding and computational error checking for RW signing
  334. - changed RandomPool, X917RNG, GetNextIV, DSA/NR/ECDSA/ECNR to reduce
  335. the risk of reusing random numbers and IVs after virtual machine state
  336. rollback
  337. - changed default FIPS mode RNG from AutoSeededX917RNG<DES_EDE3> to
  338. AutoSeededX917RNG<AES>
  339. - fixed PANAMA cipher interface to accept 256-bit key and 256-bit IV
  340. - moved MD2, MD4, MD5, PanamaHash, ARC4, WAKE_CFB into the namespace "Weak"
  341. - removed HAVAL, MD5-MAC, XMAC
  342. 5.5.1 - fixed VMAC validation failure on 32-bit big-endian machines
  343. 5.5.2 - ported x64 assembly language code for AES, Salsa20, Sosemanuk, and Panama
  344. to MSVC 2005 (using MASM since MSVC doesn't support inline assembly on x64)
  345. - fixed Salsa20 initialization crash on non-SSE2 machines
  346. - fixed Whirlpool crash on Pentium 2 machines
  347. - fixed possible branch prediction analysis (BPA) vulnerability in
  348. MontgomeryReduce(), which may affect security of RSA, RW, LUC
  349. - fixed link error with MSVC 2003 when using "debug DLL" form of runtime library
  350. - fixed crash in SSE2_Add on P4 machines when compiled with
  351. MSVC 6.0 SP5 with Processor Pack
  352. - ported to MSVC 2008, GCC 4.2, Sun CC 5.9, Intel C++ Compiler 10.0,
  353. and Borland C++Builder 2007
  354. 5.6.0 - added AuthenticatedSymmetricCipher interface class and Filter wrappers
  355. - added CCM, GCM (with SSE2 assembly), EAX, CMAC, XSalsa20, and SEED
  356. - added support for variable length IVs
  357. - added OIDs for Brainpool elliptic curve parameters
  358. - improved AES and SHA-256 speed on x86 and x64
  359. - changed BlockTransformation interface to no longer assume data alignment
  360. - fixed incorrect VMAC computation on message lengths
  361. that are >64 mod 128 (x86 assembly version is not affected)
  362. - fixed compiler error in vmac.cpp on x86 with GCC -fPIC
  363. - fixed run-time validation error on x86-64 with GCC 4.3.2 -O2
  364. - fixed HashFilter bug when putMessage=true
  365. - fixed AES-CTR data alignment bug that causes incorrect encryption on ARM
  366. - removed WORD64_AVAILABLE; compiler support for 64-bit int is now required
  367. - ported to GCC 4.3, C++Builder 2009, Sun CC 5.10, Intel C++ Compiler 11
  368. 5.6.1 - added support for AES-NI and CLMUL instruction sets in AES and GMAC/GCM
  369. - removed WAKE-CFB
  370. - fixed several bugs in the SHA-256 x86/x64 assembly code:
  371. * incorrect hash on non-SSE2 x86 machines on non-aligned input
  372. * incorrect hash on x86 machines when input crosses 0x80000000
  373. * incorrect hash on x64 when compiled with GCC with optimizations enabled
  374. - fixed bugs in AES x86 and x64 assembly causing crashes in some MSVC build configurations
  375. - switched to a public domain implementation of MARS
  376. - ported to MSVC 2010, GCC 4.5.1, Sun Studio 12u1, C++Builder 2010, Intel C++ Compiler 11.1
  377. - renamed the MSVC DLL project to "cryptopp" for compatibility with MSVC 2010
  378. Written by Wei Dai