Botan  2.10.0
Crypto and TLS for C++11
Namespaces | Classes | Typedefs | Enumerations | Functions | Variables
Botan Namespace Reference

Namespaces

 ARIA_F
 
 ASN1
 
 Camellia_F
 
 Cert_Extension
 
 Charset
 
 CryptoBox
 
 CT
 
 FPE
 
 HTTP
 
 KeyPair
 
 OCSP
 
 OIDS
 
 OS
 
 PEM_Code
 
 PK_Ops
 
 PKCS11
 
 PKCS8
 
 PKIX
 
 SHA1_F
 
 SHA1_SSE2_F
 
 stlCompatibilityDetails
 
 TLS
 
 X509
 

Classes

class  AEAD_Filter
 
class  Allocator_Initializer
 
class  Atomic
 
class  Barrier
 
class  BearSSL_Error
 
class  Block_Cipher_Fixed_Params
 
class  CECPQ1_key
 
struct  CommonCryptor_Opts
 
class  Compression_Alloc_Info
 
class  Compression_Stream
 
class  CurveGFp
 
class  CurveGFp_Repr
 
class  Data_Store
 
class  Device_EntropySource
 
class  donna128
 
class  FE_25519
 
class  File_Descriptor_Source
 
class  Fixed_Window_Exponentiator
 
struct  ge_p3
 
class  Getentropy
 
class  Intel_Rdrand
 
class  Intel_Rdseed
 
class  lock_guard
 
class  Memory_Pool
 
class  Montgomery_Exponentiator
 
class  Montgomery_Int
 
class  Montgomery_Params
 
class  newhope_poly
 
class  noop_mutex
 
class  Output_Buffers
 
class  PointGFp_Base_Point_Precompute
 
class  PointGFp_Multi_Point_Precompute
 
class  PointGFp_Var_Point_Precompute
 
class  polyn_gf2m
 
class  ProcWalking_EntropySource
 
class  secure_allocator
 
class  Semaphore
 
class  SIMD_4x32
 
class  SIMD_8x32
 
class  Stream_Compression
 
class  Stream_Decompression
 
class  Thread_Pool
 
class  Timer
 
class  UUID
 
class  Win32_EntropySource
 
class  XMSS_Address
 
class  XMSS_Common_Ops
 
class  XMSS_Hash
 
class  XMSS_Index_Registry
 
class  XMSS_Signature
 
class  XMSS_Signature_Operation
 
class  XMSS_Tools
 
class  XMSS_Verification_Operation
 
class  XMSS_WOTS_Addressed_PrivateKey
 
class  XMSS_WOTS_Addressed_PublicKey
 
class  XMSS_WOTS_Parameters
 
class  XMSS_WOTS_PrivateKey
 
class  XMSS_WOTS_PublicKey
 
class  Zlib_Style_Stream
 

Typedefs

using byte = std::uint8_t
 
typedef std::vector< std::set< Certificate_Status_Code > > CertificatePathStatusCodes
 
typedef EC_Group EC_Domain_Params
 
typedef FE_25519 fe
 
typedef uint16_t gf2m
 
using InitializationVector = OctetString
 
template<typename T >
using lock_guard_type = lock_guard< T >
 
typedef noop_mutex mutex_type
 
typedef Private_Key PKCS8_PrivateKey
 
typedef newhope_poly poly
 
typedef RandomNumberGenerator RNG
 
typedef PBKDF S2K
 
using s32bit = std::int32_t
 
template<typename T >
using secure_deque = std::deque< T, secure_allocator< T > >
 
template<typename T >
using secure_vector = std::vector< T, secure_allocator< T > >
 
template<typename T >
using SecureVector = secure_vector< T >
 
typedef SM2_PrivateKey SM2_Encryption_PrivateKey
 
typedef SM2_PublicKey SM2_Encryption_PublicKey
 
typedef SM2_PrivateKey SM2_Signature_PrivateKey
 
typedef SM2_PublicKey SM2_Signature_PublicKey
 
using SymmetricKey = OctetString
 
typedef Transform_Filter Transformation_Filter
 
using u16bit = std::uint16_t
 
using u32bit = std::uint32_t
 
using u64bit = std::uint64_t
 
typedef std::vector< secure_vector< uint8_t > > wots_keysig_t
 
typedef Curve25519_PrivateKey X25519_PrivateKey
 
typedef Public_Key X509_PublicKey
 

Enumerations

enum  { SM3_BLOCK_BYTES = 64, SM3_DIGEST_BYTES = 32 }
 
enum  ASN1_Tag : uint32_t {
  UNIVERSAL = 0x00, APPLICATION = 0x40, CONTEXT_SPECIFIC = 0x80, CONSTRUCTED = 0x20,
  PRIVATE = CONSTRUCTED | CONTEXT_SPECIFIC, EOC = 0x00, BOOLEAN = 0x01, INTEGER = 0x02,
  BIT_STRING = 0x03, OCTET_STRING = 0x04, NULL_TAG = 0x05, OBJECT_ID = 0x06,
  ENUMERATED = 0x0A, SEQUENCE = 0x10, SET = 0x11, UTF8_STRING = 0x0C,
  NUMERIC_STRING = 0x12, PRINTABLE_STRING = 0x13, T61_STRING = 0x14, IA5_STRING = 0x16,
  VISIBLE_STRING = 0x1A, UNIVERSAL_STRING = 0x1C, BMP_STRING = 0x1E, UTC_TIME = 0x17,
  GENERALIZED_TIME = 0x18, UTC_OR_GENERALIZED_TIME = 0x19, NO_OBJECT = 0xFF00, DIRECTORY_STRING = 0xFF01
}
 
enum  Certificate_Status_Code {
  Certificate_Status_Code::OK = 0, Certificate_Status_Code::VERIFIED = 0, Certificate_Status_Code::OCSP_RESPONSE_GOOD = 1, Certificate_Status_Code::OCSP_SIGNATURE_OK = 2,
  Certificate_Status_Code::VALID_CRL_CHECKED = 3, Certificate_Status_Code::OCSP_NO_HTTP = 4, Certificate_Status_Code::FIRST_WARNING_STATUS = 500, Certificate_Status_Code::CERT_SERIAL_NEGATIVE = 500,
  Certificate_Status_Code::DN_TOO_LONG = 501, Certificate_Status_Code::OSCP_NO_REVOCATION_URL = 502, Certificate_Status_Code::OSCP_SERVER_NOT_AVAILABLE = 503, Certificate_Status_Code::FIRST_ERROR_STATUS = 1000,
  Certificate_Status_Code::SIGNATURE_METHOD_TOO_WEAK = 1000, Certificate_Status_Code::UNTRUSTED_HASH = 1001, Certificate_Status_Code::NO_REVOCATION_DATA = 1002, Certificate_Status_Code::NO_MATCHING_CRLDP = 1003,
  Certificate_Status_Code::CERT_NOT_YET_VALID = 2000, Certificate_Status_Code::CERT_HAS_EXPIRED = 2001, Certificate_Status_Code::OCSP_NOT_YET_VALID = 2002, Certificate_Status_Code::OCSP_HAS_EXPIRED = 2003,
  Certificate_Status_Code::CRL_NOT_YET_VALID = 2004, Certificate_Status_Code::CRL_HAS_EXPIRED = 2005, Certificate_Status_Code::CERT_ISSUER_NOT_FOUND = 3000, Certificate_Status_Code::CANNOT_ESTABLISH_TRUST = 3001,
  Certificate_Status_Code::CERT_CHAIN_LOOP = 3002, Certificate_Status_Code::CHAIN_LACKS_TRUST_ROOT = 3003, Certificate_Status_Code::CHAIN_NAME_MISMATCH = 3004, Certificate_Status_Code::POLICY_ERROR = 4000,
  Certificate_Status_Code::INVALID_USAGE = 4001, Certificate_Status_Code::CERT_CHAIN_TOO_LONG = 4002, Certificate_Status_Code::CA_CERT_NOT_FOR_CERT_ISSUER = 4003, Certificate_Status_Code::NAME_CONSTRAINT_ERROR = 4004,
  Certificate_Status_Code::CA_CERT_NOT_FOR_CRL_ISSUER = 4005, Certificate_Status_Code::OCSP_CERT_NOT_LISTED = 4006, Certificate_Status_Code::OCSP_BAD_STATUS = 4007, Certificate_Status_Code::CERT_NAME_NOMATCH = 4008,
  Certificate_Status_Code::UNKNOWN_CRITICAL_EXTENSION = 4009, Certificate_Status_Code::DUPLICATE_CERT_EXTENSION = 4010, Certificate_Status_Code::OCSP_SIGNATURE_ERROR = 4501, Certificate_Status_Code::OCSP_ISSUER_NOT_FOUND = 4502,
  Certificate_Status_Code::OCSP_RESPONSE_MISSING_KEYUSAGE = 4503, Certificate_Status_Code::OCSP_RESPONSE_INVALID = 4504, Certificate_Status_Code::EXT_IN_V1_V2_CERT = 4505, Certificate_Status_Code::DUPLICATE_CERT_POLICY = 4506,
  Certificate_Status_Code::CERT_IS_REVOKED = 5000, Certificate_Status_Code::CRL_BAD_SIGNATURE = 5001, Certificate_Status_Code::SIGNATURE_ERROR = 5002, Certificate_Status_Code::CERT_PUBKEY_INVALID = 5003,
  Certificate_Status_Code::SIGNATURE_ALGO_UNKNOWN = 5004, Certificate_Status_Code::SIGNATURE_ALGO_BAD_PARAMS = 5005
}
 
enum  Character_Set { LOCAL_CHARSET, UCS2_CHARSET, UTF8_CHARSET, LATIN1_CHARSET }
 
enum  Cipher_Dir : int { ENCRYPTION, DECRYPTION }
 
enum  CRL_Code : uint32_t {
  UNSPECIFIED = 0, KEY_COMPROMISE = 1, CA_COMPROMISE = 2, AFFILIATION_CHANGED = 3,
  SUPERSEDED = 4, CESSATION_OF_OPERATION = 5, CERTIFICATE_HOLD = 6, REMOVE_FROM_CRL = 8,
  PRIVLEDGE_WITHDRAWN = 9, PRIVILEGE_WITHDRAWN = 9, AA_COMPROMISE = 10, DELETE_CRL_ENTRY = 0xFF00,
  OCSP_GOOD = 0xFF01, OCSP_UNKNOWN = 0xFF02
}
 
enum  Decoder_Checking { NONE, IGNORE_WS, FULL_CHECK }
 
enum  EC_Group_Encoding { EC_DOMPAR_ENC_EXPLICIT = 0, EC_DOMPAR_ENC_IMPLICITCA = 1, EC_DOMPAR_ENC_OID = 2 }
 
enum  ECIES_Flags : uint32_t {
  ECIES_Flags::NONE = 0, ECIES_Flags::SINGLE_HASH_MODE = 1, ECIES_Flags::COFACTOR_MODE = 2, ECIES_Flags::OLD_COFACTOR_MODE = 4,
  ECIES_Flags::CHECK_MODE = 8
}
 
enum  ErrorType {
  ErrorType::Unknown = 1, ErrorType::SystemError, ErrorType::NotImplemented, ErrorType::OutOfMemory,
  ErrorType::InternalError, ErrorType::IoError, ErrorType::InvalidObjectState = 100, ErrorType::KeyNotSet,
  ErrorType::InvalidArgument, ErrorType::InvalidKeyLength, ErrorType::InvalidNonceLength, ErrorType::LookupError,
  ErrorType::EncodingFailure, ErrorType::DecodingFailure, ErrorType::TLSError, ErrorType::HttpError,
  ErrorType::InvalidTag, ErrorType::OpenSSLError = 200, ErrorType::CommonCryptoError, ErrorType::Pkcs11Error,
  ErrorType::TPMError, ErrorType::ZlibError = 300, ErrorType::Bzip2Error, ErrorType::LzmaError
}
 
enum  Key_Constraints {
  NO_CONSTRAINTS = 0, DIGITAL_SIGNATURE = 1 << 15, NON_REPUDIATION = 1 << 14, KEY_ENCIPHERMENT = 1 << 13,
  DATA_ENCIPHERMENT = 1 << 12, KEY_AGREEMENT = 1 << 11, KEY_CERT_SIGN = 1 << 10, CRL_SIGN = 1 << 9,
  ENCIPHER_ONLY = 1 << 8, DECIPHER_ONLY = 1 << 7
}
 
enum  Newhope_Mode { Newhope_Mode::SHA3, Newhope_Mode::BoringSSL }
 
enum  Newhope_Params {
  NEWHOPE_SENDABYTES = 1824, NEWHOPE_SENDBBYTES = 2048, NEWHOPE_OFFER_BYTES = 1824, NEWHOPE_ACCEPT_BYTES = 2048,
  NEWHOPE_SHARED_KEY_BYTES = 32, NEWHOPE_SEED_BYTES = 32, NEWHOPE_POLY_BYTES = 1792, CECPQ1_OFFER_BYTES = NEWHOPE_OFFER_BYTES + 32,
  CECPQ1_ACCEPT_BYTES = NEWHOPE_ACCEPT_BYTES + 32, CECPQ1_SHARED_KEY_BYTES = NEWHOPE_SHARED_KEY_BYTES + 32
}
 
enum  Signature_Format { IEEE_1363, DER_SEQUENCE }
 
enum  TPM_Storage_Type { TPM_Storage_Type::User, TPM_Storage_Type::System }
 
enum  Usage_Type {
  Usage_Type::UNSPECIFIED, Usage_Type::TLS_SERVER_AUTH, Usage_Type::TLS_CLIENT_AUTH, Usage_Type::CERTIFICATE_AUTHORITY,
  Usage_Type::OCSP_RESPONDER
}
 
enum  X509_Encoding { RAW_BER, PEM }
 

Functions

BigInt abs (const BigInt &n)
 
BOTAN_MALLOC_FN void * allocate_memory (size_t elems, size_t elem_size)
 
size_t almost_montgomery_inverse (BigInt &result, const BigInt &a, const BigInt &p)
 
void aont_package (RandomNumberGenerator &rng, BlockCipher *cipher, const uint8_t input[], size_t input_len, uint8_t output[])
 
void aont_unpackage (BlockCipher *cipher, const uint8_t input[], size_t input_len, uint8_t output[])
 
std::string asn1_class_to_string (ASN1_Tag type)
 
std::string asn1_tag_to_string (ASN1_Tag type)
 
void assertion_failure (const char *expr_str, const char *assertion_made, const char *func, const char *file, int line)
 
size_t base32_decode (uint8_t out[], const char in[], size_t input_length, size_t &input_consumed, bool final_inputs, bool ignore_ws)
 
size_t base32_decode (uint8_t output[], const char input[], size_t input_length, bool ignore_ws)
 
size_t base32_decode (uint8_t output[], const std::string &input, bool ignore_ws)
 
secure_vector< uint8_t > base32_decode (const char input[], size_t input_length, bool ignore_ws)
 
secure_vector< uint8_t > base32_decode (const std::string &input, bool ignore_ws)
 
template<typename Alloc >
std::string base32_encode (const std::vector< uint8_t, Alloc > &input)
 
size_t base32_encode (char out[], const uint8_t in[], size_t input_length, size_t &input_consumed, bool final_inputs)
 
std::string base32_encode (const uint8_t input[], size_t input_length)
 
std::vector< uint8_t > base58_check_decode (const std::string &s)
 
std::vector< uint8_t > base58_check_decode (const char input[], size_t input_length)
 
template<typename Alloc >
std::string base58_check_encode (const std::vector< uint8_t, Alloc > &vec)
 
std::string base58_check_encode (const uint8_t input[], size_t input_length)
 
std::vector< uint8_t > base58_decode (const std::string &s)
 
std::vector< uint8_t > base58_decode (const char input[], size_t input_length)
 
template<typename Alloc >
std::string base58_encode (const std::vector< uint8_t, Alloc > &vec)
 
std::string base58_encode (const uint8_t input[], size_t input_length)
 
size_t base64_decode (uint8_t out[], const char in[], size_t input_length, size_t &input_consumed, bool final_inputs, bool ignore_ws)
 
size_t base64_decode (uint8_t output[], const char input[], size_t input_length, bool ignore_ws)
 
size_t base64_decode (uint8_t output[], const std::string &input, bool ignore_ws)
 
secure_vector< uint8_t > base64_decode (const char input[], size_t input_length, bool ignore_ws)
 
secure_vector< uint8_t > base64_decode (const std::string &input, bool ignore_ws)
 
size_t base64_decode_max_output (size_t input_length)
 
template<typename Alloc >
std::string base64_encode (const std::vector< uint8_t, Alloc > &input)
 
size_t base64_encode (char out[], const uint8_t in[], size_t input_length, size_t &input_consumed, bool final_inputs)
 
std::string base64_encode (const uint8_t input[], size_t input_length)
 
size_t base64_encode_max_output (size_t input_length)
 
template<typename Base >
size_t base_decode (Base &&base, uint8_t output[], const char input[], size_t input_length, size_t &input_consumed, bool final_inputs, bool ignore_ws=true)
 
template<typename Base >
size_t base_decode_full (Base &&base, uint8_t output[], const char input[], size_t input_length, bool ignore_ws)
 
template<typename Vector , typename Base >
Vector base_decode_to_vec (Base &&base, const char input[], size_t input_length, bool ignore_ws)
 
template<class Base >
size_t base_encode (Base &&base, char output[], const uint8_t input[], size_t input_length, size_t &input_consumed, bool final_inputs)
 
template<typename Base >
std::string base_encode_to_string (Base &&base, const uint8_t input[], size_t input_length)
 
void bigint_add2 (word x[], size_t x_size, const word y[], size_t y_size)
 
word bigint_add2_nc (word x[], size_t x_size, const word y[], size_t y_size)
 
void bigint_add3 (word z[], const word x[], size_t x_size, const word y[], size_t y_size)
 
word bigint_add3_nc (word z[], const word x[], size_t x_size, const word y[], size_t y_size)
 
int32_t bigint_cmp (const word x[], size_t x_size, const word y[], size_t y_size)
 
void bigint_cnd_abs (word cnd, word x[], size_t size)
 
word bigint_cnd_add (word cnd, word x[], word x_size, const word y[], size_t y_size)
 
word bigint_cnd_add (word cnd, word x[], const word y[], size_t size)
 
void bigint_cnd_add_or_sub (CT::Mask< word > mask, word x[], const word y[], size_t size)
 
word bigint_cnd_addsub (CT::Mask< word > mask, word x[], const word y[], const word z[], size_t size)
 
word bigint_cnd_sub (word cnd, word x[], size_t x_size, const word y[], size_t y_size)
 
word bigint_cnd_sub (word cnd, word x[], const word y[], size_t size)
 
void bigint_cnd_swap (word cnd, word x[], word y[], size_t size)
 
void bigint_comba_mul16 (word z[32], const word x[16], const word y[16])
 
void bigint_comba_mul24 (word z[48], const word x[24], const word y[24])
 
void bigint_comba_mul4 (word z[8], const word x[4], const word y[4])
 
void bigint_comba_mul6 (word z[12], const word x[6], const word y[6])
 
void bigint_comba_mul8 (word z[16], const word x[8], const word y[8])
 
void bigint_comba_mul9 (word z[18], const word x[9], const word y[9])
 
void bigint_comba_sqr16 (word z[32], const word x[16])
 
void bigint_comba_sqr24 (word z[48], const word x[24])
 
void bigint_comba_sqr4 (word z[8], const word x[4])
 
void bigint_comba_sqr6 (word z[12], const word x[6])
 
void bigint_comba_sqr8 (word z[16], const word x[8])
 
void bigint_comba_sqr9 (word z[18], const word x[9])
 
CT::Mask< word > bigint_ct_is_eq (const word x[], size_t x_size, const word y[], size_t y_size)
 
CT::Mask< word > bigint_ct_is_lt (const word x[], size_t x_size, const word y[], size_t y_size, bool lt_or_equal=false)
 
word bigint_divop (word n1, word n0, word d)
 
void bigint_linmul2 (word x[], size_t x_size, word y)
 
void bigint_linmul3 (word z[], const word x[], size_t x_size, word y)
 
void bigint_mod_sub (word t[], const word s[], const word mod[], size_t mod_sw, word ws[])
 
template<size_t N>
void bigint_mod_sub_n (word t[], const word s[], const word mod[], word ws[])
 
word bigint_modop (word n1, word n0, word d)
 
void bigint_monty_redc (word z[], const word p[], size_t p_size, word p_dash, word workspace[], size_t ws_size)
 
void bigint_monty_redc_16 (word z[], const word p[], word p_dash, word ws[])
 
void bigint_monty_redc_16 (word z[], const word p[16], word p_dash, word ws[])
 
void bigint_monty_redc_24 (word z[], const word p[], word p_dash, word ws[])
 
void bigint_monty_redc_24 (word z[], const word p[24], word p_dash, word ws[])
 
void bigint_monty_redc_32 (word z[], const word p[], word p_dash, word ws[])
 
void bigint_monty_redc_32 (word z[], const word p[32], word p_dash, word ws[])
 
void bigint_monty_redc_4 (word z[], const word p[4], word p_dash, word ws[])
 
void bigint_monty_redc_4 (word z[], const word p[], word p_dash, word ws[])
 
void bigint_monty_redc_6 (word z[], const word p[], word p_dash, word ws[])
 
void bigint_monty_redc_6 (word z[], const word p[6], word p_dash, word ws[])
 
void bigint_monty_redc_8 (word z[], const word p[], word p_dash, word ws[])
 
void bigint_monty_redc_8 (word z[], const word p[8], word p_dash, word ws[])
 
void bigint_mul (word z[], size_t z_size, const word x[], size_t x_size, size_t x_sw, const word y[], size_t y_size, size_t y_sw, word workspace[], size_t ws_size)
 
void bigint_shl1 (word x[], size_t x_size, size_t x_words, size_t word_shift, size_t bit_shift)
 
void bigint_shl2 (word y[], const word x[], size_t x_size, size_t word_shift, size_t bit_shift)
 
void bigint_shr1 (word x[], size_t x_size, size_t word_shift, size_t bit_shift)
 
void bigint_shr2 (word y[], const word x[], size_t x_size, size_t word_shift, size_t bit_shift)
 
void bigint_sqr (word z[], size_t z_size, const word x[], size_t x_size, size_t x_sw, word workspace[], size_t ws_size)
 
word bigint_sub2 (word x[], size_t x_size, const word y[], size_t y_size)
 
void bigint_sub2_rev (word x[], const word y[], size_t y_size)
 
word bigint_sub3 (word z[], const word x[], size_t x_size, const word y[], size_t y_size)
 
CT::Mask< word > bigint_sub_abs (word z[], const word x[], const word y[], size_t N, word ws[])
 
int32_t bigint_sub_abs (word z[], const word x[], size_t x_size, const word y[], size_t y_size)
 
uint32_t bit_size_to_32bit_size (uint32_t bit_size)
 
uint32_t bit_size_to_byte_size (uint32_t bit_size)
 
uint8_t BOTAN_PUBLIC_API (2, 8) RFC4880_encode_count(size_t iterations)
 
std::string BOTAN_PUBLIC_API (2, 9) base58_encode(const uint8_t input[]
 
size_t BOTAN_PUBLIC_API (2, 7) base32_encode(char output[]
 
void BOTAN_PUBLIC_API (2, 9) ct_divide(const BigInt &x
 
std::pair< AlgorithmIdentifier, std::vector< uint8_t > > BOTAN_PUBLIC_API (2, 1) pbes2_encrypt_msec(const secure_vector< uint8_t > &key_bits
 
std::string BOTAN_PUBLIC_API(2, 0) generate_passhash9(const std bool BOTAN_PUBLIC_API(2, 0) check_passhash9(const std bool BOTAN_PUBLIC_API (2, 3) is_passhash9_alg_supported(uint8_t alg_id)
 
class BOTAN_PUBLIC_API (2, 2) HOTP final
 
class BOTAN_PUBLIC_API(2, 0) AlgorithmIdentifier final bool BOTAN_PUBLIC_API (2, 0) NameConstraints final
 Name Constraints. More...
 
class BOTAN_PUBLIC_API(2, 0) OID final OID BOTAN_PUBLIC_API (2, 0) operator+(const OID &oid
 
BigInt BOTAN_PUBLIC_API (2, 5) inverse_euclid(const BigInt &x
 
secure_vector< uint8_t > BOTAN_PUBLIC_API(2, 0) base64_decode(const std size_t BOTAN_PUBLIC_API (2, 1) base64_encode_max_output(size_t input_length)
 
BigInt BOTAN_PUBLIC_API (2, 7) generate_rsa_prime(RandomNumberGenerator &keygen_rng
 
class BOTAN_PUBLIC_API (2, 4) ASN1_Formatter
 
BigInt BOTAN_PUBLIC_API (2, 8) operator *(const BigInt &x
 
template<typename T >
void bswap_4 (T x[4])
 
template<typename T , typename Alloc >
size_t buffer_insert (std::vector< T, Alloc > &buf, size_t buf_offset, const T input[], size_t input_length)
 
template<typename T , typename Alloc , typename Alloc2 >
size_t buffer_insert (std::vector< T, Alloc > &buf, size_t buf_offset, const std::vector< T, Alloc2 > &input)
 
calendar_point calendar_value (const std::chrono::system_clock::time_point &time_point)
 
template<size_t S, int64_t MUL = 1>
void carry (int64_t &h0, int64_t &h1)
 
template<size_t S>
void carry0 (int64_t &h0, int64_t &h1)
 
template<size_t S>
void carry0 (int32_t &h0, int32_t &h1)
 
uint64_t carry_shift (const donna128 &a, size_t shift)
 
const uint8_t * cast_char_ptr_to_uint8 (const char *s)
 
uint8_t * cast_char_ptr_to_uint8 (char *s)
 
const char * cast_uint8_ptr_to_char (const uint8_t *b)
 
char * cast_uint8_ptr_to_char (uint8_t *b)
 
void CECPQ1_accept (uint8_t shared_key[CECPQ1_SHARED_KEY_BYTES], uint8_t send[CECPQ1_ACCEPT_BYTES], const uint8_t received[CECPQ1_OFFER_BYTES], RandomNumberGenerator &rng)
 
void CECPQ1_finish (uint8_t shared_key[CECPQ1_SHARED_KEY_BYTES], const CECPQ1_key &offer_key, const uint8_t received[CECPQ1_ACCEPT_BYTES])
 
void CECPQ1_offer (uint8_t send[CECPQ1_OFFER_BYTES], CECPQ1_key *offer_key_output, RandomNumberGenerator &rng)
 
template<typename T >
size_t ceil_log2 (T x)
 
bool check_bcrypt (const std::string &pass, const std::string &hash)
 
bool check_passhash9 (const std::string &pass, const std::string &hash)
 
bool check_prime (const BigInt &n, RandomNumberGenerator &rng)
 
class BOTAN_PUBLIC_API(2, 0) Integer_Overflow_Detected final size_t checked_add (size_t x, size_t y, const char *file, int line)
 
PK_Signer * choose_sig_format (const Private_Key &key, RandomNumberGenerator &rng, const std::string &hash_fn, AlgorithmIdentifier &sig_algo)
 
PK_Signer * choose_sig_format (const Private_Key &key, const std::map< std::string, std::string > &opts, RandomNumberGenerator &rng, const std::string &hash_fn, AlgorithmIdentifier &sig_algo)
 
size_t clamp (size_t n, size_t lower_bound, size_t upper_bound)
 
std::string clean_ws (const std::string &s)
 
void clear_bytes (void *ptr, size_t bytes)
 
template<typename T >
void clear_mem (T *ptr, size_t n)
 
uint64_t combine_lower (const donna128 &a, size_t s1, const donna128 &b, size_t s2)
 
void commoncrypto_adjust_key_size (const uint8_t key[], size_t length, const CommonCryptor_Opts &opts, secure_vector< uint8_t > &full_key)
 
CommonCryptor_Opts commoncrypto_opts_from_algo (const std::string &algo)
 
bool constant_time_compare (const uint8_t x[], const uint8_t y[], size_t len)
 
template<typename T >
void copy_mem (T *out, const T *in, size_t n)
 
template<typename T >
void copy_out_be (uint8_t out[], size_t out_bytes, const T in[])
 
template<typename T >
void copy_out_le (uint8_t out[], size_t out_bytes, const T in[])
 
template<typename T , typename Alloc >
void copy_out_vec_be (uint8_t out[], size_t out_bytes, const std::vector< T, Alloc > &in)
 
template<typename T , typename Alloc >
void copy_out_vec_le (uint8_t out[], size_t out_bytes, const std::vector< T, Alloc > &in)
 
AlternativeName create_alt_name (const Data_Store &info)
 
X509_DN create_dn (const Data_Store &info)
 
std::string create_hex_fingerprint (const uint8_t bits[], size_t bits_len, const std::string &hash_name)
 
template<typename Alloc >
std::string create_hex_fingerprint (const std::vector< uint8_t, Alloc > &vec, const std::string &hash_name)
 
std::unique_ptr< Private_Key > create_private_key (const std::string &alg_name, RandomNumberGenerator &rng, const std::string &params, const std::string &provider)
 
uint8_t ct_compare_u8 (const uint8_t x[], const uint8_t y[], size_t len)
 
void ct_divide (const BigInt &x, const BigInt &y, BigInt &q_out, BigInt &r_out)
 
BigInt ct_divide (const BigInt &x, const BigInt &y)
 
void ct_divide_u8 (const BigInt &x, uint8_t y, BigInt &q_out, uint8_t &r_out)
 
BigInt ct_inverse_mod_odd_modulus (const BigInt &n, const BigInt &mod)
 
template<typename T >
T ct_is_zero (T x)
 
BigInt ct_modulo (const BigInt &x, const BigInt &y)
 
template<typename T >
size_t ctz (T n)
 
void curve25519_basepoint (uint8_t mypublic[32], const uint8_t secret[32])
 
void curve25519_donna (uint8_t mypublic[32], const uint8_t secret[32], const uint8_t basepoint[32])
 
void deallocate_memory (void *p, size_t elems, size_t elem_size)
 
gf2m decode_gf2m (const uint8_t *mem)
 
void divide (const BigInt &x, const BigInt &y_arg, BigInt &q_out, BigInt &r_out)
 
size_t dl_exponent_size (size_t bits)
 
size_t dl_work_factor (size_t bits)
 
template<typename E , typename... Args>
class BOTAN_PUBLIC_API(2, 0) Stream_IO_Error final class BOTAN_PUBLIC_API(2, 9) System_Error class BOTAN_PUBLIC_API(2, 0) Internal_Error class BOTAN_PUBLIC_API(2, 0) Not_Implemented final class BOTAN_PUBLIC_API(2, 0) Invalid_OID final class BOTAN_PUBLIC_API(2, 0) Self_Test_Failure final class BOTAN_PUBLIC_API(2, 0) No_Provider_Found final class BOTAN_PUBLIC_API(2, 0) Policy_Violation final class BOTAN_PUBLIC_API(2, 0) Unsupported_Argument final void do_throw_error (const char *file, int line, const char *func, Args... args)
 
secure_vector< uint8_t > EC2OSP (const PointGFp &point, uint8_t format)
 
size_t ecp_work_factor (size_t bits)
 
void ed25519_gen_keypair (uint8_t *pk, uint8_t *sk, const uint8_t seed[32])
 
class BOTAN_PUBLIC_API(2, 2) Ed25519_PublicKey class BOTAN_PUBLIC_API(2, 2) Ed25519_PrivateKey final void ed25519_gen_keypair (uint8_t pk[32], uint8_t sk[64], const uint8_t seed[32])
 
void ed25519_sign (uint8_t sig[64], const uint8_t *m, size_t mlen, const uint8_t *sk)
 
void ed25519_sign (uint8_t sig[64], const uint8_t msg[], size_t msg_len, const uint8_t sk[64])
 
bool ed25519_verify (const uint8_t *m, size_t mlen, const uint8_t sig[64], const uint8_t *pk)
 
bool ed25519_verify (const uint8_t msg[], size_t msg_len, const uint8_t sig[64], const uint8_t pk[32])
 
uint32_t encode_gf2m (gf2m to_enc, uint8_t *mem)
 
std::string erase_chars (const std::string &str, const std::set< char > &chars)
 
template<typename T >
uint16_t expand_mask_16bit (T tst)
 
template<typename T >
T expand_top_bit (T a)
 
void fe_0 (fe &x)
 
void fe_1 (fe &x)
 
void fe_add (fe &x, const fe &a, const fe &b)
 
void fe_copy (fe &a, const fe &b)
 
void fe_frombytes (fe &x, const uint8_t *b)
 
void fe_invert (fe &x, const fe &z)
 
int fe_isnegative (const fe &x)
 
int fe_isnonzero (const fe &x)
 
void fe_mul (fe &x, const fe &a, const fe &b)
 
void fe_neg (fe &x, const fe &z)
 
void fe_pow22523 (fe &x, const fe &y)
 
void fe_sq (fe &x, const fe &z)
 
void fe_sq2 (fe &x, const fe &z)
 
void fe_sq_iter (fe &x, const fe &z, size_t iter)
 
void fe_sub (fe &x, const fe &a, const fe &b)
 
void fe_tobytes (uint8_t *b, const fe &x)
 
secure_vector< gf2mfind_roots_gf2m_decomp (const polyn_gf2m &polyn, uint32_t code_length)
 
BigInt gcd (const BigInt &a, const BigInt &b)
 
void gcm_clmul_precompute (const uint8_t H_bytes[16], uint64_t H_pow[4 *2])
 
void gcm_multiply_clmul (uint8_t x[16], const uint64_t H_pow[4 *2], const uint8_t input[], size_t blocks)
 
void gcm_multiply_clmul (uint8_t x[16], const uint64_t H_pow[8], const uint8_t input_bytes[], size_t blocks)
 
void gcm_multiply_pmull (uint8_t x[16], const uint64_t H64[8], const uint8_t input[], size_t blocks)
 
void gcm_multiply_ssse3 (uint8_t x[16], const uint64_t HM[256], const uint8_t input_bytes[], size_t blocks)
 
void gcm_pmull_precompute (const uint8_t H_bytes[16], uint64_t H_pow[4 *2])
 
void ge_double_scalarmult_vartime (uint8_t out[32], const uint8_t a[], const ge_p3 *A, const uint8_t b[])
 
void ge_double_scalarmult_vartime (uint8_t out[32], const uint8_t *a, const ge_p3 *A, const uint8_t *b)
 
int ge_frombytes_negate_vartime (ge_p3 *, const uint8_t *)
 
void ge_scalarmult_base (uint8_t out[32], const uint8_t in[32])
 
std::string generate_bcrypt (const std::string &pass, RandomNumberGenerator &rng, uint16_t work_factor, char version)
 
bool generate_dsa_primes (RandomNumberGenerator &rng, BigInt &p, BigInt &q, size_t pbits, size_t qbits, const std::vector< uint8_t > &seed_c, size_t offset)
 
std::vector< uint8_t > generate_dsa_primes (RandomNumberGenerator &rng, BigInt &p, BigInt &q, size_t pbits, size_t qbits)
 
McEliece_PrivateKey generate_mceliece_key (RandomNumberGenerator &rng, uint32_t ext_deg, uint32_t code_length, uint32_t t)
 
std::string generate_passhash9 (const std::string &pass, RandomNumberGenerator &rng, uint16_t work_factor, uint8_t alg_id)
 
BigInt generate_rfc6979_nonce (const BigInt &x, const BigInt &q, const BigInt &h, const std::string &hash)
 
BigInt generate_rsa_prime (RandomNumberGenerator &keygen_rng, RandomNumberGenerator &prime_test_rng, size_t bits, const BigInt &coprime, size_t prob)
 
BigInt generate_srp6_verifier (const std::string &identifier, const std::string &password, const std::vector< uint8_t > &salt, const std::string &group_id, const std::string &hash_id)
 
class BOTAN_PUBLIC_API(2, 0) AEAD_Mode AEAD_Mode * get_aead (const std::string &name, Cipher_Dir direction)
 
BlockCipherModePaddingMethod * get_bc_pad (const std::string &algo_spec)
 
template<typename T >
constexpr uint8_t get_byte (size_t byte_num, T input)
 
Keyed_Filter * get_cipher (const std::string &algo_spec, Cipher_Dir direction)
 
Keyed_Filter * get_cipher (const std::string &algo_spec, const SymmetricKey &key, const InitializationVector &iv, Cipher_Dir direction)
 
Keyed_Filter * get_cipher (const std::string &algo_spec, const SymmetricKey &key, Cipher_Dir direction)
 
class BOTAN_PUBLIC_API(2, 0) Cipher_Mode Cipher_Mode * get_cipher_mode (const std::string &algo_spec, Cipher_Dir direction, const std::string &provider="")
 
EME * get_eme (const std::string &algo_spec)
 
EMSA * get_emsa (const std::string &algo_spec)
 
std::vector< std::string > get_files_recursive (const std::string &dir)
 
KDF * get_kdf (const std::string &algo_spec)
 
PBKDF * get_pbkdf (const std::string &algo_spec, const std::string &provider="")
 
PBKDF * get_s2k (const std::string &algo_spec)
 
const std::vector< std::string > get_sig_paddings (const std::string algo)
 
gf2m gray_to_lex (gf2m gray)
 
bool has_filesystem_impl ()
 
std::string hash_for_emsa (const std::string &algo_spec)
 
size_t hex_decode (uint8_t output[], const char input[], size_t input_length, size_t &input_consumed, bool ignore_ws)
 
size_t hex_decode (uint8_t output[], const char input[], size_t input_length, bool ignore_ws)
 
size_t hex_decode (uint8_t output[], const std::string &input, bool ignore_ws)
 
std::vector< uint8_t > hex_decode (const char input[], size_t input_length, bool ignore_ws)
 
std::vector< uint8_t > hex_decode (const std::string &input, bool ignore_ws)
 
secure_vector< uint8_t > hex_decode_locked (const char input[], size_t input_length, bool ignore_ws)
 
secure_vector< uint8_t > hex_decode_locked (const std::string &input, bool ignore_ws)
 
void hex_encode (char output[], const uint8_t input[], size_t input_length, bool uppercase)
 
std::string hex_encode (const uint8_t input[], size_t input_length, bool uppercase)
 
template<typename Alloc >
std::string hex_encode (const std::vector< uint8_t, Alloc > &input, bool uppercase=true)
 
template<typename T >
size_t high_bit (T n)
 
secure_vector< uint8_t > hkdf_expand_label (const std::string &hash_fn, const uint8_t secret[], size_t secret_len, const std::string &label, const uint8_t hash_val[], size_t hash_val_len, size_t length)
 
bool host_wildcard_match (const std::string &issued_, const std::string &host_)
 
uint8_t ieee1363_hash_id (const std::string &name)
 
size_t if_work_factor (size_t bits)
 
void initialize_allocator ()
 
BigInt inverse_euclid (const BigInt &n, const BigInt &mod)
 
BigInt inverse_mod (const BigInt &n, const BigInt &mod)
 
std::string ipv4_to_string (uint32_t ip)
 
bool is_bailie_psw_probable_prime (const BigInt &n, const Modular_Reducer &mod_n)
 
bool is_bailie_psw_probable_prime (const BigInt &n)
 
bool is_lucas_probable_prime (const BigInt &C, const Modular_Reducer &mod_C)
 
bool is_miller_rabin_probable_prime (const BigInt &n, const Modular_Reducer &mod_n, RandomNumberGenerator &rng, size_t test_iterations)
 
bool is_passhash9_alg_supported (uint8_t alg_id)
 
BigInt is_perfect_square (const BigInt &C)
 
template<typename T >
constexpr bool is_power_of_2 (T arg)
 
bool is_prime (const BigInt &n, RandomNumberGenerator &rng, size_t prob, bool is_random)
 
int32_t jacobi (const BigInt &a, const BigInt &n)
 
std::string key_constraints_to_string (Key_Constraints constraints)
 
BigInt lcm (const BigInt &a, const BigInt &b)
 
gf2m lex_to_gray (gf2m lex)
 
uint64_t load_3 (const uint8_t in[3])
 
uint64_t load_4 (const uint8_t *in)
 
template<typename T >
T load_be (const uint8_t in[], size_t off)
 
template<typename T >
void load_be (const uint8_t in[], T &x0, T &x1)
 
template<typename T >
void load_be (const uint8_t in[], T &x0, T &x1, T &x2, T &x3)
 
template<typename T >
void load_be (const uint8_t in[], T &x0, T &x1, T &x2, T &x3, T &x4, T &x5, T &x6, T &x7)
 
template<typename T >
void load_be (T out[], const uint8_t in[], size_t count)
 
template<>
uint16_t load_be< uint16_t > (const uint8_t in[], size_t off)
 
template<>
uint32_t load_be< uint32_t > (const uint8_t in[], size_t off)
 
template<>
uint64_t load_be< uint64_t > (const uint8_t in[], size_t off)
 
template<typename T >
T load_le (const uint8_t in[], size_t off)
 
template<typename T >
void load_le (const uint8_t in[], T &x0, T &x1)
 
template<typename T >
void load_le (const uint8_t in[], T &x0, T &x1, T &x2, T &x3)
 
template<typename T >
void load_le (const uint8_t in[], T &x0, T &x1, T &x2, T &x3, T &x4, T &x5, T &x6, T &x7)
 
template<typename T >
void load_le (T out[], const uint8_t in[], size_t count)
 
template<>
uint16_t load_le< uint16_t > (const uint8_t in[], size_t off)
 
template<>
uint32_t load_le< uint32_t > (const uint8_t in[], size_t off)
 
template<>
uint64_t load_le< uint64_t > (const uint8_t in[], size_t off)
 
std::unique_ptr< Private_Key > load_private_key (const AlgorithmIdentifier &alg_id, const secure_vector< uint8_t > &key_bits)
 
std::unique_ptr< Public_Key > load_public_key (const AlgorithmIdentifier &alg_id, const std::vector< uint8_t > &key_bits)
 
size_t low_zero_bits (const BigInt &n)
 
std::unique_ptr< HashFunction > make_bearssl_hash (const std::string &name)
 
std::unique_ptr< BlockCipher > make_commoncrypto_block_cipher (const std::string &name)
 
enum Cipher_Dir int typedef int32_t CCCryptorStatus class BOTAN_PUBLIC_API(2, 0) CommonCrypto_Error final Cipher_Mode * make_commoncrypto_cipher_mode (const std::string &name, Cipher_Dir direction)
 
std::unique_ptr< HashFunction > make_commoncrypto_hash (const std::string &name)
 
Compression_Algorithm * make_compressor (const std::string &name)
 
Decompression_Algorithm * make_decompressor (const std::string &name)
 
enum Cipher_Dir int class BOTAN_PUBLIC_API(2, 0) OpenSSL_Error final std::unique_ptr< BlockCipher > make_openssl_block_cipher (const std::string &name)
 
Cipher_Mode * make_openssl_cipher_mode (const std::string &name, Cipher_Dir direction)
 
std::unique_ptr< HashFunction > make_openssl_hash (const std::string &name)
 
constexpr uint16_t make_uint16 (uint8_t i0, uint8_t i1)
 
constexpr uint32_t make_uint32 (uint8_t i0, uint8_t i1, uint8_t i2, uint8_t i3)
 
constexpr uint64_t make_uint64 (uint8_t i0, uint8_t i1, uint8_t i2, uint8_t i3, uint8_t i4, uint8_t i5, uint8_t i6, uint8_t i7)
 
template<class T , class... Args>
stlCompatibilityDetails::_Unique_if< T >::_Single_object make_unique (Args &&... args)
 
template<class T >
stlCompatibilityDetails::_Unique_if< T >::_Unknown_bound make_unique (size_t n)
 
template<class T , class... Args>
stlCompatibilityDetails::_Unique_if< T >::_Known_bound make_unique (Args &&...)=delete
 
template<typename K , typename V >
std::set< K > map_keys_as_set (const std::map< K, V > &kv)
 
template<typename T , typename Pred >
void map_remove_if (Pred pred, T &assoc)
 
secure_vector< uint8_t > mceies_decrypt (const McEliece_PrivateKey &privkey, const uint8_t ct[], size_t ct_len, const uint8_t ad[], size_t ad_len, const std::string &algo)
 
secure_vector< uint8_t > mceies_encrypt (const McEliece_PublicKey &pubkey, const uint8_t pt[], size_t pt_len, const uint8_t ad[], size_t ad_len, RandomNumberGenerator &rng, const std::string &algo)
 
void mceliece_decrypt (secure_vector< uint8_t > &plaintext_out, secure_vector< uint8_t > &error_mask_out, const secure_vector< uint8_t > &ciphertext, const McEliece_PrivateKey &key)
 
void mceliece_decrypt (secure_vector< uint8_t > &plaintext, secure_vector< uint8_t > &error_mask, const uint8_t ciphertext[], size_t ciphertext_len, const McEliece_PrivateKey &key)
 
secure_vector< uint8_t > mceliece_decrypt (secure_vector< gf2m > &error_pos, const uint8_t *ciphertext, uint32_t ciphertext_len, const McEliece_PrivateKey &key)
 
void mceliece_encrypt (secure_vector< uint8_t > &ciphertext_out, secure_vector< uint8_t > &error_mask_out, const secure_vector< uint8_t > &plaintext, const McEliece_PublicKey &key, RandomNumberGenerator &rng)
 
size_t mceliece_work_factor (size_t n, size_t t)
 
void mgf1_mask (HashFunction &hash, const uint8_t in[], size_t in_len, uint8_t out[], size_t out_len)
 
size_t miller_rabin_test_iterations (size_t n_bits, size_t prob, bool random)
 
BigInt monty_execute (const Montgomery_Exponentation_State &precomputed_state, const BigInt &k, size_t max_k_bits)
 
BigInt monty_execute_vartime (const Montgomery_Exponentation_State &precomputed_state, const BigInt &k)
 
word monty_inverse (word a)
 
BigInt monty_multi_exp (std::shared_ptr< const Montgomery_Params > params_p, const BigInt &x_bn, const BigInt &z1, const BigInt &y_bn, const BigInt &z2)
 
std::shared_ptr< const Montgomery_Exponentation_State > monty_precompute (std::shared_ptr< const Montgomery_Params > params, const BigInt &g, size_t window_bits, bool const_time)
 
void mul64x64_128 (uint64_t a, uint64_t b, uint64_t *lo, uint64_t *hi)
 
BigInt mul_add (const BigInt &a, const BigInt &b, const BigInt &c)
 
BigInt mul_sub (const BigInt &a, const BigInt &b, const BigInt &c)
 
PointGFp multi_exponentiate (const PointGFp &x, const BigInt &z1, const PointGFp &y, const BigInt &z2)
 
template<typename K , typename V >
void multimap_insert (std::multimap< K, V > &multimap, const K &key, const V &value)
 
void newhope_keygen (uint8_t *send, poly *sk, RandomNumberGenerator &rng, Newhope_Mode mode)
 
void newhope_shareda (uint8_t sharedkey[], const poly *sk, const uint8_t received[], Newhope_Mode mode)
 
void newhope_sharedb (uint8_t *sharedkey, uint8_t *send, const uint8_t *received, RandomNumberGenerator &rng, Newhope_Mode mode)
 
secure_vector< uint8_t > nist_key_unwrap (const uint8_t input[], size_t input_len, const BlockCipher &bc)
 
secure_vector< uint8_t > nist_key_unwrap_padded (const uint8_t input[], size_t input_len, const BlockCipher &bc)
 
std::vector< uint8_t > nist_key_wrap (const uint8_t input[], size_t input_len, const BlockCipher &bc)
 
std::vector< uint8_t > nist_key_wrap_padded (const uint8_t input[], size_t input_len, const BlockCipher &bc)
 
BigInt normalized_montgomery_inverse (const BigInt &a, const BigInt &p)
 
secure_vector< uint8_t > oaep_find_delim (uint8_t &valid_mask, const uint8_t input[], size_t input_len, const secure_vector< uint8_t > &Phash)
 
ECIES_Flags operator & (ECIES_Flags a, ECIES_Flags b)
 
BigInt operator * (const BigInt &x, const BigInt &y)
 
BigInt operator * (const BigInt &x, word y)
 
donna128 operator * (const donna128 &x, uint64_t y)
 
donna128 operator * (uint64_t y, const donna128 &x)
 
PointGFp operator * (const PointGFp &point, const BigInt &scalar)
 
PointGFp operator * (const BigInt &scalar, const PointGFp &point)
 
BigInt operator * (word x, const BigInt &y)
 
bool operator!= (const CRL_Entry &a1, const CRL_Entry &a2)
 
template<typename T , typename U >
bool operator!= (const secure_allocator< T > &, const secure_allocator< U > &)
 
bool operator!= (const AlgorithmIdentifier &a1, const AlgorithmIdentifier &a2)
 
bool operator!= (const OID &a, const OID &b)
 
bool operator!= (const OctetString &s1, const OctetString &s2)
 
bool operator!= (const X509_DN &dn1, const X509_DN &dn2)
 
bool operator!= (const CurveGFp &lhs, const CurveGFp &rhs)
 
bool operator!= (const X509_Time &t1, const X509_Time &t2)
 
bool operator!= (const PointGFp &lhs, const PointGFp &rhs)
 
bool operator!= (const EC_Group &lhs, const EC_Group &rhs)
 
bool operator!= (const X509_Certificate &cert1, const X509_Certificate &cert2)
 
bool operator!= (const BigInt &a, const BigInt &b)
 
bool operator!= (const BigInt &a, word b)
 
BigInt operator% (const BigInt &n, const BigInt &mod)
 
word operator% (const BigInt &n, word mod)
 
OID operator+ (const OID &oid, uint32_t component)
 
donna128 operator+ (const donna128 &x, const donna128 &y)
 
donna128 operator+ (const donna128 &x, uint64_t y)
 
OctetString operator+ (const OctetString &k1, const OctetString &k2)
 
PointGFp operator+ (const PointGFp &lhs, const PointGFp &rhs)
 
BigInt operator+ (const BigInt &x, const BigInt &y)
 
BigInt operator+ (const BigInt &x, word y)
 
BigInt operator+ (word x, const BigInt &y)
 
template<typename T , typename Alloc , typename Alloc2 >
std::vector< T, Alloc > & operator+= (std::vector< T, Alloc > &out, const std::vector< T, Alloc2 > &in)
 
template<typename T , typename Alloc >
std::vector< T, Alloc > & operator+= (std::vector< T, Alloc > &out, T in)
 
template<typename T , typename Alloc , typename L >
std::vector< T, Alloc > & operator+= (std::vector< T, Alloc > &out, const std::pair< const T *, L > &in)
 
template<typename T , typename Alloc , typename L >
std::vector< T, Alloc > & operator+= (std::vector< T, Alloc > &out, const std::pair< T *, L > &in)
 
PointGFp operator- (const PointGFp &lhs)
 
PointGFp operator- (const PointGFp &lhs, const PointGFp &rhs)
 
BigInt operator- (const BigInt &x, const BigInt &y)
 
BigInt operator- (const BigInt &x, word y)
 
BigInt operator/ (const BigInt &x, const BigInt &y)
 
bool operator< (const OID &a, const OID &b)
 
bool operator< (const X509_DN &dn1, const X509_DN &dn2)
 
bool operator< (const X509_Time &t1, const X509_Time &t2)
 
bool operator< (const BigInt &a, const BigInt &b)
 
bool operator< (const BigInt &a, word b)
 
std::ostream & operator<< (std::ostream &stream, Pipe &pipe)
 
std::ostream & operator<< (std::ostream &stream, const BigInt &n)
 
int operator<< (int fd, Pipe &pipe)
 
BigInt operator<< (const BigInt &x, size_t shift)
 
std::ostream & operator<< (std::ostream &os, const GeneralName &gn)
 X.509 GeneralName Type. More...
 
std::ostream & operator<< (std::ostream &os, const GeneralSubtree &gs)
 A single Name Constraint. More...
 
std::ostream & operator<< (std::ostream &out, const X509_DN &dn)
 
bool operator<= (const X509_Time &t1, const X509_Time &t2)
 
bool operator<= (const BigInt &a, const BigInt &b)
 
bool operator<= (const BigInt &a, word b)
 
bool operator== (const CRL_Entry &a1, const CRL_Entry &a2)
 
template<typename T , typename U >
bool operator== (const secure_allocator< T > &, const secure_allocator< U > &)
 
bool operator== (const AlgorithmIdentifier &a1, const AlgorithmIdentifier &a2)
 
bool operator== (const OctetString &s1, const OctetString &s2)
 
bool operator== (const X509_DN &dn1, const X509_DN &dn2)
 
bool operator== (const X509_Time &t1, const X509_Time &t2)
 
bool operator== (const BigInt &a, const BigInt &b)
 
bool operator== (const BigInt &a, word b)
 
bool operator> (const X509_Time &t1, const X509_Time &t2)
 
bool operator> (const BigInt &a, const BigInt &b)
 
bool operator> (const BigInt &a, word b)
 
bool operator>= (const X509_Time &t1, const X509_Time &t2)
 
bool operator>= (const BigInt &a, const BigInt &b)
 
bool operator>= (const BigInt &a, word b)
 
std::istream & operator>> (std::istream &stream, Pipe &pipe)
 
int operator>> (int fd, Pipe &pipe)
 
std::istream & operator>> (std::istream &stream, BigInt &n)
 
BigInt operator>> (const BigInt &x, size_t shift)
 
std::istream & operator>> (std::istream &in, X509_DN &dn)
 
OctetString operator^ (const OctetString &k1, const OctetString &k2)
 
template<typename Alloc , typename Alloc2 >
std::vector< uint8_t, Alloc > & operator^= (std::vector< uint8_t, Alloc > &out, const std::vector< uint8_t, Alloc2 > &in)
 
ECIES_Flags operator| (ECIES_Flags a, ECIES_Flags b)
 
donna128 operator| (const donna128 &x, const donna128 &y)
 
template<typename Alloc >
PointGFp OS2ECP (const std::vector< uint8_t, Alloc > &data, const CurveGFp &curve)
 
PointGFp OS2ECP (const uint8_t data[], size_t data_len, const CurveGFp &curve)
 
std::pair< BigInt, BigInt > OS2ECP (const uint8_t data[], size_t data_len, const BigInt &curve_p, const BigInt &curve_a, const BigInt &curve_b)
 
std::vector< std::string > parse_algorithm_name (const std::string &namex)
 
std::vector< uint32_t > parse_asn1_oid (const std::string &oid)
 
bool passes_miller_rabin_test (const BigInt &n, const Modular_Reducer &mod_n, const std::shared_ptr< Montgomery_Params > &monty_n, const BigInt &a)
 
secure_vector< uint8_t > pbes2_decrypt (const secure_vector< uint8_t > &key_bits, const std::string &passphrase, const std::vector< uint8_t > &params)
 
std::pair< AlgorithmIdentifier, std::vector< uint8_t > > pbes2_encrypt (const secure_vector< uint8_t > &key_bits, const std::string &passphrase, std::chrono::milliseconds msec, const std::string &cipher, const std::string &digest, RandomNumberGenerator &rng)
 
std::pair< AlgorithmIdentifier, std::vector< uint8_t > > pbes2_encrypt_iter (const secure_vector< uint8_t > &key_bits, const std::string &passphrase, size_t pbkdf_iter, const std::string &cipher, const std::string &digest, RandomNumberGenerator &rng)
 
std::pair< AlgorithmIdentifier, std::vector< uint8_t > > pbes2_encrypt_msec (const secure_vector< uint8_t > &key_bits, const std::string &passphrase, std::chrono::milliseconds msec, size_t *out_iterations_if_nonnull, const std::string &cipher, const std::string &digest, RandomNumberGenerator &rng)
 
size_t pbkdf2 (MessageAuthenticationCode &prf, uint8_t out[], size_t out_len, const std::string &password, const uint8_t salt[], size_t salt_len, size_t iterations, std::chrono::milliseconds msec)
 
void pbkdf2 (MessageAuthenticationCode &prf, uint8_t out[], size_t out_len, const uint8_t salt[], size_t salt_len, size_t iterations)
 
std::vector< uint8_t > pkcs_hash_id (const std::string &name)
 
void poly_double_n (uint8_t buf[], size_t n)
 
void poly_double_n (uint8_t out[], const uint8_t in[], size_t n)
 
void poly_double_n_le (uint8_t out[], const uint8_t in[], size_t n)
 
bool poly_double_supported_size (size_t n)
 
BigInt power_mod (const BigInt &base, const BigInt &exp, const BigInt &mod)
 
template<typename T >
void prefetch_readonly (const T *addr, size_t length)
 
template<typename T >
void prefetch_readwrite (const T *addr, size_t length)
 
const BigInt & prime_p521 ()
 
std::vector< std::string > probe_provider_private_key (const std::string &alg_name, const std::vector< std::string > possible)
 
template<typename T >
std::vector< std::string > probe_providers_of (const std::string &algo_spec, const std::vector< std::string > &possible)
 
bool quick_check_prime (const BigInt &n, RandomNumberGenerator &rng)
 
gf2m random_code_element (unsigned code_length, RandomNumberGenerator &rng)
 
gf2m random_gf2m (RandomNumberGenerator &rng)
 
BigInt random_prime (RandomNumberGenerator &rng, size_t bits, const BigInt &coprime, size_t equiv, size_t modulo, size_t prob)
 
BigInt random_safe_prime (RandomNumberGenerator &rng, size_t bits)
 
std::map< std::string, std::string > read_cfg (std::istream &is)
 
std::map< std::string, std::string > read_kv (const std::string &kv)
 
void redc_mul (int64_t &s1, int64_t &s2, int64_t &s3, int64_t &s4, int64_t &s5, int64_t &s6, int64_t &X)
 
void redc_p521 (BigInt &x, secure_vector< word > &ws)
 
std::string replace_char (const std::string &str, char from_char, char to_char)
 
std::string replace_chars (const std::string &str, const std::set< char > &chars, char to_char)
 
BigInt ressol (const BigInt &a, const BigInt &p)
 
uint16_t reverse_bytes (uint16_t val)
 
uint32_t reverse_bytes (uint32_t val)
 
uint64_t reverse_bytes (uint64_t val)
 
secure_vector< uint8_t > rfc3394_keyunwrap (const secure_vector< uint8_t > &key, const SymmetricKey &kek)
 
secure_vector< uint8_t > rfc3394_keywrap (const secure_vector< uint8_t > &key, const SymmetricKey &kek)
 
size_t RFC4880_decode_count (uint8_t iter)
 
uint8_t RFC4880_encode_count (size_t desired_iterations)
 
size_t RFC4880_round_iterations (size_t iterations)
 
template<typename T >
T rotate_left (T input, size_t rot)
 
template<typename T >
T rotate_right (T input, size_t rot)
 
template<size_t ROT, typename T >
constexpr T rotl (T input)
 
template<typename T >
T rotl_var (T input, size_t rot)
 
template<size_t ROT, typename T >
constexpr T rotr (T input)
 
template<typename T >
T rotr_var (T input, size_t rot)
 
template<typename T >
constexpr T round_down (T n, T align_to)
 
size_t round_up (size_t n, size_t align_to)
 
std::string runtime_version_check (uint32_t major, uint32_t minor, uint32_t patch)
 
template<typename T >
bool same_mem (const T *p1, const T *p2, size_t n)
 
void sc_muladd (uint8_t *, const uint8_t *, const uint8_t *, const uint8_t *)
 
void sc_reduce (uint8_t *)
 
void scrypt (uint8_t output[], size_t output_len, const std::string &password, const uint8_t salt[], size_t salt_len, size_t N, size_t r, size_t p)
 
void scrypt (uint8_t output[], size_t output_len, const char *password, size_t password_len, const uint8_t salt[], size_t salt_len, size_t N, size_t r, size_t p)
 
size_t scrypt_memory_usage (size_t N, size_t r, size_t p)
 
template<typename K , typename V >
search_map (const std::map< K, V > &mapping, const K &key, const V &null_result=V())
 
template<typename K , typename V , typename R >
search_map (const std::map< K, V > &mapping, const K &key, const R &null_result, const R &found_result)
 
void secure_scrub_memory (void *ptr, size_t n)
 
void set_mem (uint8_t *ptr, size_t n, uint8_t val)
 
const char * short_version_cstr ()
 
std::string short_version_string ()
 
bool sig_algo_and_pad_ok (const std::string algo, const std::string padding)
 
template<typename T >
size_t significant_bytes (T n)
 
std::vector< uint8_t > sm2_compute_za (HashFunction &hash, const std::string &user_id, const EC_Group &domain, const PointGFp &pubkey)
 
std::vector< std::string > split_on (const std::string &str, char delim)
 
std::vector< std::string > split_on_pred (const std::string &str, std::function< bool(char)> pred)
 
BigInt square (const BigInt &x)
 
std::pair< BigInt, SymmetricKeysrp6_client_agree (const std::string &identifier, const std::string &password, const std::string &group_id, const std::string &hash_id, const std::vector< uint8_t > &salt, const BigInt &B, RandomNumberGenerator &rng)
 
std::string srp6_group_identifier (const BigInt &N, const BigInt &g)
 
void store_be (uint16_t in, uint8_t out[2])
 
void store_be (uint32_t in, uint8_t out[4])
 
void store_be (uint64_t in, uint8_t out[8])
 
template<typename T >
void store_be (uint8_t out[], T x0, T x1)
 
template<typename T >
void store_be (uint8_t out[], T x0, T x1, T x2, T x3)
 
template<typename T >
void store_be (uint8_t out[], T x0, T x1, T x2, T x3, T x4, T x5, T x6, T x7)
 
void store_le (uint16_t in, uint8_t out[2])
 
void store_le (uint32_t in, uint8_t out[4])
 
void store_le (uint64_t in, uint8_t out[8])
 
template<typename T >
void store_le (uint8_t out[], T x0, T x1)
 
template<typename T >
void store_le (uint8_t out[], T x0, T x1, T x2, T x3)
 
template<typename T >
void store_le (uint8_t out[], T x0, T x1, T x2, T x3, T x4, T x5, T x6, T x7)
 
std::string string_join (const std::vector< std::string > &strs, char delim)
 
uint32_t string_to_ipv4 (const std::string &str)
 
BigInt sub_mul (const BigInt &a, const BigInt &b, const BigInt &c)
 
std::vector< polyn_gf2msyndrome_init (polyn_gf2m const &generator, std::vector< gf2m > const &support, int n)
 
RandomNumberGenerator & system_rng ()
 
void throw_invalid_argument (const char *message, const char *func, const char *file)
 
void throw_invalid_state (const char *expr, const char *func, const char *file)
 
uint32_t timespec_to_u32bit (const std::string &timespec)
 
std::vector< uint8_t > to_byte_vector (const std::string &s)
 
const char * to_string (Certificate_Status_Code code)
 
std::string to_string (const secure_vector< uint8_t > &bytes)
 
uint32_t to_u32bit (const std::string &str)
 
uint16_t to_uint16 (const std::string &str)
 
template<typename T >
void typecast_copy (uint8_t out[], T in)
 
template<typename T >
void typecast_copy (T &out, const uint8_t in[])
 
template<typename T >
void typecast_copy (T out[], const uint8_t in[], size_t N)
 
std::string ucs2_to_utf8 (const uint8_t ucs2[], size_t len)
 
std::string ucs4_to_utf8 (const uint8_t ucs4[], size_t len)
 
template<typename T >
std::vector< Tunlock (const secure_vector< T > &in)
 
std::string utf8_to_latin1 (const std::string &utf8)
 
template<typename T >
bool value_exists (const std::vector< T > &vec, const T &val)
 
size_t var_ctz32 (uint32_t n)
 
void verify_cert_constraints_valid_for_key_type (const Public_Key &pub_key, Key_Constraints constraints)
 
bool verify_prime (const BigInt &n, RandomNumberGenerator &rng)
 
const char * version_cstr ()
 
uint32_t version_datestamp ()
 
uint32_t version_major ()
 
uint32_t version_minor ()
 
uint32_t version_patch ()
 
std::string version_string ()
 
void word3_add (word *w2, word *w1, word *w0, word x)
 
void word3_muladd (word *w2, word *w1, word *w0, word x, word y)
 
void word3_muladd_2 (word *w2, word *w1, word *w0, word x, word y)
 
word word8_add2 (word x[8], const word y[8], word carry)
 
word word8_add3 (word z[8], const word x[8], const word y[8], word carry)
 
word word8_linmul2 (word x[8], word y, word carry)
 
word word8_linmul3 (word z[8], const word x[8], word y, word carry)
 
word word8_madd3 (word z[8], const word x[8], word y, word carry)
 
word word8_sub2 (word x[8], const word y[8], word carry)
 
word word8_sub2_rev (word x[8], const word y[8], word carry)
 
word word8_sub3 (word z[8], const word x[8], const word y[8], word carry)
 
word word_add (word x, word y, word *carry)
 
word word_madd2 (word a, word b, word *c)
 
word word_madd3 (word a, word b, word c, word *d)
 
word word_sub (word x, word y, word *carry)
 
bool x500_name_cmp (const std::string &name1, const std::string &name2)
 
Path_Validation_Result x509_path_validate (const std::vector< X509_Certificate > &end_certs, const Path_Validation_Restrictions &restrictions, const std::vector< Certificate_Store * > &trusted_roots, const std::string &hostname, Usage_Type usage, std::chrono::system_clock::time_point ref_time, std::chrono::milliseconds ocsp_timeout, const std::vector< std::shared_ptr< const OCSP::Response >> &ocsp_resp)
 
Path_Validation_Result x509_path_validate (const X509_Certificate &end_cert, const Path_Validation_Restrictions &restrictions, const std::vector< Certificate_Store * > &trusted_roots, const std::string &hostname, Usage_Type usage, std::chrono::system_clock::time_point when, std::chrono::milliseconds ocsp_timeout, const std::vector< std::shared_ptr< const OCSP::Response >> &ocsp_resp)
 
Path_Validation_Result x509_path_validate (const std::vector< X509_Certificate > &end_certs, const Path_Validation_Restrictions &restrictions, const Certificate_Store &store, const std::string &hostname, Usage_Type usage, std::chrono::system_clock::time_point when, std::chrono::milliseconds ocsp_timeout, const std::vector< std::shared_ptr< const OCSP::Response >> &ocsp_resp)
 
Path_Validation_Result x509_path_validate (const X509_Certificate &end_cert, const Path_Validation_Restrictions &restrictions, const Certificate_Store &store, const std::string &hostname, Usage_Type usage, std::chrono::system_clock::time_point when, std::chrono::milliseconds ocsp_timeout, const std::vector< std::shared_ptr< const OCSP::Response >> &ocsp_resp)
 
void xor_buf (uint8_t out[], const uint8_t in[], size_t length)
 
void xor_buf (uint8_t out[], const uint8_t in[], const uint8_t in2[], size_t length)
 
template<typename Alloc , typename Alloc2 >
void xor_buf (std::vector< uint8_t, Alloc > &out, const std::vector< uint8_t, Alloc2 > &in, size_t n)
 
template<typename Alloc >
void xor_buf (std::vector< uint8_t, Alloc > &out, const uint8_t *in, size_t n)
 
template<typename Alloc , typename Alloc2 >
void xor_buf (std::vector< uint8_t, Alloc > &out, const uint8_t *in, const std::vector< uint8_t, Alloc2 > &in2, size_t n)
 
template<typename T , typename Alloc >
void zap (std::vector< T, Alloc > &vec)
 
template<typename T , typename Alloc >
void zeroise (std::vector< T, Alloc > &vec)
 

Variables

size_t const BigInt & a
 
void uint8_t * accept_message
 
secure_vector< uint8_t > const uint8_t size_t const uint8_t ad []
 
secure_vector< uint8_t > const uint8_t size_t const uint8_t size_t ad_len
 
secure_vector< uint8_t > const uint8_t size_t const uint8_t size_t RandomNumberGenerator const std::string & aead = "AES-256/OCB")
 
RandomNumberGenerator const std::string AlgorithmIdentifier & alg_id
 
const std::map< const std::string, std::vector< std::string > > allowed_signature_paddings
 
bool const X509_Time &bool const X509_Time &typedef X509_Time ASN1_Time
 
BOTAN_NORETURN void const char * assertion_made
 
bool const OID & b
 
void const uint8_t const uint8_t basepoint [32]
 
std::vector< uint8_t > size_t const BlockCipher & bc
 
BigInt size_t bits
 
class BOTAN_PUBLIC_API(2, 0) BLAKE2b final typedef BLAKE2b Blake2b
 
BigInt const BigInt const BigInt & c
 
const uint32_t CAST_SBOX1 [256]
 
const uint32_t CAST_SBOX2 [256]
 
const uint32_t CAST_SBOX3 [256]
 
const uint32_t CAST_SBOX4 [256]
 
void BlockCipher * cipher
 
Key_Constraints constraints
 
BigInt size_t const BigInt & coprime = 0
 
secure_vector< uint8_t > const uint8_t ct []
 
secure_vector< uint8_t > const uint8_t size_t ct_len
 
PointGFp size_t const CurveGFpcurve
 
BigInt const BigInt & d
 
PointGFp size_t data_len
 
const uint64_t DES_FPTAB1 [256]
 
const uint64_t DES_FPTAB2 [256]
 
const uint64_t DES_IPTAB1 [256]
 
const uint64_t DES_IPTAB2 [256]
 
class BOTAN_PUBLIC_API(2, 0) DES final class BOTAN_PUBLIC_API(2, 0) TripleDES final const uint32_t DES_SPBOX1 [256]
 
const uint32_t DES_SPBOX2 [256]
 
const uint32_t DES_SPBOX3 [256]
 
const uint32_t DES_SPBOX4 [256]
 
const uint32_t DES_SPBOX5 [256]
 
const uint32_t DES_SPBOX6 [256]
 
const uint32_t DES_SPBOX7 [256]
 
const uint32_t DES_SPBOX8 [256]
 
std::pair< AlgorithmIdentifier, std::vector< uint8_t > > const std::string std::chrono::milliseconds const std::string const std::string & digest
 
std::vector< uint8_t > const std::string const EC_Group & domain
 
size_t elem_size
 
size_t elems
 
BigInt size_t const BigInt size_t equiv = 1
 
BigInt size_t const BigInt size_t size_t equiv_mod = 2
 
BOTAN_NORETURN void const char const char const char * file
 
size_t const uint8_t size_t size_t bool final_inputs
 
BOTAN_NORETURN void const char const char * func
 
std::pair< BigInt, SymmetricKey > BOTAN_PUBLIC_API(2, 0) srp6_client_agree(const std BigInt BOTAN_PUBLIC_API(2, 0) generate_srp6_verifier(const std std::string const BigInt & g
 
BigInt const BigInt const BigInt & h
 
BigInt const BigInt const BigInt const std::string & hash
 
RandomNumberGenerator const std::string & hash_fn
 
std::string size_t const std::string & hash_name
 
const size_t HEX_CODEC_BUFFER_SIZE = 256
 
Path_Validation_Result const Path_Validation_Restrictions const std::vector< Certificate_Store * > const std::string & hostname = ""
 
size_t const char size_t size_t bool bool ignore_ws = true)
 
void const uint8_t in []
 
void const uint8_t size_t in_len
 
size_t const uint8_t input []
 
size_t const uint8_t size_t size_t & input_consumed
 
void BlockCipher const uint8_t size_t input_len
 
size_t const uint8_t size_t input_length
 
class BOTAN_PUBLIC_API(2, 0) Exception class BOTAN_PUBLIC_API(2, 0) Invalid_Argument class BOTAN_PUBLIC_API(2, 0) Invalid_Key_Length final class BOTAN_PUBLIC_API(2, 0) Invalid_IV_Length final class BOTAN_PUBLIC_API(2, 0) Invalid_Algorithm_Name final class BOTAN_PUBLIC_API(2, 0) Encoding_Error final class BOTAN_PUBLIC_API(2, 0) Decoding_Error class BOTAN_PUBLIC_API(2, 0) Invalid_State class BOTAN_PUBLIC_API(2, 0) PRNG_Unseeded final class BOTAN_PUBLIC_API(2, 4) Key_Not_Set class BOTAN_PUBLIC_API(2, 0) Lookup_Error class BOTAN_PUBLIC_API(2, 0) Algorithm_Not_Found final class BOTAN_PUBLIC_API(2, 0) Provider_Not_Found final class BOTAN_PUBLIC_API(2, 0) Invalid_Authentication_Tag final typedef Invalid_Authentication_Tag Integrity_Failure
 
bool RandomNumberGenerator size_t bool is_random = false)
 
uint8_t size_t const std::string const uint8_t size_t size_t iterations
 
secure_vector< uint8_t > const SymmetricKeykek
 
std::string size_t len
 
BOTAN_NORETURN void const char const char const char int line
 
BigInt const BigInt & m
 
class BOTAN_PUBLIC_API(2, 0) MessageAuthenticationCode typedef MessageAuthenticationCode MAC
 
BigInt const BigInt & mod
 
void uint8_t const uint8_t RandomNumberGenerator Newhope_Mode mode = Newhope_Mode::SHA3)
 
BigInt const BigInt & modulo
 
BigInt const BigInt & modulus
 
const word MP_WORD_MASK = ~static_cast<word>(0)
 
const word MP_WORD_MAX = MP_WORD_MASK
 
const word MP_WORD_TOP_BIT = static_cast<word>(1) << (8*sizeof(word) - 1)
 
uint8_t size_t const std::string const uint8_t size_t size_t std::chrono::milliseconds msec
 
class BOTAN_PUBLIC_API(2, 8) Scrypt final class BOTAN_PUBLIC_API(2, 8) Scrypt_Family final void size_t const char size_t const uint8_t size_t size_t N
 
BigInt size_t n
 
class BOTAN_PUBLIC_API(2, 0) OID final OID uint32_t new_comp
 
void newhope_poly RandomNumberGenerator Newhope_Mode = Newhope_Mode::SHA3)
 
Path_Validation_Result const Path_Validation_Restrictions const std::vector< Certificate_Store * > const std::string Usage_Type std::chrono::system_clock::time_point std::chrono::milliseconds const std::vector< std::shared_ptr< const OCSP::Response > > & ocsp_resp = {})
 
Path_Validation_Result const Path_Validation_Restrictions const std::vector< Certificate_Store * > const std::string Usage_Type std::chrono::system_clock::time_point std::chrono::milliseconds ocsp_timeout = std::chrono::milliseconds(0)
 
void const CECPQ1_keyoffer_key
 
void CECPQ1_keyoffer_key_output
 
void uint8_t const uint8_t * offer_message
 
bool BigInt BigInt size_t size_t const std::vector< uint8_t > size_t offset = 0)
 
uint8_t out []
 
std::pair< AlgorithmIdentifier, std::vector< uint8_t > > const std::string std::chrono::milliseconds size_t * out_iterations_if_nonnull
 
uint8_t size_t out_len
 
void BlockCipher const uint8_t size_t uint8_t output []
 
class BOTAN_PUBLIC_API(2, 8) Scrypt final class BOTAN_PUBLIC_API(2, 8) Scrypt_Family final void size_t output_len
 
BigInt const BigInt & p
 
const BigInt const PointGFp & p2
 
std::vector< uint8_t > BigInt & p_out
 
secure_vector< uint8_t > const std::string const std::vector< uint8_t > & params
 
uint8_t size_t const std::string & passphrase
 
class BOTAN_PUBLIC_API(2, 8) Scrypt final class BOTAN_PUBLIC_API(2, 8) Scrypt_Family final void size_t const char * password
 
class BOTAN_PUBLIC_API(2, 8) Scrypt final class BOTAN_PUBLIC_API(2, 8) Scrypt_Family final void size_t const char size_t password_len
 
std::vector< uint8_t > BigInt BigInt size_t pbits
 
int Pipe & pipe
 
class BOTAN_PUBLIC_API(2, 0) Private_Key class BOTAN_PUBLIC_API(2, 0) PK_Key_Agreement_Key typedef PK_Key_Agreement_Key PK_KA_Key
 
const PointGFp & point
 
const size_t PRIME_TABLE_SIZE = 6541
 
BigInt RandomNumberGenerator & prime_test_rng
 
const uint16_t PRIMES [PRIME_TABLE_SIZE+1]
 
bool RandomNumberGenerator size_t prob = 64
 
secure_vector< uint8_t > const uint8_t pt []
 
secure_vector< uint8_t > const uint8_t size_t pt_len
 
std::vector< uint8_t > const std::string const EC_Group const PointGFp & pubkey
 
void const BigInt BigInt & q
 
std::vector< uint8_t > BigInt BigInt & q_out
 
std::vector< uint8_t > BigInt BigInt size_t size_t qbits
 
void const BigInt BigInt BigInt & r
 
void uint8_t const uint8_t * received
 
Path_Validation_Result const Path_Validation_Restrictions & restrictions
 
bool RandomNumberGenerator & rng
 
uint8_t size_t const std::string const uint8_t salt []
 
uint8_t size_t const std::string const uint8_t size_t salt_len
 
void const uint8_t secret [32]
 
bool BigInt BigInt size_t size_t const std::vector< uint8_t > & seed
 
void uint8_t send []
 
class BOTAN_PUBLIC_API(2, 0) SHA_160 final typedef SHA_160 SHA_1
 
void newhope_polysk
 
void const newhope_polyska
 
Path_Validation_Result const Path_Validation_Restrictions const Certificate_Store & store
 
const uint64_t STREEBOG_Ax [8][256]
 
const uint64_t STREEBOG_C [12][8]
 
class BOTAN_PUBLIC_API(2, 0) McEliece_PublicKey class BOTAN_PUBLIC_API(2, 0) McEliece_PrivateKey final size_t t
 
class BOTAN_PUBLIC_API(2, 0) Cipher_Mode_Filter final typedef Cipher_Mode_Filter Transform_Filter
 
Path_Validation_Result const Path_Validation_Restrictions const std::vector< Certificate_Store * > & trusted_roots
 
void const uint8_t size_t bool uppercase = true)
 
Path_Validation_Result const Path_Validation_Restrictions const std::vector< Certificate_Store * > const std::string Usage_Type usage = Usage_Type::UNSPECIFIED
 
std::vector< uint8_t > const std::string & user_id
 
Path_Validation_Result const Path_Validation_Restrictions const std::vector< Certificate_Store * > const std::string Usage_Type std::chrono::system_clock::time_point validation_time = std::chrono::system_clock::now()
 
secure_vector< word > & ws
 
BigInt const BigInt & x
 
class BOTAN_PUBLIC_API(2, 0) Curve25519_PublicKey class BOTAN_PUBLIC_API(2, 0) Curve25519_PrivateKey final typedef Curve25519_PublicKey X25519_PublicKey
 
const OctetString & y
 
const BigInt & z1
 
const BigInt const PointGFp const BigInt & z2
 

Detailed Description

(C) 2018 Jack Lloyd (C) 2018 Ribose Inc

Botan is released under the Simplified BSD License (see license.txt)

Ordinary applications should never need to include or use this header. It is exposed only for specialized applications which want to implement new versions of public key crypto without merging them as changes to the library. One actual example of such usage is an application which creates RSA signatures using a custom TPM library. Unless you're doing something like that, you don't need anything here. Instead use pubkey.h which wraps these types safely and provides a stable application-oriented API.

XMSS WOTS Addressed Private Key (C) 2016 Matthias Gierlings

Botan is released under the Simplified BSD License (see license.txt)

XMSS WOTS Addressed Public Key (C) 2016,2017 Matthias Gierlings

Botan is released under the Simplified BSD License (see license.txt)

Typedef Documentation

◆ byte

using Botan::byte = typedef std::uint8_t

Definition at line 89 of file types.h.

◆ CertificatePathStatusCodes

This type represents the validation status of an entire certificate path. There is one set of status codes for each certificate in the path.

Definition at line 29 of file x509path.h.

◆ EC_Domain_Params

typedef EC_Group Botan::EC_Domain_Params

Definition at line 370 of file ec_group.h.

◆ fe

Definition at line 134 of file ed25519_fe.h.

◆ gf2m

typedef uint16_t Botan::gf2m

Definition at line 20 of file gf2m_small_m.h.

◆ InitializationVector

using Botan::InitializationVector = typedef OctetString

Alternate name for octet string showing intent to use as an IV

Definition at line 146 of file symkey.h.

◆ lock_guard_type

template<typename T >
using Botan::lock_guard_type = typedef lock_guard<T>

Definition at line 52 of file mutex.h.

◆ mutex_type

Definition at line 51 of file mutex.h.

◆ PKCS8_PrivateKey

typedef Private_Key Botan::PKCS8_PrivateKey

Definition at line 302 of file pk_keys.h.

◆ poly

Definition at line 20 of file newhope.cpp.

◆ RNG

typedef RandomNumberGenerator Botan::RNG

Convenience typedef

Definition at line 177 of file rng.h.

◆ S2K

typedef PBKDF Botan::S2K

Definition at line 219 of file pbkdf.h.

◆ s32bit

using Botan::s32bit = typedef std::int32_t

Definition at line 93 of file types.h.

◆ secure_deque

template<typename T >
using Botan::secure_deque = typedef std::deque<T, secure_allocator<T> >

Definition at line 66 of file secmem.h.

◆ secure_vector

template<typename T >
using Botan::secure_vector = typedef std::vector<T, secure_allocator<T> >

Definition at line 65 of file secmem.h.

◆ SecureVector

template<typename T >
using Botan::SecureVector = typedef secure_vector<T>

Definition at line 69 of file secmem.h.

◆ SM2_Encryption_PrivateKey

typedef SM2_PrivateKey Botan::SM2_Encryption_PrivateKey

Definition at line 120 of file sm2.h.

◆ SM2_Encryption_PublicKey

typedef SM2_PublicKey Botan::SM2_Encryption_PublicKey

Definition at line 117 of file sm2.h.

◆ SM2_Signature_PrivateKey

typedef SM2_PrivateKey Botan::SM2_Signature_PrivateKey

Definition at line 119 of file sm2.h.

◆ SM2_Signature_PublicKey

typedef SM2_PublicKey Botan::SM2_Signature_PublicKey

Definition at line 116 of file sm2.h.

◆ SymmetricKey

using Botan::SymmetricKey = typedef OctetString

Alternate name for octet string showing intent to use as a key

Definition at line 141 of file symkey.h.

◆ Transformation_Filter

Definition at line 54 of file cipher_filter.h.

◆ u16bit

using Botan::u16bit = typedef std::uint16_t

Definition at line 90 of file types.h.

◆ u32bit

using Botan::u32bit = typedef std::uint32_t

Definition at line 91 of file types.h.

◆ u64bit

using Botan::u64bit = typedef std::uint64_t

Definition at line 92 of file types.h.

◆ wots_keysig_t

typedef std::vector< secure_vector< uint8_t > > Botan::wots_keysig_t

Definition at line 19 of file xmss_common_ops.h.

◆ X25519_PrivateKey

typedef Curve25519_PrivateKey Botan::X25519_PrivateKey

Definition at line 103 of file curve25519.h.

◆ X509_PublicKey

typedef Public_Key Botan::X509_PublicKey

Definition at line 301 of file pk_keys.h.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
SM3_BLOCK_BYTES 
SM3_DIGEST_BYTES 

Definition at line 15 of file sm3.h.

15  {
16  SM3_BLOCK_BYTES = 64,
17  SM3_DIGEST_BYTES = 32
18 };

◆ ASN1_Tag

enum Botan::ASN1_Tag : uint32_t

ASN.1 Type and Class Tags

Enumerator
UNIVERSAL 
APPLICATION 
CONTEXT_SPECIFIC 
CONSTRUCTED 
PRIVATE 
EOC 
BOOLEAN 
INTEGER 
BIT_STRING 
OCTET_STRING 
NULL_TAG 
OBJECT_ID 
ENUMERATED 
SEQUENCE 
SET 
UTF8_STRING 
NUMERIC_STRING 
PRINTABLE_STRING 
T61_STRING 
IA5_STRING 
VISIBLE_STRING 
UNIVERSAL_STRING 
BMP_STRING 
UTC_TIME 
GENERALIZED_TIME 
UTC_OR_GENERALIZED_TIME 
NO_OBJECT 
DIRECTORY_STRING 

Definition at line 22 of file asn1_obj.h.

22  : uint32_t {
23  UNIVERSAL = 0x00,
24  APPLICATION = 0x40,
25  CONTEXT_SPECIFIC = 0x80,
26 
27  CONSTRUCTED = 0x20,
28 
30 
31  EOC = 0x00,
32  BOOLEAN = 0x01,
33  INTEGER = 0x02,
34  BIT_STRING = 0x03,
35  OCTET_STRING = 0x04,
36  NULL_TAG = 0x05,
37  OBJECT_ID = 0x06,
38  ENUMERATED = 0x0A,
39  SEQUENCE = 0x10,
40  SET = 0x11,
41 
42  UTF8_STRING = 0x0C,
43  NUMERIC_STRING = 0x12,
44  PRINTABLE_STRING = 0x13,
45  T61_STRING = 0x14,
46  IA5_STRING = 0x16,
47  VISIBLE_STRING = 0x1A,
48  UNIVERSAL_STRING = 0x1C,
49  BMP_STRING = 0x1E,
50 
51  UTC_TIME = 0x17,
52  GENERALIZED_TIME = 0x18,
54 
55  NO_OBJECT = 0xFF00,
56  DIRECTORY_STRING = 0xFF01
57 };

◆ Certificate_Status_Code

Certificate validation status code Warning: reflect any changes to this in botan_cert_status_code in ffi.h

Enumerator
OK 
VERIFIED 
OCSP_RESPONSE_GOOD 
OCSP_SIGNATURE_OK 
VALID_CRL_CHECKED 
OCSP_NO_HTTP 
FIRST_WARNING_STATUS 
CERT_SERIAL_NEGATIVE 
DN_TOO_LONG 
OSCP_NO_REVOCATION_URL 
OSCP_SERVER_NOT_AVAILABLE 
FIRST_ERROR_STATUS 
SIGNATURE_METHOD_TOO_WEAK 
UNTRUSTED_HASH 
NO_REVOCATION_DATA 
NO_MATCHING_CRLDP 
CERT_NOT_YET_VALID 
CERT_HAS_EXPIRED 
OCSP_NOT_YET_VALID 
OCSP_HAS_EXPIRED 
CRL_NOT_YET_VALID 
CRL_HAS_EXPIRED 
CERT_ISSUER_NOT_FOUND 
CANNOT_ESTABLISH_TRUST 
CERT_CHAIN_LOOP 
CHAIN_LACKS_TRUST_ROOT 
CHAIN_NAME_MISMATCH 
POLICY_ERROR 
INVALID_USAGE 
CERT_CHAIN_TOO_LONG 
CA_CERT_NOT_FOR_CERT_ISSUER 
NAME_CONSTRAINT_ERROR 
CA_CERT_NOT_FOR_CRL_ISSUER 
OCSP_CERT_NOT_LISTED 
OCSP_BAD_STATUS 
CERT_NAME_NOMATCH 
UNKNOWN_CRITICAL_EXTENSION 
DUPLICATE_CERT_EXTENSION 
OCSP_SIGNATURE_ERROR 
OCSP_ISSUER_NOT_FOUND 
OCSP_RESPONSE_MISSING_KEYUSAGE 
OCSP_RESPONSE_INVALID 
EXT_IN_V1_V2_CERT 
DUPLICATE_CERT_POLICY 
CERT_IS_REVOKED 
CRL_BAD_SIGNATURE 
SIGNATURE_ERROR 
CERT_PUBKEY_INVALID 
SIGNATURE_ALGO_UNKNOWN 
SIGNATURE_ALGO_BAD_PARAMS 

Definition at line 19 of file cert_status.h.

19  {
20  OK = 0,
21  VERIFIED = 0,
22 
23  // Revocation status
27  OCSP_NO_HTTP = 4,
28 
29  // Warnings
32  DN_TOO_LONG = 501,
35 
36  // Errors
37  FIRST_ERROR_STATUS = 1000,
38 
40  UNTRUSTED_HASH = 1001,
41  NO_REVOCATION_DATA = 1002,
42  NO_MATCHING_CRLDP = 1003,
43 
44  // Time problems
45  CERT_NOT_YET_VALID = 2000,
46  CERT_HAS_EXPIRED = 2001,
47  OCSP_NOT_YET_VALID = 2002,
48  OCSP_HAS_EXPIRED = 2003,
49  CRL_NOT_YET_VALID = 2004,
50  CRL_HAS_EXPIRED = 2005,
51 
52  // Chain generation problems
53  CERT_ISSUER_NOT_FOUND = 3000,
55  CERT_CHAIN_LOOP = 3002,
57  CHAIN_NAME_MISMATCH = 3004,
58 
59  // Validation errors
60  POLICY_ERROR = 4000,
61  INVALID_USAGE = 4001,
62  CERT_CHAIN_TOO_LONG = 4002,
64  NAME_CONSTRAINT_ERROR = 4004,
65 
66  // Revocation errors
68  OCSP_CERT_NOT_LISTED = 4006,
69  OCSP_BAD_STATUS = 4007,
70 
71  // Other problems
72  CERT_NAME_NOMATCH = 4008,
75  OCSP_SIGNATURE_ERROR = 4501,
76  OCSP_ISSUER_NOT_FOUND = 4502,
78  OCSP_RESPONSE_INVALID = 4504,
79  EXT_IN_V1_V2_CERT = 4505,
80  DUPLICATE_CERT_POLICY = 4506,
81 
82  // Hard failures
83  CERT_IS_REVOKED = 5000,
84  CRL_BAD_SIGNATURE = 5001,
85  SIGNATURE_ERROR = 5002,
86  CERT_PUBKEY_INVALID = 5003,
89 };

◆ Character_Set

The different charsets (nominally) supported by Botan.

Enumerator
LOCAL_CHARSET 
UCS2_CHARSET 
UTF8_CHARSET 
LATIN1_CHARSET 

Definition at line 41 of file charset.h.

◆ Cipher_Dir

enum Botan::Cipher_Dir : int

The two possible directions for cipher filters, determining whether they actually perform encryption or decryption.

Enumerator
ENCRYPTION 
DECRYPTION 

Definition at line 23 of file cipher_mode.h.

◆ CRL_Code

enum Botan::CRL_Code : uint32_t

X.509v2 CRL Reason Code.

Enumerator
UNSPECIFIED 
KEY_COMPROMISE 
CA_COMPROMISE 
AFFILIATION_CHANGED 
SUPERSEDED 
CESSATION_OF_OPERATION 
CERTIFICATE_HOLD 
REMOVE_FROM_CRL 
PRIVLEDGE_WITHDRAWN 
PRIVILEGE_WITHDRAWN 
AA_COMPROMISE 
DELETE_CRL_ENTRY 
OCSP_GOOD 
OCSP_UNKNOWN 

Definition at line 22 of file crl_ent.h.

◆ Decoder_Checking

This is the abstract Fanout_Filter base class.The type of checking to be performed by decoders: NONE - no checks, IGNORE_WS - perform checks, but ignore whitespaces, FULL_CHECK - perform checks, also complain about white spaces.

Enumerator
NONE 
IGNORE_WS 
FULL_CHECK 

Definition at line 171 of file filter.h.

◆ EC_Group_Encoding

This class represents elliptic curce domain parameters

Enumerator
EC_DOMPAR_ENC_EXPLICIT 
EC_DOMPAR_ENC_IMPLICITCA 
EC_DOMPAR_ENC_OID 

Definition at line 23 of file ec_group.h.

◆ ECIES_Flags

enum Botan::ECIES_Flags : uint32_t
strong
Enumerator
NONE 
SINGLE_HASH_MODE 

if set: prefix the input of the (ecdh) key agreement with the encoded (ephemeral) public key

COFACTOR_MODE 

(decryption only) if set: use cofactor multiplication during (ecdh) key agreement

OLD_COFACTOR_MODE 

if set: use ecdhc instead of ecdh

CHECK_MODE 

(decryption only) if set: test if the (ephemeral) public key is on the curve

Definition at line 27 of file ecies.h.

27  : uint32_t
28  {
29  NONE = 0,
30 
31  /// if set: prefix the input of the (ecdh) key agreement with the encoded (ephemeral) public key
32  SINGLE_HASH_MODE = 1,
33 
34  /// (decryption only) if set: use cofactor multiplication during (ecdh) key agreement
35  COFACTOR_MODE = 2,
36 
37  /// if set: use ecdhc instead of ecdh
39 
40  /// (decryption only) if set: test if the (ephemeral) public key is on the curve
41  CHECK_MODE = 8
42  };
(decryption only) if set: test if the (ephemeral) public key is on the curve
if set: prefix the input of the (ecdh) key agreement with the encoded (ephemeral) public key
if set: use ecdhc instead of ecdh
(decryption only) if set: use cofactor multiplication during (ecdh) key agreement

◆ ErrorType

enum Botan::ErrorType
strong

Different types of errors that might occur

Enumerator
Unknown 

Some unknown error

SystemError 

An error while calling a system interface

NotImplemented 

An operation seems valid, but not supported by the current version

OutOfMemory 

Memory allocation failure

InternalError 

An internal error occurred

IoError 

An I/O error occurred

InvalidObjectState 

Invalid object state

KeyNotSet 

A key was not set on an object when this is required

InvalidArgument 

The application provided an argument which is invalid

InvalidKeyLength 

A key with invalid length was provided

InvalidNonceLength 

A nonce with invalid length was provided

LookupError 

An object type was requested but cannot be found

EncodingFailure 

Encoding a message or datum failed

DecodingFailure 

Decoding a message or datum failed

TLSError 

A TLS error (error_code will be the alert type)

HttpError 

An error during an HTTP operation

InvalidTag 

A message with an invalid authentication tag was detected

OpenSSLError 

An error when calling OpenSSL

CommonCryptoError 

An error when interacting with CommonCrypto API

Pkcs11Error 

An error when interacting with a PKCS11 device

TPMError 

An error when interacting with a TPM device

ZlibError 

An error when interacting with zlib

Bzip2Error 

An error when interacting with bzip2

LzmaError 

An error when interacting with lzma

Definition at line 20 of file exceptn.h.

20  {
21  /** Some unknown error */
22  Unknown = 1,
23  /** An error while calling a system interface */
25  /** An operation seems valid, but not supported by the current version */
27  /** Memory allocation failure */
29  /** An internal error occurred */
31  /** An I/O error occurred */
32  IoError,
33 
34  /** Invalid object state */
35  InvalidObjectState = 100,
36  /** A key was not set on an object when this is required */
37  KeyNotSet,
38  /** The application provided an argument which is invalid */
40  /** A key with invalid length was provided */
42  /** A nonce with invalid length was provided */
44  /** An object type was requested but cannot be found */
46  /** Encoding a message or datum failed */
48  /** Decoding a message or datum failed */
50  /** A TLS error (error_code will be the alert type) */
51  TLSError,
52  /** An error during an HTTP operation */
53  HttpError,
54  /** A message with an invalid authentication tag was detected */
55  InvalidTag,
56 
57  /** An error when calling OpenSSL */
58  OpenSSLError = 200,
59  /** An error when interacting with CommonCrypto API */
61  /** An error when interacting with a PKCS11 device */
63  /** An error when interacting with a TPM device */
64  TPMError,
65 
66  /** An error when interacting with zlib */
67  ZlibError = 300,
68  /** An error when interacting with bzip2 */
69  Bzip2Error,
70  /** An error when interacting with lzma */
71  LzmaError,
72 
73 };

◆ Key_Constraints

X.509v3 Key Constraints. If updating update copy in ffi.h

Enumerator
NO_CONSTRAINTS 
DIGITAL_SIGNATURE 
NON_REPUDIATION 
KEY_ENCIPHERMENT 
DATA_ENCIPHERMENT 
KEY_AGREEMENT 
KEY_CERT_SIGN 
CRL_SIGN 
ENCIPHER_ONLY 
DECIPHER_ONLY 

Definition at line 21 of file key_constraint.h.

21  {
22  NO_CONSTRAINTS = 0,
23  DIGITAL_SIGNATURE = 1 << 15,
24  NON_REPUDIATION = 1 << 14,
25  KEY_ENCIPHERMENT = 1 << 13,
26  DATA_ENCIPHERMENT = 1 << 12,
27  KEY_AGREEMENT = 1 << 11,
28  KEY_CERT_SIGN = 1 << 10,
29  CRL_SIGN = 1 << 9,
30  ENCIPHER_ONLY = 1 << 8,
31  DECIPHER_ONLY = 1 << 7
32 };
Definition: ffi.h:1489

◆ Newhope_Mode

enum Botan::Newhope_Mode
strong

This chooses the XOF + hash for NewHope The official NewHope specification and reference implementation use SHA-3 and SHAKE-128. BoringSSL instead uses SHA-256 and AES-128 in CTR mode. CECPQ1 (x25519+NewHope) always uses BoringSSL's mode

Enumerator
SHA3 
BoringSSL 

Definition at line 58 of file newhope.h.

◆ Newhope_Params

Enumerator
NEWHOPE_SENDABYTES 
NEWHOPE_SENDBBYTES 
NEWHOPE_OFFER_BYTES 
NEWHOPE_ACCEPT_BYTES 
NEWHOPE_SHARED_KEY_BYTES 
NEWHOPE_SEED_BYTES 
NEWHOPE_POLY_BYTES 
CECPQ1_OFFER_BYTES 
CECPQ1_ACCEPT_BYTES 
CECPQ1_SHARED_KEY_BYTES 

Definition at line 35 of file newhope.h.

◆ Signature_Format

The two types of signature format supported by Botan.

Enumerator
IEEE_1363 
DER_SEQUENCE 

Definition at line 28 of file pubkey.h.

◆ TPM_Storage_Type

enum Botan::TPM_Storage_Type
finalstrong
Enumerator
User 
System 

Definition at line 102 of file tpm.h.

◆ Usage_Type

enum Botan::Usage_Type
strong
Enumerator
UNSPECIFIED 
TLS_SERVER_AUTH 
TLS_CLIENT_AUTH 
CERTIFICATE_AUTHORITY 
OCSP_RESPONDER 

Definition at line 25 of file x509cert.h.

◆ X509_Encoding

The two types of X509 encoding supported by Botan. This enum is not used anymore, and will be removed in a future major release.

Enumerator
RAW_BER 
PEM 

Definition at line 25 of file x509_key.h.

Function Documentation

◆ abs()

BigInt Botan::abs ( const BigInt &  n)
inline

Return the absolute value

Parameters
nan integer
Returns
absolute value of n

Definition at line 55 of file numthry.h.

55 { return n.abs(); }
botan_rng_t size_t n
Definition: ffi.h:943

References n.

◆ allocate_memory()

BOTAN_MALLOC_FN void* Botan::allocate_memory ( size_t  elems,
size_t  elem_size 
)

Definition at line 18 of file mem_ops.cpp.

19  {
20 #if defined(BOTAN_HAS_LOCKING_ALLOCATOR)
21  if(void* p = mlock_allocator::instance().allocate(elems, elem_size))
22  return p;
23 #endif
24 
25  void* ptr = std::calloc(elems, elem_size);
26  if(!ptr)
27  throw std::bad_alloc();
28  return ptr;
29  }
size_t elem_size
Definition: mem_ops.h:25
size_t const char const uint8_t size_t size_t size_t size_t p
Definition: ffi.h:624
size_t elems
Definition: mem_ops.h:33

References elem_size, elems, and p.

Referenced by Botan::secure_allocator< T >::allocate().

◆ almost_montgomery_inverse()

size_t Botan::almost_montgomery_inverse ( BigInt &  result,
const BigInt &  a,
const BigInt &  p 
)

Definition at line 102 of file numthry.cpp.

105  {
106  size_t k = 0;
107 
108  BigInt u = p, v = a, r = 0, s = 1;
109 
110  while(v > 0)
111  {
112  if(u.is_even())
113  {
114  u >>= 1;
115  s <<= 1;
116  }
117  else if(v.is_even())
118  {
119  v >>= 1;
120  r <<= 1;
121  }
122  else if(u > v)
123  {
124  u -= v;
125  u >>= 1;
126  r += s;
127  s <<= 1;
128  }
129  else
130  {
131  v -= u;
132  v >>= 1;
133  s += r;
134  r <<= 1;
135  }
136 
137  ++k;
138  }
139 
140  if(r >= p)
141  {
142  r -= p;
143  }
144 
145  result = p - r;
146 
147  return k;
148  }
size_t const char const uint8_t size_t size_t size_t r
Definition: ffi.h:624
size_t const BigInt & a
Definition: numthry.h:111
size_t const char const uint8_t size_t size_t size_t size_t p
Definition: ffi.h:624

References a, p, and r.

Referenced by normalized_montgomery_inverse().

◆ aont_package()

void Botan::aont_package ( RandomNumberGenerator &  rng,
BlockCipher *  cipher,
const uint8_t  input[],
size_t  input_len,
uint8_t  output[] 
)

Definition at line 17 of file package.cpp.

21  {
22  if(input_len <= 1)
23  throw Encoding_Error("Package transform cannot encode small inputs");
24 
25  const size_t BLOCK_SIZE = cipher->block_size();
26 
27  if(!cipher->valid_keylength(BLOCK_SIZE))
28  throw Invalid_Argument("AONT::package: Invalid cipher");
29 
30  // The all-zero string which is used both as the CTR IV and as K0
31  const std::string all_zeros(BLOCK_SIZE*2, '0');
32 
33  SymmetricKey package_key(rng, BLOCK_SIZE);
34 
35  Pipe pipe(new StreamCipher_Filter(new CTR_BE(cipher), package_key));
36 
37  pipe.process_msg(input, input_len);
38  const size_t remaining = pipe.remaining();
39  BOTAN_ASSERT_EQUAL(remaining, pipe.read(output, remaining), "Expected read size");
40 
41  // Set K0 (the all zero key)
42  cipher->set_key(SymmetricKey(all_zeros));
43 
44  secure_vector<uint8_t> buf(BLOCK_SIZE);
45 
46  const size_t blocks =
47  (input_len + BLOCK_SIZE - 1) / BLOCK_SIZE;
48 
49  uint8_t* final_block = output + input_len;
50  clear_mem(final_block, BLOCK_SIZE);
51 
52  // XOR the hash blocks into the final block
53  for(size_t i = 0; i != blocks; ++i)
54  {
55  const size_t left = std::min<size_t>(BLOCK_SIZE,
56  input_len - BLOCK_SIZE * i);
57 
58  zeroise(buf);
59  copy_mem(buf.data(), output + (BLOCK_SIZE * i), left);
60 
61  for(size_t j = 0; j != sizeof(i); ++j)
62  buf[BLOCK_SIZE - 1 - j] ^= get_byte(sizeof(i)-1-j, i);
63 
64  cipher->encrypt(buf.data());
65 
66  xor_buf(final_block, buf.data(), BLOCK_SIZE);
67  }
68 
69  // XOR the random package key into the final block
70  xor_buf(final_block, package_key.begin(), BLOCK_SIZE);
71  }
uint32_t uint8_t output[]
Definition: ffi.h:509
botan_rng_t rng
Definition: ffi.h:856
void clear_mem(T *ptr, size_t n)
Definition: mem_ops.h:111
const uint8_t * buf
Definition: ffi.h:368
constexpr uint8_t get_byte(size_t byte_num, T input)
Definition: loadstor.h:39
void BlockCipher const uint8_t size_t input_len
Definition: package.h:29
const uint8_t uint8_t size_t blocks
Definition: ffi.h:686
void xor_buf(uint8_t out[], const uint8_t in[], size_t length)
Definition: mem_ops.h:202
#define BOTAN_ASSERT_EQUAL(expr1, expr2, assertion_made)
Definition: assert.h:81
void BlockCipher * cipher
Definition: package.h:29
int Pipe & pipe
Definition: fd_unix.h:23
void copy_mem(T *out, const T *in, size_t n)
Definition: mem_ops.h:122
OctetString SymmetricKey
Definition: symkey.h:141
size_t const uint8_t input[]
Definition: base32.h:30
void zeroise(std::vector< T, Alloc > &vec)
Definition: secmem.h:160

References blocks, BOTAN_ASSERT_EQUAL, buf, cipher, clear_mem(), copy_mem(), get_byte(), input, input_len, output, pipe, rng, xor_buf(), and zeroise().

◆ aont_unpackage()

void Botan::aont_unpackage ( BlockCipher *  cipher,
const uint8_t  input[],
size_t  input_len,
uint8_t  output[] 
)

Definition at line 73 of file package.cpp.

76  {
77  const size_t BLOCK_SIZE = cipher->block_size();
78 
79  if(!cipher->valid_keylength(BLOCK_SIZE))
80  throw Invalid_Argument("AONT::unpackage: Invalid cipher");
81 
82  if(input_len < BLOCK_SIZE)
83  throw Invalid_Argument("AONT::unpackage: Input too short");
84 
85  // The all-zero string which is used both as the CTR IV and as K0
86  const std::string all_zeros(BLOCK_SIZE*2, '0');
87 
88  cipher->set_key(SymmetricKey(all_zeros));
89 
90  secure_vector<uint8_t> package_key(BLOCK_SIZE);
91  secure_vector<uint8_t> buf(BLOCK_SIZE);
92 
93  // Copy the package key (masked with the block hashes)
94  copy_mem(package_key.data(),
95  input + (input_len - BLOCK_SIZE),
96  BLOCK_SIZE);
97 
98  const size_t blocks = ((input_len - 1) / BLOCK_SIZE);
99 
100  // XOR the blocks into the package key bits
101  for(size_t i = 0; i != blocks; ++i)
102  {
103  const size_t left = std::min<size_t>(BLOCK_SIZE,
104  input_len - BLOCK_SIZE * (i+1));
105 
106  zeroise(buf);
107  copy_mem(buf.data(), input + (BLOCK_SIZE * i), left);
108 
109  for(size_t j = 0; j != sizeof(i); ++j)
110  buf[BLOCK_SIZE - 1 - j] ^= get_byte(sizeof(i)-1-j, i);
111 
112  cipher->encrypt(buf.data());
113 
114  xor_buf(package_key.data(), buf.data(), BLOCK_SIZE);
115  }
116 
117  Pipe pipe(new StreamCipher_Filter(new CTR_BE(cipher), package_key));
118 
119  pipe.process_msg(input, input_len - BLOCK_SIZE);
120 
121  const size_t remaining = pipe.remaining();
122  BOTAN_ASSERT_EQUAL(remaining, pipe.read(output, remaining), "Expected read size");
123  }
uint32_t uint8_t output[]
Definition: ffi.h:509
const uint8_t * buf
Definition: ffi.h:368
constexpr uint8_t get_byte(size_t byte_num, T input)
Definition: loadstor.h:39
void BlockCipher const uint8_t size_t input_len
Definition: package.h:29
const uint8_t uint8_t size_t blocks
Definition: ffi.h:686
void xor_buf(uint8_t out[], const uint8_t in[], size_t length)
Definition: mem_ops.h:202
#define BOTAN_ASSERT_EQUAL(expr1, expr2, assertion_made)
Definition: assert.h:81
void BlockCipher * cipher
Definition: package.h:29
int Pipe & pipe
Definition: fd_unix.h:23
void copy_mem(T *out, const T *in, size_t n)
Definition: mem_ops.h:122
OctetString SymmetricKey
Definition: symkey.h:141
size_t const uint8_t input[]
Definition: base32.h:30
void zeroise(std::vector< T, Alloc > &vec)
Definition: secmem.h:160

References blocks, BOTAN_ASSERT_EQUAL, buf, cipher, copy_mem(), get_byte(), input, input_len, output, pipe, xor_buf(), and zeroise().

◆ asn1_class_to_string()

std::string BOTAN_UNSTABLE_API Botan::asn1_class_to_string ( ASN1_Tag  type)

Definition at line 87 of file asn1_obj.cpp.

88  {
89  switch(type)
90  {
91  case UNIVERSAL:
92  return "UNIVERSAL";
93  case CONSTRUCTED:
94  return "CONSTRUCTED";
95  case CONTEXT_SPECIFIC:
96  return "CONTEXT_SPECIFIC";
97  case APPLICATION:
98  return "APPLICATION";
100  return "PRIVATE";
101  case Botan::NO_OBJECT:
102  return "NO_OBJECT";
103  default:
104  return "CLASS(" + std::to_string(static_cast<size_t>(type)) + ")";
105  }
106  }
std::string to_string(const BER_Object &obj)
Definition: asn1_obj.cpp:210
MechanismType type

References APPLICATION, CONSTRUCTED, CONTEXT_SPECIFIC, NO_OBJECT, Botan::ASN1::to_string(), type, and UNIVERSAL.

◆ asn1_tag_to_string()

std::string BOTAN_UNSTABLE_API Botan::asn1_tag_to_string ( ASN1_Tag  type)

Definition at line 108 of file asn1_obj.cpp.

109  {
110  switch(type)
111  {
112  case Botan::SEQUENCE:
113  return "SEQUENCE";
114 
115  case Botan::SET:
116  return "SET";
117 
119  return "PRINTABLE STRING";
120 
122  return "NUMERIC STRING";
123 
124  case Botan::IA5_STRING:
125  return "IA5 STRING";
126 
127  case Botan::T61_STRING:
128  return "T61 STRING";
129 
130  case Botan::UTF8_STRING:
131  return "UTF8 STRING";
132 
134  return "VISIBLE STRING";
135 
136  case Botan::BMP_STRING:
137  return "BMP STRING";
138 
139  case Botan::UTC_TIME:
140  return "UTC TIME";
141 
143  return "GENERALIZED TIME";
144 
145  case Botan::OCTET_STRING:
146  return "OCTET STRING";
147 
148  case Botan::BIT_STRING:
149  return "BIT STRING";
150 
151  case Botan::ENUMERATED:
152  return "ENUMERATED";
153 
154  case Botan::INTEGER:
155  return "INTEGER";
156 
157  case Botan::NULL_TAG:
158  return "NULL";
159 
160  case Botan::OBJECT_ID:
161  return "OBJECT";
162 
163  case Botan::BOOLEAN:
164  return "BOOLEAN";
165 
166  case Botan::NO_OBJECT:
167  return "NO_OBJECT";
168 
169  default:
170  return "TAG(" + std::to_string(static_cast<size_t>(type)) + ")";
171  }
172  }
std::string to_string(const BER_Object &obj)
Definition: asn1_obj.cpp:210
MechanismType type

References BIT_STRING, BMP_STRING, BOOLEAN, ENUMERATED, GENERALIZED_TIME, IA5_STRING, INTEGER, NO_OBJECT, NULL_TAG, NUMERIC_STRING, OBJECT_ID, OCTET_STRING, PRINTABLE_STRING, SEQUENCE, SET, T61_STRING, Botan::ASN1::to_string(), type, UTC_TIME, UTF8_STRING, and VISIBLE_STRING.

◆ assertion_failure()

void Botan::assertion_failure ( const char *  expr_str,
const char *  assertion_made,
const char *  func,
const char *  file,
int  line 
)

Definition at line 31 of file assert.cpp.

36  {
37  std::ostringstream format;
38 
39  format << "False assertion ";
40 
41  if(assertion_made && assertion_made[0] != 0)
42  format << "'" << assertion_made << "' (expression " << expr_str << ") ";
43  else
44  format << expr_str << " ";
45 
46  if(func)
47  format << "in " << func << " ";
48 
49  format << "@" << file << ":" << line;
50 
51  throw Internal_Error(format.str());
52  }
BOTAN_NORETURN void const char * assertion_made
Definition: assert.h:23
BOTAN_NORETURN void const char const char const char * file
Definition: assert.h:23
BOTAN_NORETURN void const char const char const char int line
Definition: assert.h:23
BOTAN_NORETURN void const char const char * func
Definition: assert.h:23

References assertion_made, file, func, and line.

◆ base32_decode() [1/5]

size_t Botan::base32_decode ( uint8_t  out[],
const char  in[],
size_t  input_length,
size_t &  input_consumed,
bool  final_inputs,
bool  ignore_ws 
)

Definition at line 186 of file base32.cpp.

192  {
194  }
uint32_t uint8_t size_t size_t const uint8_t size_t size_t * input_consumed
Definition: ffi.h:509
size_t base_decode(Base &&base, uint8_t output[], const char input[], size_t input_length, size_t &input_consumed, bool final_inputs, bool ignore_ws=true)
Definition: codec_base.h:124
size_t const uint8_t size_t input_length
Definition: base32.h:30
const uint8_t * in
Definition: ffi.h:294
size_t char * out
Definition: ffi.h:162
size_t const uint8_t size_t size_t bool final_inputs
Definition: base32.h:30
size_t const char size_t size_t bool bool ignore_ws
Definition: base32.h:75

References base_decode(), final_inputs, ignore_ws, in, input_consumed, input_length, and out.

Referenced by base32_decode().

◆ base32_decode() [2/5]

size_t Botan::base32_decode ( uint8_t  output[],
const char  input[],
size_t  input_length,
bool  ignore_ws 
)

Definition at line 196 of file base32.cpp.

200  {
201  return base_decode_full(Base32(), output, input, input_length, ignore_ws);
202  }
uint32_t uint8_t output[]
Definition: ffi.h:509
size_t const uint8_t size_t input_length
Definition: base32.h:30
size_t const char size_t size_t bool bool ignore_ws
Definition: base32.h:75
size_t const uint8_t input[]
Definition: base32.h:30
size_t base_decode_full(Base &&base, uint8_t output[], const char input[], size_t input_length, bool ignore_ws)
Definition: codec_base.h:189

References base_decode_full(), ignore_ws, input, input_length, and output.

◆ base32_decode() [3/5]

size_t Botan::base32_decode ( uint8_t  output[],
const std::string &  input,
bool  ignore_ws 
)

Definition at line 204 of file base32.cpp.

207  {
208  return base32_decode(output, input.data(), input.length(), ignore_ws);
209  }
uint32_t uint8_t output[]
Definition: ffi.h:509
secure_vector< uint8_t > base32_decode(const std::string &input, bool ignore_ws)
Definition: base32.cpp:218
size_t const char size_t size_t bool bool ignore_ws
Definition: base32.h:75
size_t const uint8_t input[]
Definition: base32.h:30

References base32_decode(), ignore_ws, input, and output.

◆ base32_decode() [4/5]

secure_vector<uint8_t> Botan::base32_decode ( const char  input[],
size_t  input_length,
bool  ignore_ws 
)

Definition at line 211 of file base32.cpp.

214  {
215  return base_decode_to_vec<secure_vector<uint8_t>>(Base32(), input, input_length, ignore_ws);
216  }
size_t const uint8_t size_t input_length
Definition: base32.h:30
size_t const char size_t size_t bool bool ignore_ws
Definition: base32.h:75
size_t const uint8_t input[]
Definition: base32.h:30

References ignore_ws, input, and input_length.

◆ base32_decode() [5/5]

secure_vector<uint8_t> Botan::base32_decode ( const std::string &  input,
bool  ignore_ws 
)

Definition at line 218 of file base32.cpp.

220  {
221  return base32_decode(input.data(), input.size(), ignore_ws);
222  }
secure_vector< uint8_t > base32_decode(const std::string &input, bool ignore_ws)
Definition: base32.cpp:218
size_t const char size_t size_t bool bool ignore_ws
Definition: base32.h:75
size_t const uint8_t input[]
Definition: base32.h:30

References base32_decode(), ignore_ws, and input.

◆ base32_encode() [1/3]

template<typename Alloc >
std::string Botan::base32_encode ( const std::vector< uint8_t, Alloc > &  input)

Perform base32 encoding

Parameters
inputsome input
Returns
base32 representation of input

Definition at line 50 of file base32.h.

51  {
52  return base32_encode(input.data(), input.size());
53  }
size_t const uint8_t input[]
Definition: base32.h:30
std::string base32_encode(const std::vector< uint8_t, Alloc > &input)
Definition: base32.h:50

References base32_encode(), and input.

◆ base32_encode() [2/3]

size_t Botan::base32_encode ( char  out[],
const uint8_t  in[],
size_t  input_length,
size_t &  input_consumed,
bool  final_inputs 
)

Definition at line 171 of file base32.cpp.

176  {
178  }
uint32_t uint8_t size_t size_t const uint8_t size_t size_t * input_consumed
Definition: ffi.h:509
size_t const uint8_t size_t input_length
Definition: base32.h:30
const uint8_t * in
Definition: ffi.h:294
size_t char * out
Definition: ffi.h:162
size_t const uint8_t size_t size_t bool final_inputs
Definition: base32.h:30
size_t base_encode(Base &&base, char output[], const uint8_t input[], size_t input_length, size_t &input_consumed, bool final_inputs)
Definition: codec_base.h:34

References base_encode(), final_inputs, in, input_consumed, input_length, and out.

Referenced by base32_encode().

◆ base32_encode() [3/3]

std::string Botan::base32_encode ( const uint8_t  input[],
size_t  input_length 
)

Definition at line 180 of file base32.cpp.

182  {
183  return base_encode_to_string(Base32(), input, input_length);
184  }
size_t const uint8_t size_t input_length
Definition: base32.h:30
std::string base_encode_to_string(Base &&base, const uint8_t input[], size_t input_length)
Definition: codec_base.h:86
size_t const uint8_t input[]
Definition: base32.h:30

References base_encode_to_string(), input, and input_length.

◆ base58_check_decode() [1/2]

std::vector<uint8_t> Botan::base58_check_decode ( const std::string &  s)
inline

Definition at line 76 of file base58.h.

77  {
78  return base58_check_decode(s.data(), s.size());
79  }
std::vector< uint8_t > base58_check_decode(const std::string &s)
Definition: base58.h:76

References base58_check_decode().

◆ base58_check_decode() [2/2]

std::vector<uint8_t> Botan::base58_check_decode ( const char  input[],
size_t  input_length 
)

Definition at line 160 of file base58.cpp.

161  {
162  std::vector<uint8_t> dec = base58_decode(input, input_length);
163 
164  if(dec.size() < 4)
165  throw Decoding_Error("Invalid base58 too short for checksum");
166 
167  const uint32_t computed_checksum = sha256_d_checksum(dec.data(), dec.size() - 4);
168  const uint32_t checksum = load_be<uint32_t>(&dec[dec.size()-4], 0);
169 
170  if(checksum != computed_checksum)
171  throw Decoding_Error("Invalid base58 checksum");
172 
173  dec.resize(dec.size() - 4);
174 
175  return dec;
176  }
size_t const uint8_t size_t input_length
Definition: base32.h:30
uint32_t load_be< uint32_t >(const uint8_t in[], size_t off)
Definition: loadstor.h:177
std::vector< uint8_t > base58_decode(const char input[], size_t input_length)
Definition: base58.cpp:131
size_t const uint8_t input[]
Definition: base32.h:30

References base58_decode(), input, input_length, and load_be< uint32_t >().

Referenced by base58_check_decode().

◆ base58_check_encode() [1/2]

template<typename Alloc >
std::string Botan::base58_check_encode ( const std::vector< uint8_t, Alloc > &  vec)
inline

Definition at line 66 of file base58.h.

67  {
68  return base58_check_encode(vec.data(), vec.size());
69  }
std::string base58_check_encode(const std::vector< uint8_t, Alloc > &vec)
Definition: base58.h:66
uint8_t vec[]
Definition: ffi.h:784

References base58_check_encode(), and vec.

◆ base58_check_encode() [2/2]

std::string Botan::base58_check_encode ( const uint8_t  input[],
size_t  input_length 
)

Definition at line 123 of file base58.cpp.

124  {
125  BigInt v(input, input_length);
126  v <<= 32;
127  v += sha256_d_checksum(input, input_length);
128  return base58_encode(v, count_leading_zeros(input, input_length, 0));
129  }
size_t const uint8_t size_t input_length
Definition: base32.h:30
std::string base58_encode(const uint8_t input[], size_t input_length)
Definition: base58.cpp:117
size_t const uint8_t input[]
Definition: base32.h:30

References base58_encode(), input, and input_length.

Referenced by base58_check_encode().

◆ base58_decode() [1/2]

std::vector<uint8_t> Botan::base58_decode ( const std::string &  s)
inline

Definition at line 71 of file base58.h.

72  {
73  return base58_decode(s.data(), s.size());
74  }
std::vector< uint8_t > base58_decode(const std::string &s)
Definition: base58.h:71

References base58_decode().

◆ base58_decode() [2/2]

std::vector<uint8_t> Botan::base58_decode ( const char  input[],
size_t  input_length 
)

Definition at line 131 of file base58.cpp.

132  {
133  const auto base58 = BASE58_ALPHA();
134 
135  const size_t leading_zeros = count_leading_zeros(input, input_length, base58[0]);
136 
137  BigInt v;
138 
139  for(size_t i = leading_zeros; i != input_length; ++i)
140  {
141  const char c = input[i];
142 
143  if(c == ' ' || c == '\n')
144  continue;
145 
146  const size_t idx = base58.code_for(c);
147 
148  if(idx == 0x80)
149  throw Decoding_Error("Invalid base58");
150 
151  v *= base58.radix();
152  v += idx;
153  }
154 
155  std::vector<uint8_t> output(v.bytes() + leading_zeros);
156  v.binary_encode(output.data() + leading_zeros);
157  return output;
158  }
uint32_t uint8_t output[]
Definition: ffi.h:509
size_t const uint8_t size_t input_length
Definition: base32.h:30
size_t const uint8_t input[]
Definition: base32.h:30
BigInt const BigInt const BigInt & c
Definition: numthry.h:25

References c, input, input_length, and output.

Referenced by base58_check_decode(), and base58_decode().

◆ base58_encode() [1/2]

template<typename Alloc >
std::string Botan::base58_encode ( const std::vector< uint8_t, Alloc > &  vec)
inline

Definition at line 60 of file base58.h.

61  {
62  return base58_encode(vec.data(), vec.size());
63  }
std::string base58_encode(const std::vector< uint8_t, Alloc > &vec)
Definition: base58.h:60
uint8_t vec[]
Definition: ffi.h:784

References base58_encode(), and vec.

◆ base58_encode() [2/2]

std::string Botan::base58_encode ( const uint8_t  input[],
size_t  input_length 
)

Definition at line 117 of file base58.cpp.

118  {
119  BigInt v(input, input_length);
120  return base58_encode(v, count_leading_zeros(input, input_length, 0));
121  }
size_t const uint8_t size_t input_length
Definition: base32.h:30
std::string base58_encode(const uint8_t input[], size_t input_length)
Definition: base58.cpp:117
size_t const uint8_t input[]
Definition: base32.h:30

References input, and input_length.

Referenced by base58_check_encode(), and base58_encode().

◆ base64_decode() [1/5]

size_t Botan::base64_decode ( uint8_t  out[],
const char  in[],
size_t  input_length,
size_t &  input_consumed,
bool  final_inputs,
bool  ignore_ws 
)

Definition at line 181 of file base64.cpp.

187  {
189  }
uint32_t uint8_t size_t size_t const uint8_t size_t size_t * input_consumed
Definition: ffi.h:509
size_t base_decode(Base &&base, uint8_t output[], const char input[], size_t input_length, size_t &input_consumed, bool final_inputs, bool ignore_ws=true)
Definition: codec_base.h:124
size_t const uint8_t size_t input_length
Definition: base32.h:30
const uint8_t * in
Definition: ffi.h:294
size_t char * out
Definition: ffi.h:162
size_t const uint8_t size_t size_t bool final_inputs
Definition: base32.h:30
size_t const char size_t size_t bool bool ignore_ws
Definition: base32.h:75

References base_decode(), final_inputs, ignore_ws, in, input_consumed, input_length, and out.

Referenced by base64_decode(), botan_base64_decode(), check_passhash9(), and Botan::PEM_Code::decode().

◆ base64_decode() [2/5]

size_t Botan::base64_decode ( uint8_t  output[],
const char  input[],
size_t  input_length,
bool  ignore_ws 
)

Definition at line 191 of file base64.cpp.

195  {
196  return base_decode_full(Base64(), output, input, input_length, ignore_ws);
197  }
uint32_t uint8_t output[]
Definition: ffi.h:509
size_t const uint8_t size_t input_length
Definition: base32.h:30
size_t const char size_t size_t bool bool ignore_ws
Definition: base32.h:75
size_t const uint8_t input[]
Definition: base32.h:30
size_t base_decode_full(Base &&base, uint8_t output[], const char input[], size_t input_length, bool ignore_ws)
Definition: codec_base.h:189

References base_decode_full(), ignore_ws, input, input_length, and output.

◆ base64_decode() [3/5]

size_t Botan::base64_decode ( uint8_t  output[],
const std::string &  input,
bool  ignore_ws 
)

Definition at line 199 of file base64.cpp.

202  {
203  return base64_decode(output, input.data(), input.length(), ignore_ws);
204  }
uint32_t uint8_t output[]
Definition: ffi.h:509
secure_vector< uint8_t > base64_decode(const std::string &input, bool ignore_ws)
Definition: base64.cpp:213
size_t const char size_t size_t bool bool ignore_ws
Definition: base32.h:75
size_t const uint8_t input[]
Definition: base32.h:30

References base64_decode(), ignore_ws, input, and output.

◆ base64_decode() [4/5]

secure_vector<uint8_t> Botan::base64_decode ( const char  input[],
size_t  input_length,
bool  ignore_ws 
)

Definition at line 206 of file base64.cpp.

209  {
210  return base_decode_to_vec<secure_vector<uint8_t>>(Base64(), input, input_length, ignore_ws);
211  }
size_t const uint8_t size_t input_length
Definition: base32.h:30
size_t const char size_t size_t bool bool ignore_ws
Definition: base32.h:75
size_t const uint8_t input[]
Definition: base32.h:30

References ignore_ws, input, and input_length.

◆ base64_decode() [5/5]

secure_vector<uint8_t> Botan::base64_decode ( const std::string &  input,
bool  ignore_ws 
)

Definition at line 213 of file base64.cpp.

215  {
216  return base64_decode(input.data(), input.size(), ignore_ws);
217  }
secure_vector< uint8_t > base64_decode(const std::string &input, bool ignore_ws)
Definition: base64.cpp:213
size_t const char size_t size_t bool bool ignore_ws
Definition: base32.h:75
size_t const uint8_t input[]
Definition: base32.h:30

References base64_decode(), ignore_ws, and input.

◆ base64_decode_max_output()

size_t Botan::base64_decode_max_output ( size_t  input_length)

Definition at line 224 of file base64.cpp.

225  {
226  return Base64::decode_max_output(input_length);
227  }
size_t const uint8_t size_t input_length
Definition: base32.h:30

References input_length.

Referenced by botan_base64_decode().

◆ base64_encode() [1/3]

template<typename Alloc >
std::string Botan::base64_encode ( const std::vector< uint8_t, Alloc > &  input)

Perform base64 encoding

Parameters
inputsome input
Returns
base64adecimal representation of input

Definition at line 50 of file base64.h.

51  {
52  return base64_encode(input.data(), input.size());
53  }
std::string base64_encode(const std::vector< uint8_t, Alloc > &input)
Definition: base64.h:50
size_t const uint8_t input[]
Definition: base32.h:30

References base64_encode(), and input.

◆ base64_encode() [2/3]

size_t Botan::base64_encode ( char  out[],
const uint8_t  in[],
size_t  input_length,
size_t &  input_consumed,
bool  final_inputs 
)

Definition at line 166 of file base64.cpp.

171  {
173  }
uint32_t uint8_t size_t size_t const uint8_t size_t size_t * input_consumed
Definition: ffi.h:509
size_t const uint8_t size_t input_length
Definition: base32.h:30
const uint8_t * in
Definition: ffi.h:294
size_t char * out
Definition: ffi.h:162
size_t const uint8_t size_t size_t bool final_inputs
Definition: base32.h:30
size_t base_encode(Base &&base, char output[], const uint8_t input[], size_t input_length, size_t &input_consumed, bool final_inputs)
Definition: codec_base.h:34

References base_encode(), final_inputs, in, input_consumed, input_length, and out.

Referenced by base64_encode(), botan_base64_encode(), Botan::OCSP::BOTAN_PUBLIC_API(), Botan::PEM_Code::encode(), and generate_passhash9().

◆ base64_encode() [3/3]

std::string Botan::base64_encode ( const uint8_t  input[],
size_t  input_length 
)

Definition at line 175 of file base64.cpp.

177  {
178  return base_encode_to_string(Base64(), input, input_length);
179  }
size_t const uint8_t size_t input_length
Definition: base32.h:30
std::string base_encode_to_string(Base &&base, const uint8_t input[], size_t input_length)
Definition: codec_base.h:86
size_t const uint8_t input[]
Definition: base32.h:30

References base_encode_to_string(), input, and input_length.

◆ base64_encode_max_output()

size_t Botan::base64_encode_max_output ( size_t  input_length)

Definition at line 219 of file base64.cpp.

220  {
221  return Base64::encode_max_output(input_length);
222  }
size_t const uint8_t size_t input_length
Definition: base32.h:30

References input_length.

◆ base_decode()

template<typename Base >
size_t Botan::base_decode ( Base &&  base,
uint8_t  output[],
const char  input[],
size_t  input_length,
size_t &  input_consumed,
bool  final_inputs,
bool  ignore_ws = true 
)

Perform decoding using the base provided

Parameters
baseobject giving access to the encodings specifications
outputan array of at least Base::decode_max_output bytes
inputsome base input
input_lengthlength of input in bytes
input_consumedis an output parameter which says how many bytes of input were actually consumed. If less than input_length, then the range input[consumed:length] should be passed in later along with more input.
final_inputstrue iff this is the last input, in which case padding is allowed
ignore_wsignore whitespace on input; if false, throw an exception if whitespace is encountered
Returns
number of bytes written to output

Definition at line 124 of file codec_base.h.

131  {
132  const size_t decoding_bytes_in = base.decoding_bytes_in();
133  const size_t decoding_bytes_out = base.decoding_bytes_out();
134 
135  uint8_t* out_ptr = output;
136  std::vector<uint8_t> decode_buf(decoding_bytes_in, 0);
137  size_t decode_buf_pos = 0;
138  size_t final_truncate = 0;
139 
140  clear_mem(output, base.decode_max_output(input_length));
141 
142  for(size_t i = 0; i != input_length; ++i)
143  {
144  const uint8_t bin = base.lookup_binary_value(input[i]);
145 
146  if(base.check_bad_char(bin, input[i], ignore_ws)) // May throw Invalid_Argument
147  {
148  decode_buf[decode_buf_pos] = bin;
149  ++decode_buf_pos;
150  }
151 
152  /*
153  * If we're at the end of the input, pad with 0s and truncate
154  */
155  if(final_inputs && (i == input_length - 1))
156  {
157  if(decode_buf_pos)
158  {
159  for(size_t j = decode_buf_pos; j < decoding_bytes_in; ++j)
160  { decode_buf[j] = 0; }
161 
162  final_truncate = decoding_bytes_in - decode_buf_pos;
163  decode_buf_pos = decoding_bytes_in;
164  }
165  }
166 
167  if(decode_buf_pos == decoding_bytes_in)
168  {
169  base.decode(out_ptr, decode_buf.data());
170 
171  out_ptr += decoding_bytes_out;
172  decode_buf_pos = 0;
173  input_consumed = i+1;
174  }
175  }
176 
177  while(input_consumed < input_length &&
178  base.lookup_binary_value(input[input_consumed]) == 0x80)
179  {
180  ++input_consumed;
181  }
182 
183  size_t written = (out_ptr - output) - base.bytes_to_remove(final_truncate);
184 
185  return written;
186  }
uint32_t uint8_t size_t size_t const uint8_t size_t size_t * input_consumed
Definition: ffi.h:509
uint32_t uint8_t output[]
Definition: ffi.h:509
size_t const uint8_t size_t input_length
Definition: base32.h:30
void clear_mem(T *ptr, size_t n)
Definition: mem_ops.h:111
size_t const uint8_t size_t size_t bool final_inputs
Definition: base32.h:30
size_t const char size_t size_t bool bool ignore_ws
Definition: base32.h:75
size_t const uint8_t input[]
Definition: base32.h:30
uint8_t base
Definition: ffi.h:743

References base, clear_mem(), final_inputs, ignore_ws, input, input_consumed, input_length, and output.

Referenced by base32_decode(), base64_decode(), and base_decode_full().

◆ base_decode_full()

template<typename Base >
size_t Botan::base_decode_full ( Base &&  base,
uint8_t  output[],
const char  input[],
size_t  input_length,
bool  ignore_ws 
)

Definition at line 189 of file codec_base.h.

190  {
191  size_t consumed = 0;
192  const size_t written = base_decode(base, output, input, input_length, consumed, true, ignore_ws);
193 
194  if(consumed != input_length)
195  {
196  throw Invalid_Argument(base.name() + " decoding failed, input did not have full bytes");
197  }
198 
199  return written;
200  }
size_t base_decode(Base &&base, uint8_t output[], const char input[], size_t input_length, size_t &input_consumed, bool final_inputs, bool ignore_ws=true)
Definition: codec_base.h:124
uint32_t uint8_t output[]
Definition: ffi.h:509
size_t const uint8_t size_t input_length
Definition: base32.h:30
size_t const char size_t size_t bool bool ignore_ws
Definition: base32.h:75
size_t const uint8_t input[]
Definition: base32.h:30
uint8_t base
Definition: ffi.h:743

References base, base_decode(), ignore_ws, input, input_length, and output.

Referenced by base32_decode(), base64_decode(), and base_decode_to_vec().

◆ base_decode_to_vec()

template<typename Vector , typename Base >
Vector Botan::base_decode_to_vec ( Base &&  base,
const char  input[],
size_t  input_length,
bool  ignore_ws 
)

Definition at line 203 of file codec_base.h.

207  {
208  const size_t output_length = base.decode_max_output(input_length);
209  Vector bin(output_length);
210 
211  const size_t written =
213 
214  bin.resize(written);
215  return bin;
216  }
size_t const uint8_t size_t input_length
Definition: base32.h:30
size_t * output_length
Definition: ffi.h:277
size_t const char size_t size_t bool bool ignore_ws
Definition: base32.h:75
size_t const uint8_t input[]
Definition: base32.h:30
uint8_t base
Definition: ffi.h:743
size_t base_decode_full(Base &&base, uint8_t output[], const char input[], size_t input_length, bool ignore_ws)
Definition: codec_base.h:189

References base, base_decode_full(), ignore_ws, input, input_length, and output_length.

◆ base_encode()

template<class Base >
size_t Botan::base_encode ( Base &&  base,
char  output[],
const uint8_t  input[],
size_t  input_length,
size_t &  input_consumed,
bool  final_inputs 
)

Perform encoding using the base provided

Parameters
baseobject giving access to the encodings specifications
outputan array of at least base.encode_max_output bytes
inputis some binary data
input_lengthlength of input in bytes
input_consumedis an output parameter which says how many bytes of input were actually consumed. If less than input_length, then the range input[consumed:length] should be passed in later along with more input.
final_inputstrue iff this is the last input, in which case padding chars will be applied if needed
Returns
number of bytes written to output

Definition at line 34 of file codec_base.h.

40  {
41  input_consumed = 0;
42 
43  const size_t encoding_bytes_in = base.encoding_bytes_in();
44  const size_t encoding_bytes_out = base.encoding_bytes_out();
45 
46  size_t input_remaining = input_length;
47  size_t output_produced = 0;
48 
49  while(input_remaining >= encoding_bytes_in)
50  {
51  base.encode(output + output_produced, input + input_consumed);
52 
53  input_consumed += encoding_bytes_in;
54  output_produced += encoding_bytes_out;
55  input_remaining -= encoding_bytes_in;
56  }
57 
58  if(final_inputs && input_remaining)
59  {
60  std::vector<uint8_t> remainder(encoding_bytes_in, 0);
61  for(size_t i = 0; i != input_remaining; ++i)
62  { remainder[i] = input[input_consumed + i]; }
63 
64  base.encode(output + output_produced, remainder.data());
65 
66  const size_t bits_consumed = base.bits_consumed();
67  const size_t remaining_bits_before_padding = base.remaining_bits_before_padding();
68 
69  size_t empty_bits = 8 * (encoding_bytes_in - input_remaining);
70  size_t index = output_produced + encoding_bytes_out - 1;
71  while(empty_bits >= remaining_bits_before_padding)
72  {
73  output[index--] = '=';
74  empty_bits -= bits_consumed;
75  }
76 
77  input_consumed += input_remaining;
78  output_produced += encoding_bytes_out;
79  }
80 
81  return output_produced;
82  }
uint32_t uint8_t size_t size_t const uint8_t size_t size_t * input_consumed
Definition: ffi.h:509
uint32_t uint8_t output[]
Definition: ffi.h:509
size_t const uint8_t size_t input_length
Definition: base32.h:30
botan_mp_t remainder
Definition: ffi.h:823
size_t const uint8_t size_t size_t bool final_inputs
Definition: base32.h:30
size_t const uint8_t input[]
Definition: base32.h:30
uint8_t base
Definition: ffi.h:743

References base, final_inputs, input, input_consumed, input_length, output, and remainder.

Referenced by base32_encode(), base64_encode(), and base_encode_to_string().

◆ base_encode_to_string()

template<typename Base >
std::string Botan::base_encode_to_string ( Base &&  base,
const uint8_t  input[],
size_t  input_length 
)

Definition at line 86 of file codec_base.h.

87  {
88  const size_t output_length = base.encode_max_output(input_length);
89  std::string output(output_length, 0);
90 
91  size_t consumed = 0;
92  size_t produced = 0;
93 
94  if(output_length > 0)
95  {
96  produced = base_encode(base, &output.front(),
98  consumed, true);
99  }
100 
101  BOTAN_ASSERT_EQUAL(consumed, input_length, "Consumed the entire input");
102  BOTAN_ASSERT_EQUAL(produced, output.size(), "Produced expected size");
103 
104  return output;
105  }
uint32_t uint8_t output[]
Definition: ffi.h:509
size_t const uint8_t size_t input_length
Definition: base32.h:30
size_t * output_length
Definition: ffi.h:277
#define BOTAN_ASSERT_EQUAL(expr1, expr2, assertion_made)
Definition: assert.h:81
size_t const uint8_t input[]
Definition: base32.h:30
uint8_t base
Definition: ffi.h:743
size_t base_encode(Base &&base, char output[], const uint8_t input[], size_t input_length, size_t &input_consumed, bool final_inputs)
Definition: codec_base.h:34

References base, base_encode(), BOTAN_ASSERT_EQUAL, input, input_length, output, and output_length.

Referenced by base32_encode(), and base64_encode().

◆ bigint_add2()

void Botan::bigint_add2 ( word  x[],
size_t  x_size,
const word  y[],
size_t  y_size 
)
inline

Two operand addition

Parameters
xthe first operand (and output)
x_sizesize of x
ythe second operand
y_sizesize of y (must be >= x_size)

Definition at line 282 of file mp_core.h.

284  {
285  x[x_size] += bigint_add2_nc(x, x_size, y, y_size);
286  }
const botan_mp_t x
Definition: ffi.h:815
const uint8_t * y
Definition: ffi.h:139
word bigint_add2_nc(word x[], size_t x_size, const word y[], size_t y_size)
Definition: mp_core.h:229

References bigint_add2_nc(), x, and y.

Referenced by mul_add().

◆ bigint_add2_nc()

word Botan::bigint_add2_nc ( word  x[],
size_t  x_size,
const word  y[],
size_t  y_size 
)
inline

Two operand addition with carry out

Definition at line 229 of file mp_core.h.

230  {
231  word carry = 0;
232 
233  BOTAN_ASSERT(x_size >= y_size, "Expected sizes");
234 
235  const size_t blocks = y_size - (y_size % 8);
236 
237  for(size_t i = 0; i != blocks; i += 8)
238  carry = word8_add2(x + i, y + i, carry);
239 
240  for(size_t i = blocks; i != y_size; ++i)
241  x[i] = word_add(x[i], y[i], &carry);
242 
243  for(size_t i = y_size; i != x_size; ++i)
244  x[i] = word_add(x[i], 0, &carry);
245 
246  return carry;
247  }
word word8_add2(word x[8], const word y[8], word carry)
Definition: mp_asmi.h:138
void carry(int64_t &h0, int64_t &h1)
const botan_mp_t x
Definition: ffi.h:815
#define BOTAN_ASSERT(expr, assertion_made)
Definition: assert.h:55
const uint8_t * y
Definition: ffi.h:139
const uint8_t uint8_t size_t blocks
Definition: ffi.h:686
word word_add(word x, word y, word *carry)
Definition: mp_asmi.h:107

References blocks, BOTAN_ASSERT, carry(), word8_add2(), word_add(), x, and y.

Referenced by bigint_add2().

◆ bigint_add3()

void Botan::bigint_add3 ( word  z[],
const word  x[],
size_t  x_size,
const word  y[],
size_t  y_size 
)
inline

Three operand addition

Definition at line 291 of file mp_core.h.

294  {
295  z[x_size > y_size ? x_size : y_size] +=
296  bigint_add3_nc(z, x, x_size, y, y_size);
297  }
word bigint_add3_nc(word z[], const word x[], size_t x_size, const word y[], size_t y_size)
Definition: mp_core.h:252
const botan_mp_t x
Definition: ffi.h:815
const uint8_t * y
Definition: ffi.h:139

References bigint_add3_nc(), x, and y.

◆ bigint_add3_nc()

word Botan::bigint_add3_nc ( word  z[],
const word  x[],
size_t  x_size,
const word  y[],
size_t  y_size 
)
inline

Three operand addition with carry out

Definition at line 252 of file mp_core.h.

255  {
256  if(x_size < y_size)
257  { return bigint_add3_nc(z, y, y_size, x, x_size); }
258 
259  word carry = 0;
260 
261  const size_t blocks = y_size - (y_size % 8);
262 
263  for(size_t i = 0; i != blocks; i += 8)
264  carry = word8_add3(z + i, x + i, y + i, carry);
265 
266  for(size_t i = blocks; i != y_size; ++i)
267  z[i] = word_add(x[i], y[i], &carry);
268 
269  for(size_t i = y_size; i != x_size; ++i)
270  z[i] = word_add(x[i], 0, &carry);
271 
272  return carry;
273  }
void carry(int64_t &h0, int64_t &h1)
word bigint_add3_nc(word z[], const word x[], size_t x_size, const word y[], size_t y_size)
Definition: mp_core.h:252
const botan_mp_t x
Definition: ffi.h:815
const uint8_t * y
Definition: ffi.h:139
const uint8_t uint8_t size_t blocks
Definition: ffi.h:686
word word8_add3(word z[8], const word x[8], const word y[8], word carry)
Definition: mp_asmi.h:200
word word_add(word x, word y, word *carry)
Definition: mp_asmi.h:107

References blocks, carry(), word8_add3(), word_add(), x, and y.

Referenced by bigint_add3(), and redc_p521().

◆ bigint_cmp()

int32_t Botan::bigint_cmp ( const word  x[],
size_t  x_size,
const word  y[],
size_t  y_size 
)
inline

Compare x and y Return -1 if x < y Return 0 if x == y Return 1 if x > y

Definition at line 525 of file mp_core.h.

527  {
528  static_assert(sizeof(word) >= sizeof(uint32_t), "Size assumption");
529 
530  const word LT = static_cast<word>(-1);
531  const word EQ = 0;
532  const word GT = 1;
533 
534  const size_t common_elems = std::min(x_size, y_size);
535 
536  word result = EQ; // until found otherwise
537 
538  for(size_t i = 0; i != common_elems; i++)
539  {
540  const auto is_eq = CT::Mask<word>::is_equal(x[i], y[i]);
541  const auto is_lt = CT::Mask<word>::is_lt(x[i], y[i]);
542 
543  result = is_eq.select(result, is_lt.select(LT, GT));
544  }
545 
546  if(x_size < y_size)
547  {
548  word mask = 0;
549  for(size_t i = x_size; i != y_size; i++)
550  mask |= y[i];
551 
552  // If any bits were set in high part of y, then x < y
553  result = CT::Mask<word>::is_zero(mask).select(result, LT);
554  }
555  else if(y_size < x_size)
556  {
557  word mask = 0;
558  for(size_t i = y_size; i != x_size; i++)
559  mask |= x[i];
560 
561  // If any bits were set in high part of x, then x > y
562  result = CT::Mask<word>::is_zero(mask).select(result, GT);
563  }
564 
565  CT::unpoison(result);
566  BOTAN_DEBUG_ASSERT(result == LT || result == GT || result == EQ);
567  return static_cast<int32_t>(result);
568  }
const botan_mp_t x
Definition: ffi.h:815
const uint8_t * y
Definition: ffi.h:139
#define BOTAN_DEBUG_ASSERT(expr)
Definition: assert.h:123
void unpoison(const T *p, size_t n)
Definition: ct_utils.h:59

References BOTAN_DEBUG_ASSERT, Botan::CT::Mask< T >::is_equal(), Botan::CT::Mask< T >::is_lt(), Botan::CT::Mask< T >::is_zero(), Botan::CT::unpoison(), x, and y.

Referenced by bigint_sub_abs().

◆ bigint_cnd_abs()

void Botan::bigint_cnd_abs ( word  cnd,
word  x[],
size_t  size 
)
inline

Definition at line 214 of file mp_core.h.

215  {
216  const auto mask = CT::Mask<word>::expand(cnd);
217 
218  word carry = mask.if_set_return(1);
219  for(size_t i = 0; i != size; ++i)
220  {
221  const word z = word_add(~x[i], 0, &carry);
222  x[i] = mask.select(z, x[i]);
223  }
224  }
void carry(int64_t &h0, int64_t &h1)
const botan_mp_t x
Definition: ffi.h:815
word word_add(word x, word y, word *carry)
Definition: mp_asmi.h:107

References carry(), Botan::CT::Mask< T >::expand(), word_add(), and x.

Referenced by ct_inverse_mod_odd_modulus().

◆ bigint_cnd_add() [1/2]

word Botan::bigint_cnd_add ( word  cnd,
word  x[],
word  x_size,
const word  y[],
size_t  y_size 
)
inline

Definition at line 44 of file mp_core.h.

46  {
47  BOTAN_ASSERT(x_size >= y_size, "Expected sizes");
48 
49  const auto mask = CT::Mask<word>::expand(cnd);
50 
51  word carry = 0;
52 
53  const size_t blocks = y_size - (y_size % 8);
54  word z[8] = { 0 };
55 
56  for(size_t i = 0; i != blocks; i += 8)
57  {
58  carry = word8_add3(z, x + i, y + i, carry);
59  mask.select_n(x + i, z, x + i, 8);
60  }
61 
62  for(size_t i = blocks; i != y_size; ++i)
63  {
64  z[0] = word_add(x[i], y[i], &carry);
65  x[i] = mask.select(z[0], x[i]);
66  }
67 
68  for(size_t i = y_size; i != x_size; ++i)
69  {
70  z[0] = word_add(x[i], 0, &carry);
71  x[i] = mask.select(z[0], x[i]);
72  }
73 
74  return mask.if_set_return(carry);
75  }
void carry(int64_t &h0, int64_t &h1)
const botan_mp_t x
Definition: ffi.h:815
#define BOTAN_ASSERT(expr, assertion_made)
Definition: assert.h:55
const uint8_t * y
Definition: ffi.h:139
const uint8_t uint8_t size_t blocks
Definition: ffi.h:686
word word8_add3(word z[8], const word x[8], const word y[8], word carry)
Definition: mp_asmi.h:200
word word_add(word x, word y, word *carry)
Definition: mp_asmi.h:107

References blocks, BOTAN_ASSERT, carry(), Botan::CT::Mask< T >::expand(), word8_add3(), word_add(), x, and y.

Referenced by bigint_cnd_add(), and ct_inverse_mod_odd_modulus().

◆ bigint_cnd_add() [2/2]

word Botan::bigint_cnd_add ( word  cnd,
word  x[],
const word  y[],
size_t  size 
)
inline

Definition at line 81 of file mp_core.h.

82  {
83  return bigint_cnd_add(cnd, x, size, y, size);
84  }
const botan_mp_t x
Definition: ffi.h:815
const uint8_t * y
Definition: ffi.h:139
word bigint_cnd_add(word cnd, word x[], const word y[], size_t size)
Definition: mp_core.h:81

References bigint_cnd_add(), x, and y.

◆ bigint_cnd_add_or_sub()

void Botan::bigint_cnd_add_or_sub ( CT::Mask< word >  mask,
word  x[],
const word  y[],
size_t  size 
)
inline

Definition at line 141 of file mp_core.h.

142  {
143  const size_t blocks = size - (size % 8);
144 
145  word carry = 0;
146  word borrow = 0;
147 
148  word t0[8] = { 0 };
149  word t1[8] = { 0 };
150 
151  for(size_t i = 0; i != blocks; i += 8)
152  {
153  carry = word8_add3(t0, x + i, y + i, carry);
154  borrow = word8_sub3(t1, x + i, y + i, borrow);
155 
156  for(size_t j = 0; j != 8; ++j)
157  x[i+j] = mask.select(t0[j], t1[j]);
158  }
159 
160  for(size_t i = blocks; i != size; ++i)
161  {
162  const word a = word_add(x[i], y[i], &carry);
163  const word s = word_sub(x[i], y[i], &borrow);
164 
165  x[i] = mask.select(a, s);
166  }
167  }
void carry(int64_t &h0, int64_t &h1)
const botan_mp_t x
Definition: ffi.h:815
const uint8_t * y
Definition: ffi.h:139
const uint8_t uint8_t size_t blocks
Definition: ffi.h:686
size_t const BigInt & a
Definition: numthry.h:111
word word8_add3(word z[8], const word x[8], const word y[8], word carry)
Definition: mp_asmi.h:200
word word_sub(word x, word y, word *carry)
Definition: mp_asmi.h:280
word word_add(word x, word y, word *carry)
Definition: mp_asmi.h:107
word word8_sub3(word z[8], const word x[8], const word y[8], word carry)
Definition: mp_asmi.h:416

References a, blocks, carry(), Botan::CT::Mask< T >::select(), word8_add3(), word8_sub3(), word_add(), word_sub(), x, and y.

◆ bigint_cnd_addsub()

word Botan::bigint_cnd_addsub ( CT::Mask< word >  mask,
word  x[],
const word  y[],
const word  z[],
size_t  size 
)
inline

Definition at line 178 of file mp_core.h.

181  {
182  const size_t blocks = size - (size % 8);
183 
184  word carry = 0;
185  word borrow = 0;
186 
187  word t0[8] = { 0 };
188  word t1[8] = { 0 };
189 
190  for(size_t i = 0; i != blocks; i += 8)
191  {
192  carry = word8_add3(t0, x + i, y + i, carry);
193  borrow = word8_sub3(t1, x + i, z + i, borrow);
194 
195  for(size_t j = 0; j != 8; ++j)
196  x[i+j] = mask.select(t0[j], t1[j]);
197  }
198 
199  for(size_t i = blocks; i != size; ++i)
200  {
201  t0[0] = word_add(x[i], y[i], &carry);
202  t1[0] = word_sub(x[i], z[i], &borrow);
203  x[i] = mask.select(t0[0], t1[0]);
204  }
205 
206  return mask.select(carry, borrow);
207  }
void carry(int64_t &h0, int64_t &h1)
const botan_mp_t x
Definition: ffi.h:815
const uint8_t * y
Definition: ffi.h:139
const uint8_t uint8_t size_t blocks
Definition: ffi.h:686
word word8_add3(word z[8], const word x[8], const word y[8], word carry)
Definition: mp_asmi.h:200
word word_sub(word x, word y, word *carry)
Definition: mp_asmi.h:280
word word_add(word x, word y, word *carry)
Definition: mp_asmi.h:107
word word8_sub3(word z[8], const word x[8], const word y[8], word carry)
Definition: mp_asmi.h:416

References blocks, carry(), Botan::CT::Mask< T >::select(), word8_add3(), word8_sub3(), word_add(), word_sub(), x, and y.

Referenced by bigint_mod_sub(), and bigint_mod_sub_n().

◆ bigint_cnd_sub() [1/2]

word Botan::bigint_cnd_sub ( word  cnd,
word  x[],
size_t  x_size,
const word  y[],
size_t  y_size 
)
inline

Definition at line 90 of file mp_core.h.

93  {
94  BOTAN_ASSERT(x_size >= y_size, "Expected sizes");
95 
96  const auto mask = CT::Mask<word>::expand(cnd);
97 
98  word carry = 0;
99 
100  const size_t blocks = y_size - (y_size % 8);
101  word z[8] = { 0 };
102 
103  for(size_t i = 0; i != blocks; i += 8)
104  {
105  carry = word8_sub3(z, x + i, y + i, carry);
106  mask.select_n(x + i, z, x + i, 8);
107  }
108 
109  for(size_t i = blocks; i != y_size; ++i)
110  {
111  z[0] = word_sub(x[i], y[i], &carry);
112  x[i] = mask.select(z[0], x[i]);
113  }
114 
115  for(size_t i = y_size; i != x_size; ++i)
116  {
117  z[0] = word_sub(x[i], 0, &carry);
118  x[i] = mask.select(z[0], x[i]);
119  }
120 
121  return mask.if_set_return(carry);
122  }
void carry(int64_t &h0, int64_t &h1)
const botan_mp_t x
Definition: ffi.h:815
#define BOTAN_ASSERT(expr, assertion_made)
Definition: assert.h:55
const uint8_t * y
Definition: ffi.h:139
const uint8_t uint8_t size_t blocks
Definition: ffi.h:686
word word_sub(word x, word y, word *carry)
Definition: mp_asmi.h:280
word word8_sub3(word z[8], const word x[8], const word y[8], word carry)
Definition: mp_asmi.h:416

References blocks, BOTAN_ASSERT, carry(), Botan::CT::Mask< T >::expand(), word8_sub3(), word_sub(), x, and y.

Referenced by bigint_cnd_sub(), ct_inverse_mod_odd_modulus(), and redc_p521().

◆ bigint_cnd_sub() [2/2]

word Botan::bigint_cnd_sub ( word  cnd,
word  x[],
const word  y[],
size_t  size 
)
inline

Definition at line 128 of file mp_core.h.

129  {
130  return bigint_cnd_sub(cnd, x, size, y, size);
131  }
const botan_mp_t x
Definition: ffi.h:815
const uint8_t * y
Definition: ffi.h:139
word bigint_cnd_sub(word cnd, word x[], const word y[], size_t size)
Definition: mp_core.h:128

References bigint_cnd_sub(), x, and y.

◆ bigint_cnd_swap()

void Botan::bigint_cnd_swap ( word  cnd,
word  x[],
word  y[],
size_t  size 
)
inline

Definition at line 31 of file mp_core.h.

32  {
33  const auto mask = CT::Mask<word>::expand(cnd);
34 
35  for(size_t i = 0; i != size; ++i)
36  {
37  const word a = x[i];
38  const word b = y[i];
39  x[i] = mask.select(b, a);
40  y[i] = mask.select(a, b);
41  }
42  }
bool const OID & b
Definition: asn1_oid.h:109
const botan_mp_t x
Definition: ffi.h:815
const uint8_t * y
Definition: ffi.h:139
size_t const BigInt & a
Definition: numthry.h:111

References a, b, Botan::CT::Mask< T >::expand(), x, and y.

Referenced by ct_inverse_mod_odd_modulus().

◆ bigint_comba_mul16()

void Botan::bigint_comba_mul16 ( word  z[32],
const word  x[16],
const word  y[16] 
)

Definition at line 805 of file mp_comba.cpp.

806  {
807  word w2 = 0, w1 = 0, w0 = 0;
808 
809  word3_muladd(&w2, &w1, &w0, x[ 0], y[ 0]);
810  z[ 0] = w0; w0 = 0;
811 
812  word3_muladd(&w0, &w2, &w1, x[ 0], y[ 1]);
813  word3_muladd(&w0, &w2, &w1, x[ 1], y[ 0]);
814  z[ 1] = w1; w1 = 0;
815 
816  word3_muladd(&w1, &w0, &w2, x[ 0], y[ 2]);
817  word3_muladd(&w1, &w0, &w2, x[ 1], y[ 1]);
818  word3_muladd(&w1, &w0, &w2, x[ 2], y[ 0]);
819  z[ 2] = w2; w2 = 0;
820 
821  word3_muladd(&w2, &w1, &w0, x[ 0], y[ 3]);
822  word3_muladd(&w2, &w1, &w0, x[ 1], y[ 2]);
823  word3_muladd(&w2, &w1, &w0, x[ 2], y[ 1]);
824  word3_muladd(&w2, &w1, &w0, x[ 3], y[ 0]);
825  z[ 3] = w0; w0 = 0;
826 
827  word3_muladd(&w0, &w2, &w1, x[ 0], y[ 4]);
828  word3_muladd(&w0, &w2, &w1, x[ 1], y[ 3]);
829  word3_muladd(&w0, &w2, &w1, x[ 2], y[ 2]);
830  word3_muladd(&w0, &w2, &w1, x[ 3], y[ 1]);
831  word3_muladd(&w0, &w2, &w1, x[ 4], y[ 0]);
832  z[ 4] = w1; w1 = 0;
833 
834  word3_muladd(&w1, &w0, &w2, x[ 0], y[ 5]);
835  word3_muladd(&w1, &w0, &w2, x[ 1], y[ 4]);
836  word3_muladd(&w1, &w0, &w2, x[ 2], y[ 3]);
837  word3_muladd(&w1, &w0, &w2, x[ 3], y[ 2]);
838  word3_muladd(&w1, &w0, &w2, x[ 4], y[ 1]);
839  word3_muladd(&w1, &w0, &w2, x[ 5], y[ 0]);
840  z[ 5] = w2; w2 = 0;
841 
842  word3_muladd(&w2, &w1, &w0, x[ 0], y[ 6]);
843  word3_muladd(&w2, &w1, &w0, x[ 1], y[ 5]);
844  word3_muladd(&w2, &w1, &w0, x[ 2], y[ 4]);
845  word3_muladd(&w2, &w1, &w0, x[ 3], y[ 3]);
846  word3_muladd(&w2, &w1, &w0, x[ 4], y[ 2]);
847  word3_muladd(&w2, &w1, &w0, x[ 5], y[ 1]);
848  word3_muladd(&w2, &w1, &w0, x[ 6], y[ 0]);
849  z[ 6] = w0; w0 = 0;
850 
851  word3_muladd(&w0, &w2, &w1, x[ 0], y[ 7]);
852  word3_muladd(&w0, &w2, &w1, x[ 1], y[ 6]);
853  word3_muladd(&w0, &w2, &w1, x[ 2], y[ 5]);
854  word3_muladd(&w0, &w2, &w1, x[ 3], y[ 4]);
855  word3_muladd(&w0, &w2, &w1, x[ 4], y[ 3]);
856  word3_muladd(&w0, &w2, &w1, x[ 5], y[ 2]);
857  word3_muladd(&w0, &w2, &w1, x[ 6], y[ 1]);
858  word3_muladd(&w0, &w2, &w1, x[ 7], y[ 0]);
859  z[ 7] = w1; w1 = 0;
860 
861  word3_muladd(&w1, &w0, &w2, x[ 0], y[ 8]);
862  word3_muladd(&w1, &w0, &w2, x[ 1], y[ 7]);
863  word3_muladd(&w1, &w0, &w2, x[ 2], y[ 6]);
864  word3_muladd(&w1, &w0, &w2, x[ 3], y[ 5]);
865  word3_muladd(&w1, &w0, &w2, x[ 4], y[ 4]);
866  word3_muladd(&w1, &w0, &w2, x[ 5], y[ 3]);
867  word3_muladd(&w1, &w0, &w2, x[ 6], y[ 2]);
868  word3_muladd(&w1, &w0, &w2, x[ 7], y[ 1]);
869  word3_muladd(&w1, &w0, &w2, x[ 8], y[ 0]);
870  z[ 8] = w2; w2 = 0;
871 
872  word3_muladd(&w2, &w1, &w0, x[ 0], y[ 9]);
873  word3_muladd(&w2, &w1, &w0, x[ 1], y[ 8]);
874  word3_muladd(&w2, &w1, &w0, x[ 2], y[ 7]);
875  word3_muladd(&w2, &w1, &w0, x[ 3], y[ 6]);
876  word3_muladd(&w2, &w1, &w0, x[ 4], y[ 5]);
877  word3_muladd(&w2, &w1, &w0, x[ 5], y[ 4]);
878  word3_muladd(&w2, &w1, &w0, x[ 6], y[ 3]);
879  word3_muladd(&w2, &w1, &w0, x[ 7], y[ 2]);
880  word3_muladd(&w2, &w1, &w0, x[ 8], y[ 1]);
881  word3_muladd(&w2, &w1, &w0, x[ 9], y[ 0]);
882  z[ 9] = w0; w0 = 0;
883 
884  word3_muladd(&w0, &w2, &w1, x[ 0], y[10]);
885  word3_muladd(&w0, &w2, &w1, x[ 1], y[ 9]);
886  word3_muladd(&w0, &w2, &w1, x[ 2], y[ 8]);
887  word3_muladd(&w0, &w2, &w1, x[ 3], y[ 7]);
888  word3_muladd(&w0, &w2, &w1, x[ 4], y[ 6]);
889  word3_muladd(&w0, &w2, &w1, x[ 5], y[ 5]);
890  word3_muladd(&w0, &w2, &w1, x[ 6], y[ 4]);
891  word3_muladd(&w0, &w2, &w1, x[ 7], y[ 3]);
892  word3_muladd(&w0, &w2, &w1, x[ 8], y[ 2]);
893  word3_muladd(&w0, &w2, &w1, x[ 9], y[ 1]);
894  word3_muladd(&w0, &w2, &w1, x[10], y[ 0]);
895  z[10] = w1; w1 = 0;
896 
897  word3_muladd(&w1, &w0, &w2, x[ 0], y[11]);
898  word3_muladd(&w1, &w0, &w2, x[ 1], y[10]);
899  word3_muladd(&w1, &w0, &w2, x[ 2], y[ 9]);
900  word3_muladd(&w1, &w0, &w2, x[ 3], y[ 8]);
901  word3_muladd(&w1, &w0, &w2, x[ 4], y[ 7]);
902  word3_muladd(&w1, &w0, &w2, x[ 5], y[ 6]);
903  word3_muladd(&w1, &w0, &w2, x[ 6], y[ 5]);
904  word3_muladd(&w1, &w0, &w2, x[ 7], y[ 4]);
905  word3_muladd(&w1, &w0, &w2, x[ 8], y[ 3]);
906  word3_muladd(&w1, &w0, &w2, x[ 9], y[ 2]);
907  word3_muladd(&w1, &w0, &w2, x[10], y[ 1]);
908  word3_muladd(&w1, &w0, &w2, x[11], y[ 0]);
909  z[11] = w2; w2 = 0;
910 
911  word3_muladd(&w2, &w1, &w0, x[ 0], y[12]);
912  word3_muladd(&w2, &w1, &w0, x[ 1], y[11]);
913  word3_muladd(&w2, &w1, &w0, x[ 2], y[10]);
914  word3_muladd(&w2, &w1, &w0, x[ 3], y[ 9]);
915  word3_muladd(&w2, &w1, &w0, x[ 4], y[ 8]);
916  word3_muladd(&w2, &w1, &w0, x[ 5], y[ 7]);
917  word3_muladd(&w2, &w1, &w0, x[ 6], y[ 6]);
918  word3_muladd(&w2, &w1, &w0, x[ 7], y[ 5]);
919  word3_muladd(&w2, &w1, &w0, x[ 8], y[ 4]);
920  word3_muladd(&w2, &w1, &w0, x[ 9], y[ 3]);
921  word3_muladd(&w2, &w1, &w0, x[10], y[ 2]);
922  word3_muladd(&w2, &w1, &w0, x[11], y[ 1]);
923  word3_muladd(&w2, &w1, &w0, x[12], y[ 0]);
924  z[12] = w0; w0 = 0;
925 
926  word3_muladd(&w0, &w2, &w1, x[ 0], y[13]);
927  word3_muladd(&w0, &w2, &w1, x[ 1], y[12]);
928  word3_muladd(&w0, &w2, &w1, x[ 2], y[11]);
929  word3_muladd(&w0, &w2, &w1, x[ 3], y[10]);
930  word3_muladd(&w0, &w2, &w1, x[ 4], y[ 9]);
931  word3_muladd(&w0, &w2, &w1, x[ 5], y[ 8]);
932  word3_muladd(&w0, &w2, &w1, x[ 6], y[ 7]);
933  word3_muladd(&w0, &w2, &w1, x[ 7], y[ 6]);
934  word3_muladd(&w0, &w2, &w1, x[ 8], y[ 5]);
935  word3_muladd(&w0, &w2, &w1, x[ 9], y[ 4]);
936  word3_muladd(&w0, &w2, &w1, x[10], y[ 3]);
937  word3_muladd(&w0, &w2, &w1, x[11], y[ 2]);
938  word3_muladd(&w0, &w2, &w1, x[12], y[ 1]);
939  word3_muladd(&w0, &w2, &w1, x[13], y[ 0]);
940  z[13] = w1; w1 = 0;
941 
942  word3_muladd(&w1, &w0, &w2, x[ 0], y[14]);
943  word3_muladd(&w1, &w0, &w2, x[ 1], y[13]);
944  word3_muladd(&w1, &w0, &w2, x[ 2], y[12]);
945  word3_muladd(&w1, &w0, &w2, x[ 3], y[11]);
946  word3_muladd(&w1, &w0, &w2, x[ 4], y[10]);
947  word3_muladd(&w1, &w0, &w2, x[ 5], y[ 9]);
948  word3_muladd(&w1, &w0, &w2, x[ 6], y[ 8]);
949  word3_muladd(&w1, &w0, &w2, x[ 7], y[ 7]);
950  word3_muladd(&w1, &w0, &w2, x[ 8], y[ 6]);
951  word3_muladd(&w1, &w0, &w2, x[ 9], y[ 5]);
952  word3_muladd(&w1, &w0, &w2, x[10], y[ 4]);
953  word3_muladd(&w1, &w0, &w2, x[11], y[ 3]);
954  word3_muladd(&w1, &w0, &w2, x[12], y[ 2]);
955  word3_muladd(&w1, &w0, &w2, x[13], y[ 1]);
956  word3_muladd(&w1, &w0, &w2, x[14], y[ 0]);
957  z[14] = w2; w2 = 0;
958 
959  word3_muladd(&w2, &w1, &w0, x[ 0], y[15]);
960  word3_muladd(&w2, &w1, &w0, x[ 1], y[14]);
961  word3_muladd(&w2, &w1, &w0, x[ 2], y[13]);
962  word3_muladd(&w2, &w1, &w0, x[ 3], y[12]);
963  word3_muladd(&w2, &w1, &w0, x[ 4], y[11]);
964  word3_muladd(&w2, &w1, &w0, x[ 5], y[10]);
965  word3_muladd(&w2, &w1, &w0, x[ 6], y[ 9]);
966  word3_muladd(&w2, &w1, &w0, x[ 7], y[ 8]);
967  word3_muladd(&w2, &w1, &w0, x[ 8], y[ 7]);
968  word3_muladd(&w2, &w1, &w0, x[ 9], y[ 6]);
969  word3_muladd(&w2, &w1, &w0, x[10], y[ 5]);
970  word3_muladd(&w2, &w1, &w0, x[11], y[ 4]);
971  word3_muladd(&w2, &w1, &w0, x[12], y[ 3]);
972  word3_muladd(&w2, &w1, &w0, x[13], y[ 2]);
973  word3_muladd(&w2, &w1, &w0, x[14], y[ 1]);
974  word3_muladd(&w2, &w1, &w0, x[15], y[ 0]);
975  z[15] = w0; w0 = 0;
976 
977  word3_muladd(&w0, &w2, &w1, x[ 1], y[15]);
978  word3_muladd(&w0, &w2, &w1, x[ 2], y[14]);
979  word3_muladd(&w0, &w2, &w1, x[ 3], y[13]);
980  word3_muladd(&w0, &w2, &w1, x[ 4], y[12]);
981  word3_muladd(&w0, &w2, &w1, x[ 5], y[11]);
982  word3_muladd(&w0, &w2, &w1, x[ 6], y[10]);
983  word3_muladd(&w0, &w2, &w1, x[ 7], y[ 9]);
984  word3_muladd(&w0, &w2, &w1, x[ 8], y[ 8]);
985  word3_muladd(&w0, &w2, &w1, x[ 9], y[ 7]);
986  word3_muladd(&w0, &w2, &w1, x[10], y[ 6]);
987  word3_muladd(&w0, &w2, &w1, x[11], y[ 5]);
988  word3_muladd(&w0, &w2, &w1, x[12], y[ 4]);
989  word3_muladd(&w0, &w2, &w1, x[13], y[ 3]);
990  word3_muladd(&w0, &w2, &w1, x[14], y[ 2]);
991  word3_muladd(&w0, &w2, &w1, x[15], y[ 1]);
992  z[16] = w1; w1 = 0;
993 
994  word3_muladd(&w1, &w0, &w2, x[ 2], y[15]);
995  word3_muladd(&w1, &w0, &w2, x[ 3], y[14]);
996  word3_muladd(&w1, &w0, &w2, x[ 4], y[13]);
997  word3_muladd(&w1, &w0, &w2, x[ 5], y[12]);
998  word3_muladd(&w1, &w0, &w2, x[ 6], y[11]);
999  word3_muladd(&w1, &w0, &w2, x[ 7], y[10]);
1000  word3_muladd(&w1, &w0, &w2,