Botan 3.7.1
Crypto and TLS for C&
types.h
Go to the documentation of this file.
1/*
2* Low Level Types
3* (C) 1999-2007 Jack Lloyd
4* (C) 2015 Simon Warta (Kullo GmbH)
5* (C) 2016 René Korthaus, Rohde & Schwarz Cybersecurity
6*
7* Botan is released under the Simplified BSD License (see license.txt)
8*/
9
10#ifndef BOTAN_TYPES_H_
11#define BOTAN_TYPES_H_
12
13#include <botan/api.h> // IWYU pragma: export
14#include <botan/build.h> // IWYU pragma: export
15#include <cstddef> // IWYU pragma: export
16#include <cstdint> // IWYU pragma: export
17#include <memory> // IWYU pragma: export
18
19/**
20* MSVC does define __cplusplus but pins it at 199711L, because "legacy".
21* Note: There is a compiler switch to enable standard behavior (/Zc:__cplusplus),
22* but we can't control that in downstream applications.
23*
24* See: https://learn.microsoft.com/en-us/cpp/build/reference/zc-cplusplus
25*/
26#if defined(_MSVC_LANG)
27 #define BOTAN_CPLUSPLUS _MSVC_LANG
28#else
29 #define BOTAN_CPLUSPLUS __cplusplus
30#endif
31
32#if BOTAN_CPLUSPLUS < 202002L
33 #error "Botan 3.x requires at least C++20"
34#endif
35
36namespace Botan {
37
38/**
39* @mainpage Botan Crypto Library API Reference
40*
41* <dl>
42* <dt>Abstract Base Classes<dd>
43* BlockCipher, HashFunction, KDF, MessageAuthenticationCode, RandomNumberGenerator,
44* StreamCipher, SymmetricAlgorithm, AEAD_Mode, Cipher_Mode, XOF
45* <dt>Public Key Interface Classes<dd>
46* PK_Key_Agreement, PK_Signer, PK_Verifier, PK_Encryptor, PK_Decryptor, PK_KEM_Encryptor, PK_KEM_Decryptor
47* <dt>Authenticated Encryption Modes<dd>
48* @ref CCM_Mode "CCM", @ref ChaCha20Poly1305_Mode "ChaCha20Poly1305", @ref EAX_Mode "EAX",
49* @ref GCM_Mode "GCM", @ref OCB_Mode "OCB", @ref SIV_Mode "SIV"
50* <dt>Block Ciphers<dd>
51* @ref aria.h "ARIA", @ref aes.h "AES", @ref Blowfish, @ref camellia.h "Camellia", @ref Cascade_Cipher "Cascade",
52* @ref CAST_128 "CAST-128", @ref CAST_128 DES, @ref TripleDES "3DES",
53* @ref GOST_28147_89 "GOST 28147-89", IDEA, Kuznyechik, Lion, Noekeon, SEED, Serpent, SHACAL2, SM4,
54* @ref Threefish_512 "Threefish", Twofish
55* <dt>Stream Ciphers<dd>
56* ChaCha, @ref CTR_BE "CTR", OFB, RC4, Salsa20
57* <dt>Hash Functions<dd>
58* BLAKE2b, @ref GOST_34_11 "GOST 34.11", @ref Keccak_1600 "Keccak", MD4, MD5, @ref RIPEMD_160 "RIPEMD-160",
59* @ref SHA_1 "SHA-1", @ref SHA_224 "SHA-224", @ref SHA_256 "SHA-256", @ref SHA_384 "SHA-384",
60* @ref SHA_512 "SHA-512", @ref Skein_512 "Skein-512", SM3, Streebog, Whirlpool
61* <dt>Non-Cryptographic Checksums<dd>
62* Adler32, CRC24, CRC32
63* <dt>Message Authentication Codes<dd>
64* @ref BLAKE2bMAC "BLAKE2b", CMAC, HMAC, KMAC, Poly1305, SipHash, ANSI_X919_MAC
65* <dt>Random Number Generators<dd>
66* AutoSeeded_RNG, HMAC_DRBG, Processor_RNG, System_RNG
67* <dt>Key Derivation<dd>
68* HKDF, @ref KDF1 "KDF1 (IEEE 1363)", @ref KDF1_18033 "KDF1 (ISO 18033-2)", @ref KDF2 "KDF2 (IEEE 1363)",
69* @ref sp800_108.h "SP800-108", @ref SP800_56C "SP800-56C", @ref PKCS5_PBKDF2 "PBKDF2 (PKCS#5)"
70* <dt>Password Hashing<dd>
71* @ref argon2.h "Argon2", @ref scrypt.h "scrypt", @ref bcrypt.h "bcrypt", @ref passhash9.h "passhash9"
72* <dt>Public Key Cryptosystems<dd>
73* @ref dlies.h "DLIES", @ref ecies.h "ECIES", @ref elgamal.h "ElGamal",
74* @ref rsa.h "RSA", @ref mceliece.h "McEliece", @ref sm2.h "SM2"
75* <dt>Key Encapsulation Mechanisms<dd>
76* @ref cmce.h "Classic McEliece", @ref frodokem.h "FrodoKEM", @ref kyber.h "ML-KEM/Kyber", @ref rsa.h "RSA"
77* <dt>Public Key Signature Schemes<dd>
78* @ref dsa.h "DSA", @ref dilithium.h "ML-DSA/Dilithium", @ref ecdsa.h "ECDSA", @ref ecgdsa.h "ECGDSA",
79* @ref eckcdsa.h "ECKCDSA", @ref gost_3410.h "GOST 34.10-2001", @ref hss_lms.h "HSS/LMS", @ref sm2.h "SM2",
80 @ref sphincsplus.h "SLH-DSA/SPHINCS+", @ref xmss.h "XMSS"
81* <dt>Key Agreement<dd>
82* @ref dh.h "DH", @ref ecdh.h "ECDH"
83* <dt>Compression<dd>
84* @ref bzip2.h "bzip2", @ref lzma.h "lzma", @ref zlib.h "zlib"
85* <dt>TLS<dd>
86* TLS::Client, TLS::Server, TLS::Policy, TLS::Protocol_Version, TLS::Callbacks, TLS::Ciphersuite,
87* TLS::Session, TLS::Session_Summary, TLS::Session_Manager, Credentials_Manager
88* <dt>X.509<dd>
89* X509_Certificate, X509_CRL, X509_CA, Certificate_Extension, PKCS10_Request, X509_Cert_Options,
90* Certificate_Store, Certificate_Store_In_SQL, Certificate_Store_In_SQLite
91* <dt>eXtendable Output Functions<dd>
92* @ref SHAKE_XOF "SHAKE"
93* </dl>
94*/
95
96using std::int32_t;
97using std::int64_t;
98using std::size_t;
99using std::uint16_t;
100using std::uint32_t;
101using std::uint64_t;
102using std::uint8_t;
103
104#if !defined(BOTAN_IS_BEING_BUILT)
105/*
106* These typedefs are no longer used within the library headers
107* or code. They are kept only for compatibility with software
108* written against older versions.
109*/
110using byte = std::uint8_t;
111using u16bit = std::uint16_t;
112using u32bit = std::uint32_t;
113using u64bit = std::uint64_t;
114using s32bit = std::int32_t;
115#endif
116
117#if(BOTAN_MP_WORD_BITS == 32)
118typedef uint32_t word;
119#elif(BOTAN_MP_WORD_BITS == 64)
120typedef uint64_t word;
121#else
122 #error BOTAN_MP_WORD_BITS must be 32 or 64
123#endif
124
125#if defined(__SIZEOF_INT128__) && defined(BOTAN_TARGET_CPU_HAS_NATIVE_64BIT)
126 #define BOTAN_TARGET_HAS_NATIVE_UINT128
127
128// GCC complains if this isn't marked with __extension__
129__extension__ typedef unsigned __int128 uint128_t;
130#endif
131
132/*
133* Should this assert fail on your system please contact the developers
134* for assistance in porting.
135*/
136static_assert(sizeof(std::size_t) == 8 || sizeof(std::size_t) == 4, "This platform has an unexpected size for size_t");
137
138} // namespace Botan
139
140#endif
std::int32_t s32bit
Definition types.h:114
std::uint32_t u32bit
Definition types.h:112
std::uint16_t u16bit
Definition types.h:111
std::uint8_t byte
Definition types.h:110
std::uint64_t u64bit
Definition types.h:113