Botan  1.11.15
Namespaces | Classes | Typedefs | Enumerations | Functions | Variables
Botan Namespace Reference

Namespaces

 ASN1
 
 BER
 
 Camellia_F
 
 Cert_Extension
 
 Charset
 
 CryptoBox
 
 CVC_EAC
 
 DE_EAC
 
 FPE
 
 gf2m_small_m
 
 HAS_160_F
 
 HTTP
 
 KeyPair
 
 OCSP
 
 OIDS
 
 PEM_Code
 
 PK_Ops
 
 PKCS8
 
 RIPEMD_128_F
 
 SHA1_F
 
 SHA1_SSE2_F
 
 SHA2_32
 
 SHA2_64
 
 TA_CM
 
 TLS
 
 X509
 

Classes

class  Adler32
 
class  AEAD_Filter
 
class  AEAD_Mode
 
class  AES_128
 
class  AES_128_NI
 
class  AES_128_SSSE3
 
class  AES_192
 
class  AES_192_NI
 
class  AES_192_SSSE3
 
class  AES_256
 
class  AES_256_NI
 
class  AES_256_SSSE3
 
class  Algo_Registry
 
struct  Algorithm_Not_Found
 
class  AlgorithmIdentifier
 
class  AlternativeName
 
class  ANSI_X919_MAC
 
class  ANSI_X923_Padding
 
class  ANSI_X931_RNG
 
class  ASN1_Car
 
class  ASN1_Ced
 
class  ASN1_Cex
 
class  ASN1_Chr
 
class  ASN1_EAC_String
 
class  ASN1_Object
 
class  ASN1_String
 
class  Attribute
 
class  AutoSeeded_RNG
 
class  Base64_Decoder
 
class  Base64_Encoder
 
class  BeOS_EntropySource
 
struct  BER_Bad_Tag
 
class  BER_Decoder
 
struct  BER_Decoding_Error
 
class  BER_Object
 
class  BigInt
 
struct  binary_matrix
 
struct  BitBucket
 
class  Blinder
 
class  Block_Cipher_Fixed_Params
 
class  BlockCipher
 
class  BlockCipherModePaddingMethod
 
class  Blowfish
 
class  Buffered_Computation
 
class  Buffered_Filter
 
class  Bzip2_Compression
 
class  Bzip2_Decompression
 
struct  calendar_point
 
class  Camellia_128
 
class  Camellia_192
 
class  Camellia_256
 
class  Cascade_Cipher
 
class  CAST_128
 
class  CAST_256
 
class  CBC_Decryption
 
class  CBC_Encryption
 
class  CBC_MAC
 
class  CBC_Mode
 
class  CCM_Decryption
 
class  CCM_Encryption
 
class  CCM_Mode
 
class  Certificate_Extension
 
class  Certificate_Store
 
class  Certificate_Store_In_Memory
 
class  Certificate_Store_Overlay
 
class  CFB_Decryption
 
class  CFB_Encryption
 
class  CFB_Mode
 
class  ChaCha
 
class  ChaCha20Poly1305_Decryption
 
class  ChaCha20Poly1305_Encryption
 
class  ChaCha20Poly1305_Mode
 
class  Chain
 
class  Cipher_Mode
 
class  CMAC
 
class  Comb4P
 
class  Compression_Alloc_Info
 
class  Compression_Decompression_Filter
 
class  Compression_Filter
 
class  Compression_Stream
 
class  Compressor_Transform
 
class  CPUID
 
class  CRC24
 
class  CRC32
 
class  Credentials_Manager
 
class  CRL_Entry
 
class  CTR_BE
 
class  CTS_Decryption
 
class  CTS_Encryption
 
class  Curve25519_PrivateKey
 
class  Curve25519_PublicKey
 
class  CurveGFp
 
class  CurveGFp_NIST
 
class  CurveGFp_P521
 
class  CurveGFp_Repr
 
class  Data_Store
 
class  DataSink
 
class  DataSink_Stream
 
class  DataSource
 
class  DataSource_Memory
 
class  DataSource_Stream
 
struct  Decoding_Error
 
class  Decompression_Filter
 
class  Deflate_Compression
 
class  Deflate_Decompression
 
class  DER_Encoder
 
class  DES
 
class  DESX
 
class  Device_EntropySource
 
class  DH_PrivateKey
 
class  DH_PublicKey
 
class  DL_Group
 
class  DL_Scheme_PrivateKey
 
class  DL_Scheme_PublicKey
 
class  DLIES_Decryptor
 
class  DLIES_Encryptor
 
class  donna128
 
class  DSA_PrivateKey
 
class  DSA_PublicKey
 
class  Dynamically_Loaded_Library
 
class  EAC1_1_ADO
 
class  EAC1_1_CVC
 
class  EAC1_1_CVC_Options
 
class  EAC1_1_gen_CVC
 
class  EAC1_1_obj
 
class  EAC1_1_Req
 
class  EAC_Signed_Object
 
class  EAC_Time
 
class  EAX_Decryption
 
class  EAX_Encryption
 
class  EAX_Mode
 
class  EC_Group
 
class  EC_PrivateKey
 
class  EC_PublicKey
 
class  ECB_Decryption
 
class  ECB_Encryption
 
class  ECB_Mode
 
class  ECDH_PrivateKey
 
class  ECDH_PublicKey
 
class  ECDSA_PrivateKey
 
class  ECDSA_PublicKey
 
class  ECDSA_Signature
 
class  EGD_EntropySource
 
class  ElGamal_PrivateKey
 
class  ElGamal_PublicKey
 
class  EME
 
class  EME_PKCS1v15
 
class  EMSA
 
class  EMSA1
 
class  EMSA1_BSI
 
class  EMSA_PKCS1v15
 
class  EMSA_PKCS1v15_Raw
 
class  EMSA_Raw
 
class  EMSA_X931
 
struct  Encoding_Error
 
class  Entropy_Accumulator
 
class  EntropySource
 
class  Extensions
 
class  Fanout_Filter
 
class  File_Descriptor_Source
 
class  Filter
 
class  Fixed_Base_Power_Mod
 
class  Fixed_Exponent_Power_Mod
 
class  Fixed_Window_Exponentiator
 
class  Fork
 
class  GCM_Decryption
 
class  GCM_Encryption
 
class  GCM_Mode
 
class  GHASH
 
class  GOST_28147_89
 
class  GOST_28147_89_Params
 
class  GOST_3410_PrivateKey
 
class  GOST_3410_PublicKey
 
class  GOST_34_11
 
class  Gzip_Compression
 
class  Gzip_Decompression
 
class  HAS_160
 
class  Hash_Filter
 
class  HashFunction
 
class  Hex_Decoder
 
class  Hex_Encoder
 
class  High_Resolution_Timestamp
 
class  HKDF
 
class  HMAC
 
class  HMAC_DRBG
 
class  HMAC_RNG
 
class  IDEA
 
class  IDEA_SSE2
 
class  IF_Scheme_PrivateKey
 
class  IF_Scheme_PublicKey
 
struct  Illegal_Point
 
struct  Illegal_Transformation
 
struct  Integrity_Failure
 
class  Intel_Rdrand
 
struct  Internal_Error
 
struct  Invalid_Algorithm_Name
 
struct  Invalid_IV_Length
 
struct  Invalid_Key_Length
 
struct  Invalid_OID
 
struct  Invalid_State
 
class  KASUMI
 
class  KDF
 
class  KDF1
 
class  KDF2
 
class  Keccak_1600
 
class  Key_Length_Specification
 
class  Keyed_Filter
 
class  Keyed_Transform
 
class  LibraryInitializer
 
class  Lion
 
struct  Lookup_Error
 
class  LZMA_Compression
 
class  LZMA_Decompression
 
class  MAC_Filter
 
class  MARS
 
class  McEliece_KEM_Decryptor
 
class  McEliece_KEM_Encryptor
 
class  mceliece_message_parts
 
class  McEliece_Private_Operation
 
class  McEliece_PrivateKey
 
class  McEliece_Public_Operation
 
class  McEliece_PublicKey
 
class  MD2
 
class  MD4
 
class  MD4_X86_32
 
class  MD5
 
class  MD5_X86_32
 
class  MDx_HashFunction
 
struct  Memory_Exhaustion
 
class  MessageAuthenticationCode
 
class  MISTY1
 
class  mlock_allocator
 
class  Modular_Exponentiator
 
class  Modular_Reducer
 
class  Montgomery_Exponentiator
 
class  Noekeon
 
class  Noekeon_SIMD
 
class  NR_PrivateKey
 
class  NR_PublicKey
 
class  Null_Padding
 
class  Null_RNG
 
class  OAEP
 
class  OCB_Decryption
 
class  OCB_Encryption
 
class  OCB_Mode
 
class  OctetString
 
class  OFB
 
class  OID
 
class  OneAndZeros_Padding
 
class  Output_Buffers
 
class  Parallel
 
class  Path_Validation_Restrictions
 
class  Path_Validation_Result
 
class  PBKDF
 
class  Pipe
 
class  PK_Decryptor
 
class  PK_Decryptor_EME
 
class  PK_Encryptor
 
class  PK_Encryptor_EME
 
class  PK_Key_Agreement
 
class  PK_Key_Agreement_Key
 
class  PK_Signer
 
class  PK_Verifier
 
class  PKCS10_Request
 
class  PKCS5_PBKDF1
 
class  PKCS5_PBKDF2
 
class  PKCS7_Padding
 
struct  PKCS8_Exception
 
class  PointGFp
 
struct  Policy_Violation
 
class  Poly1305
 
struct  polyn_gf2m
 
class  Power_Mod
 
class  Private_Key
 
struct  PRNG_Unseeded
 
class  ProcWalking_EntropySource
 
class  PSSR
 
class  Public_Key
 
class  RandomNumberGenerator
 
class  RC2
 
class  RC4
 
class  RC5
 
class  RC6
 
class  RIPEMD_128
 
class  RIPEMD_160
 
class  RSA_PrivateKey
 
class  RSA_PublicKey
 
class  RTSS_Share
 
class  RW_PrivateKey
 
class  RW_PublicKey
 
class  SAFER_SK
 
class  Salsa20
 
class  SCAN_Name
 
class  secure_allocator
 
class  SecureQueue
 
class  SEED
 
struct  Self_Test_Failure
 
class  Semaphore
 
class  Serialized_RNG
 
class  Serpent
 
class  Serpent_SIMD
 
class  Serpent_X86_32
 
class  SHA_160
 
class  SHA_160_SSE2
 
class  SHA_160_X86_32
 
class  SHA_160_X86_64
 
class  SHA_224
 
class  SHA_256
 
class  SHA_384
 
class  SHA_512
 
class  SHA_512_256
 
class  SIMD_Scalar
 
class  SipHash
 
class  SIV_Decryption
 
class  SIV_Encryption
 
class  SIV_Mode
 
class  Skein_512
 
class  SQL_Database
 
class  Sqlite3_Database
 
class  SRP6_Authenticator_File
 
class  SRP6_Server_Session
 
class  Stream_Cipher_Mode
 
class  Stream_Compression
 
class  Stream_Decompression
 
struct  Stream_IO_Error
 
class  StreamCipher
 
class  StreamCipher_Filter
 
class  SymmetricAlgorithm
 
class  TEA
 
class  Threaded_Fork
 
class  Threefish_512
 
class  Threefish_512_AVX2
 
class  Tiger
 
class  TLS_12_PRF
 
class  TLS_PRF
 
class  Transform
 
class  Transform_Filter
 
class  TripleDES
 
class  Twofish
 
class  Unix_EntropySource
 
class  UnixProcessInfo_EntropySource
 
class  Whirlpool
 
class  Win32_CAPI_EntropySource
 
class  Win32_EntropySource
 
class  X509_CA
 
class  X509_Cert_Options
 
class  X509_Certificate
 
class  X509_CRL
 
class  X509_DN
 
class  X509_Object
 
class  X509_Time
 
class  X942_PRF
 
class  XTEA
 
class  XTEA_SIMD
 
class  XTS_Decryption
 
class  XTS_Encryption
 
class  XTS_Mode
 
class  Zlib_Compression
 
class  Zlib_Decompression
 
class  Zlib_Style_Stream
 

Typedefs

typedef uint8_t byte
 
typedef EC_Group EC_Domain_Params
 
typedef std::runtime_error Exception
 
typedef limb felem[5]
 
typedef OctetString InitializationVector
 
typedef std::invalid_argument Invalid_Argument
 
typedef u64bit limb
 
typedef PK_Key_Agreement_Key PK_KA_Key
 
typedef Private_Key PKCS8_PrivateKey
 
typedef int32_t s32bit
 
template<typename T >
using secure_deque = std::deque< T, secure_allocator< T >>
 
template<typename T >
using secure_vector = std::vector< T, secure_allocator< T >>
 
typedef OctetString SymmetricKey
 
typedef Transform Transformation
 
typedef Transform_Filter Transformation_Filter
 
typedef uint16_t u16bit
 
typedef uint32_t u32bit
 
typedef uint64_t u64bit
 
typedef byte u8
 
typedef donna128 uint128_t
 
typedef Public_Key X509_PublicKey
 

Enumerations

enum  ASN1_Tag {
  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, BMP_STRING = 0x1E, UTC_TIME = 0x17, GENERALIZED_TIME = 0x18,
  NO_OBJECT = 0xFF00, DIRECTORY_STRING = 0xFF01
}
 
enum  Certificate_Status_Code {
  Certificate_Status_Code::VERIFIED = 0x00000000, Certificate_Status_Code::OCSP_RESPONSE_GOOD, Certificate_Status_Code::NO_REVOCATION_DATA, Certificate_Status_Code::SIGNATURE_METHOD_TOO_WEAK = 1000,
  Certificate_Status_Code::UNTRUSTED_HASH, Certificate_Status_Code::CERT_NOT_YET_VALID = 2000, Certificate_Status_Code::CERT_HAS_EXPIRED, Certificate_Status_Code::OCSP_NOT_YET_VALID,
  Certificate_Status_Code::OCSP_HAS_EXPIRED, Certificate_Status_Code::CRL_NOT_YET_VALID, Certificate_Status_Code::CRL_HAS_EXPIRED, Certificate_Status_Code::CERT_ISSUER_NOT_FOUND = 3000,
  Certificate_Status_Code::CANNOT_ESTABLISH_TRUST, Certificate_Status_Code::POLICY_ERROR = 4000, Certificate_Status_Code::INVALID_USAGE, Certificate_Status_Code::CERT_CHAIN_TOO_LONG,
  Certificate_Status_Code::CA_CERT_NOT_FOR_CERT_ISSUER, Certificate_Status_Code::CA_CERT_NOT_FOR_CRL_ISSUER, Certificate_Status_Code::OCSP_CERT_NOT_LISTED, Certificate_Status_Code::OCSP_BAD_STATUS,
  Certificate_Status_Code::CERT_IS_REVOKED = 5000, Certificate_Status_Code::CRL_BAD_SIGNATURE, Certificate_Status_Code::SIGNATURE_ERROR
}
 
enum  Character_Set { LOCAL_CHARSET, UCS2_CHARSET, UTF8_CHARSET, LATIN1_CHARSET }
 
enum  Cipher_Dir { ENCRYPTION, DECRYPTION }
 
enum  CRL_Code {
  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, 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  Fault_Protection { ENABLE_FAULT_PROTECTION, DISABLE_FAULT_PROTECTION }
 
enum  Key_Constraints {
  NO_CONSTRAINTS = 0, DIGITAL_SIGNATURE = 32768, NON_REPUDIATION = 16384, KEY_ENCIPHERMENT = 8192,
  DATA_ENCIPHERMENT = 4096, KEY_AGREEMENT = 2048, KEY_CERT_SIGN = 1024, CRL_SIGN = 512,
  ENCIPHER_ONLY = 256, DECIPHER_ONLY = 128
}
 
enum  Signature_Format { IEEE_1363, DER_SEQUENCE }
 
enum  X509_Encoding { RAW_BER, PEM }
 

Functions

BigInt abs (const BigInt &n)
 
std::map< std::string, double > algorithm_benchmark (const std::string &name, RandomNumberGenerator &rng, std::chrono::milliseconds milliseconds, size_t buf_size)
 
void aont_package (RandomNumberGenerator &rng, BlockCipher *cipher, const byte input[], size_t input_len, byte output[])
 
void aont_unpackage (BlockCipher *cipher, const byte input[], size_t input_len, byte output[])
 
void assertion_failure (const char *expr_str, const char *assertion_made, const char *func, const char *file, int line)
 
size_t base64_decode (byte output[], const char input[], size_t input_length, size_t &input_consumed, bool final_inputs, bool ignore_ws)
 
size_t base64_decode (byte output[], const char input[], size_t input_length, bool ignore_ws)
 
size_t base64_decode (byte output[], const std::string &input, bool ignore_ws)
 
secure_vector< bytebase64_decode (const char input[], size_t input_length, bool ignore_ws)
 
secure_vector< bytebase64_decode (const std::string &input, bool ignore_ws)
 
size_t base64_encode (char out[], const byte in[], size_t input_length, size_t &input_consumed, bool final_inputs)
 
template<typename Alloc >
std::string base64_encode (const std::vector< byte, Alloc > &input)
 
std::string base64_encode (const byte 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)
 
s32bit bigint_cmp (const word x[], size_t x_size, const word y[], size_t y_size)
 
void bigint_comba_mul16 (word z[32], const word x[16], const word y[16])
 
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_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])
 
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)
 
word bigint_modop (word n1, word n0, word d)
 
void bigint_monty_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, const word p[], size_t p_size, word p_dash, word workspace[])
 
void bigint_monty_redc (word z[], const word p[], size_t p_size, word p_dash, word workspace[])
 
void bigint_monty_sqr (word z[], size_t z_size, const word x[], size_t x_size, size_t x_sw, const word p[], size_t p_size, word p_dash, word workspace[])
 
void bigint_mul (word z[], size_t z_size, word workspace[], const word x[], size_t x_size, size_t x_sw, const word y[], size_t y_size, size_t y_sw)
 
void bigint_shl1 (word x[], size_t x_size, 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_simple_mul (word z[], const word x[], size_t x_size, const word y[], size_t y_size)
 
void bigint_simple_sqr (word z[], const word x[], size_t x_size)
 
void bigint_sqr (word z[], size_t z_size, word workspace[], const word x[], size_t x_size, size_t x_sw)
 
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)
 
u32bit bit_size_to_32bit_size (u32bit bit_size)
 
u32bit bit_size_to_byte_size (u32bit bit_size)
 
void botan_md4_x86_32_compress (u32bit digest[4], const byte input[64], u32bit M[16])
 
 BOTAN_REGISTER_BLOCK_CIPHER_1LEN (RC5, 12)
 
 BOTAN_REGISTER_BLOCK_CIPHER_MODE (XTS_Encryption, XTS_Decryption)
 
 BOTAN_REGISTER_BLOCK_CIPHER_MODE (SIV_Encryption, SIV_Decryption)
 
 BOTAN_REGISTER_BLOCK_CIPHER_MODE_LEN (OCB_Encryption, OCB_Decryption, 16)
 
 BOTAN_REGISTER_BLOCK_CIPHER_MODE_LEN (CFB_Encryption, CFB_Decryption, 0)
 
 BOTAN_REGISTER_BLOCK_CIPHER_MODE_LEN (EAX_Encryption, EAX_Decryption, 0)
 
 BOTAN_REGISTER_BLOCK_CIPHER_MODE_LEN (GCM_Encryption, GCM_Decryption, 16)
 
 BOTAN_REGISTER_BLOCK_CIPHER_MODE_LEN2 (CCM_Encryption, CCM_Decryption, 16, 3)
 
 BOTAN_REGISTER_BLOCK_CIPHER_NAMED_1STR (GOST_28147_89,"GOST-28147-89","R3411_94_TestParam")
 
 BOTAN_REGISTER_BLOCK_CIPHER_NAMED_NOARGS (Threefish_512,"Threefish-512")
 
 BOTAN_REGISTER_BLOCK_CIPHER_NAMED_NOARGS (Camellia_128,"Camellia-128")
 
 BOTAN_REGISTER_BLOCK_CIPHER_NAMED_NOARGS (CAST_256,"CAST-256")
 
 BOTAN_REGISTER_BLOCK_CIPHER_NAMED_NOARGS (CAST_128,"CAST-128")
 
 BOTAN_REGISTER_BLOCK_CIPHER_NAMED_NOARGS (AES_128,"AES-128")
 
 BOTAN_REGISTER_BLOCK_CIPHER_NAMED_NOARGS (Camellia_192,"Camellia-192")
 
 BOTAN_REGISTER_BLOCK_CIPHER_NAMED_NOARGS (AES_192,"AES-192")
 
 BOTAN_REGISTER_BLOCK_CIPHER_NAMED_NOARGS (Camellia_256,"Camellia-256")
 
 BOTAN_REGISTER_BLOCK_CIPHER_NAMED_NOARGS (AES_256,"AES-256")
 
 BOTAN_REGISTER_BLOCK_CIPHER_NOARGS (DESX)
 
 BOTAN_REGISTER_BLOCK_CIPHER_NOARGS (IDEA)
 
 BOTAN_REGISTER_BLOCK_CIPHER_NOARGS (MARS)
 
 BOTAN_REGISTER_BLOCK_CIPHER_NOARGS (KASUMI)
 
 BOTAN_REGISTER_BLOCK_CIPHER_NOARGS (Noekeon)
 
 BOTAN_REGISTER_BLOCK_CIPHER_NOARGS (RC2)
 
 BOTAN_REGISTER_BLOCK_CIPHER_NOARGS (SEED)
 
 BOTAN_REGISTER_BLOCK_CIPHER_NOARGS (TEA)
 
 BOTAN_REGISTER_BLOCK_CIPHER_NOARGS (RC6)
 
 BOTAN_REGISTER_BLOCK_CIPHER_NOARGS (XTEA)
 
 BOTAN_REGISTER_BLOCK_CIPHER_NOARGS (Blowfish)
 
 BOTAN_REGISTER_BLOCK_CIPHER_NOARGS (MISTY1)
 
 BOTAN_REGISTER_BLOCK_CIPHER_NOARGS (Serpent)
 
 BOTAN_REGISTER_BLOCK_CIPHER_NOARGS (DES)
 
 BOTAN_REGISTER_BLOCK_CIPHER_NOARGS (Twofish)
 
 BOTAN_REGISTER_BLOCK_CIPHER_NOARGS (TripleDES)
 
 BOTAN_REGISTER_BLOCK_CIPHER_NOARGS_IF (SIMD_32::enabled(), Noekeon_SIMD,"Noekeon","simd32", 64)
 
 BOTAN_REGISTER_BLOCK_CIPHER_NOARGS_IF (SIMD_32::enabled(), XTEA_SIMD,"XTEA","simd32", 64)
 
 BOTAN_REGISTER_BLOCK_CIPHER_NOARGS_IF (CPUID::has_sse2(), IDEA_SSE2,"IDEA","sse2", 64)
 
 BOTAN_REGISTER_BLOCK_CIPHER_NOARGS_IF (SIMD_32::enabled(), Serpent_SIMD,"Serpent","simd32", 64)
 
 BOTAN_REGISTER_BLOCK_CIPHER_NOARGS_IF (CPUID::has_avx2(), Threefish_512_AVX2,"Threefish-512","avx2", 64)
 
 BOTAN_REGISTER_BLOCK_CIPHER_NOARGS_IF (CPUID::has_aes_ni(), AES_128_NI,"AES-128","aes_ni", 16)
 
 BOTAN_REGISTER_BLOCK_CIPHER_NOARGS_IF (CPUID::has_aes_ni(), AES_192_NI,"AES-192","aes_ni", 16)
 
 BOTAN_REGISTER_BLOCK_CIPHER_NOARGS_IF (CPUID::has_aes_ni(), AES_256_NI,"AES-256","aes_ni", 16)
 
 BOTAN_REGISTER_BLOCK_CIPHER_NOARGS_IF (CPUID::has_ssse3(), AES_128_SSSE3,"AES-128","ssse3", 64)
 
 BOTAN_REGISTER_BLOCK_CIPHER_NOARGS_IF (CPUID::has_ssse3(), AES_192_SSSE3,"AES-192","ssse3", 64)
 
 BOTAN_REGISTER_BLOCK_CIPHER_NOARGS_IF (CPUID::has_ssse3(), AES_256_SSSE3,"AES-256","ssse3", 64)
 
 BOTAN_REGISTER_COMPRESSION (LZMA_Compression, LZMA_Decompression)
 
 BOTAN_REGISTER_COMPRESSION (Zlib_Compression, Zlib_Decompression)
 
 BOTAN_REGISTER_COMPRESSION (Bzip2_Compression, Bzip2_Decompression)
 
 BOTAN_REGISTER_COMPRESSION (Gzip_Compression, Gzip_Decompression)
 
 BOTAN_REGISTER_COMPRESSION (Deflate_Compression, Deflate_Decompression)
 
 BOTAN_REGISTER_EME_NAMED_NOARGS (EME_PKCS1v15,"PKCS1v15")
 
 BOTAN_REGISTER_EMSA_1HASH (EMSA1,"EMSA1")
 
 BOTAN_REGISTER_EMSA_1HASH (EMSA_X931,"EMSA_X931")
 
 BOTAN_REGISTER_EMSA_1HASH (EMSA1_BSI,"EMSA1_BSI")
 
 BOTAN_REGISTER_EMSA_NAMED_NOARGS (EMSA_Raw,"Raw")
 
 BOTAN_REGISTER_HASH_NAMED_1LEN (Keccak_1600,"Keccak-1600", 512)
 
 BOTAN_REGISTER_HASH_NAMED_NOARGS (HAS_160,"HAS-160")
 
 BOTAN_REGISTER_HASH_NAMED_NOARGS (RIPEMD_128,"RIPEMD-128")
 
 BOTAN_REGISTER_HASH_NAMED_NOARGS (RIPEMD_160,"RIPEMD-160")
 
 BOTAN_REGISTER_HASH_NAMED_NOARGS (SHA_160,"SHA-160")
 
 BOTAN_REGISTER_HASH_NAMED_NOARGS (SHA_384,"SHA-384")
 
 BOTAN_REGISTER_HASH_NAMED_NOARGS (GOST_34_11,"GOST-R-34.11-94")
 
 BOTAN_REGISTER_HASH_NAMED_NOARGS (SHA_224,"SHA-224")
 
 BOTAN_REGISTER_HASH_NAMED_NOARGS (SHA_512,"SHA-512")
 
 BOTAN_REGISTER_HASH_NAMED_NOARGS (SHA_256,"SHA-256")
 
 BOTAN_REGISTER_HASH_NAMED_NOARGS (SHA_512_256,"SHA-512-256")
 
 BOTAN_REGISTER_HASH_NOARGS (Adler32)
 
 BOTAN_REGISTER_HASH_NOARGS (CRC32)
 
 BOTAN_REGISTER_HASH_NOARGS (MD4)
 
 BOTAN_REGISTER_HASH_NOARGS (MD5)
 
 BOTAN_REGISTER_HASH_NOARGS (Whirlpool)
 
 BOTAN_REGISTER_HASH_NOARGS (CRC24)
 
 BOTAN_REGISTER_HASH_NOARGS (MD2)
 
 BOTAN_REGISTER_HASH_NOARGS_IF (CPUID::has_sse2(), SHA_160_SSE2,"SHA-160","sse2", 64)
 
 BOTAN_REGISTER_KDF_1HASH (KDF1,"KDF1")
 
 BOTAN_REGISTER_KDF_1HASH (KDF2,"KDF2")
 
 BOTAN_REGISTER_KDF_NAMED_1STR (X942_PRF,"X9.42-PRF")
 
 BOTAN_REGISTER_KDF_NOARGS (TLS_PRF,"TLS-PRF")
 
 BOTAN_REGISTER_MAC_NAMED_NOARGS (ANSI_X919_MAC,"X9.19-MAC")
 
 BOTAN_REGISTER_MAC_NOARGS (Poly1305)
 
 BOTAN_REGISTER_NAMED_T (KDF,"HKDF", HKDF, HKDF::make)
 
 BOTAN_REGISTER_NAMED_T (StreamCipher,"CTR-BE", CTR_BE, CTR_BE::make)
 
 BOTAN_REGISTER_NAMED_T (StreamCipher,"RC4", RC4, RC4::make)
 
 BOTAN_REGISTER_NAMED_T (StreamCipher,"OFB", OFB, OFB::make)
 
 BOTAN_REGISTER_NAMED_T (BlockCipher,"Cascade", Cascade_Cipher, Cascade_Cipher::make)
 
 BOTAN_REGISTER_NAMED_T (HashFunction,"Comb4P", Comb4P, Comb4P::make)
 
 BOTAN_REGISTER_NAMED_T (HashFunction,"Parallel", Parallel, Parallel::make)
 
 BOTAN_REGISTER_NAMED_T (PBKDF,"PBKDF2", PKCS5_PBKDF2, PKCS5_PBKDF2::make)
 
 BOTAN_REGISTER_NAMED_T (HashFunction,"Skein-512", Skein_512, Skein_512::make)
 
 BOTAN_REGISTER_NAMED_T (MessageAuthenticationCode,"CBC-MAC", CBC_MAC, CBC_MAC::make)
 
 BOTAN_REGISTER_NAMED_T (MessageAuthenticationCode,"CMAC", CMAC, CMAC::make)
 
 BOTAN_REGISTER_NAMED_T (MessageAuthenticationCode,"HMAC", HMAC, HMAC::make)
 
 BOTAN_REGISTER_NAMED_T (KDF,"TLS-12-PRF", TLS_12_PRF, TLS_12_PRF::make)
 
 BOTAN_REGISTER_NAMED_T (EMSA,"EMSA_PKCS1", EMSA_PCS1v15, make_pkcs1v15)
 
 BOTAN_REGISTER_NAMED_T (EMSA,"PSSR", PSSR, PSSR::make)
 
 BOTAN_REGISTER_NAMED_T (EME,"OAEP", OAEP, OAEP::make)
 
 BOTAN_REGISTER_NAMED_T (BlockCipher,"Lion", Lion, make_lion)
 
 BOTAN_REGISTER_NAMED_T_2LEN (MessageAuthenticationCode, SipHash,"SipHash","builtin", 2, 4)
 
 BOTAN_REGISTER_NAMED_T_2LEN (HashFunction, Tiger,"Tiger","builtin", 24, 3)
 
 BOTAN_REGISTER_NAMED_T_NOARGS (HashFunction, MD4_X86_32,"MD4","x86-32")
 
 BOTAN_REGISTER_NAMED_T_NOARGS (HashFunction, MD5_X86_32,"MD5","x86-32")
 
 BOTAN_REGISTER_NAMED_T_NOARGS (BlockCipher, Serpent_X86_32,"Serpent","x86-32")
 
 BOTAN_REGISTER_NAMED_T_NOARGS (HashFunction, SHA_160_X86_32,"SHA-160","x86-32")
 
 BOTAN_REGISTER_NAMED_T_NOARGS (HashFunction, SHA_160_X86_64,"SHA-160","x86-64")
 
 BOTAN_REGISTER_PK_KEY_AGREE_OP ("ECDH", ECDH_KA_Operation)
 
 BOTAN_REGISTER_PK_KEY_AGREE_OP ("DH", DH_KA_Operation)
 
 BOTAN_REGISTER_PK_SIGNATURE_OP ("NR", NR_Signature_Operation)
 
 BOTAN_REGISTER_PK_SIGNATURE_OP ("GOST-34.10", GOST_3410_Signature_Operation)
 
 BOTAN_REGISTER_PK_VERIFY_OP ("NR", NR_Verification_Operation)
 
 BOTAN_REGISTER_PK_VERIFY_OP ("GOST-34.10", GOST_3410_Verification_Operation)
 
 BOTAN_REGISTER_STREAM_CIPHER_NOARGS (ChaCha)
 
 BOTAN_REGISTER_STREAM_CIPHER_NOARGS (Salsa20)
 
 BOTAN_REGISTER_TRANSFORM (ECB_Encryption, make_ecb_mode< ECB_Encryption >)
 
 BOTAN_REGISTER_TRANSFORM (ECB_Decryption, make_ecb_mode< ECB_Decryption >)
 
 BOTAN_REGISTER_TRANSFORM (CBC_Encryption,(make_cbc_mode< CBC_Encryption, CTS_Encryption >))
 
 BOTAN_REGISTER_TRANSFORM (CBC_Decryption,(make_cbc_mode< CBC_Decryption, CTS_Decryption >))
 
 BOTAN_REGISTER_TRANSFORM_NOARGS (ChaCha20Poly1305_Encryption)
 
 BOTAN_REGISTER_TRANSFORM_NOARGS (ChaCha20Poly1305_Decryption)
 
 BOTAN_REGISTER_TYPE (StreamCipher, OpenSSL_RC4,"RC4", make_new_T< OpenSSL_RC4 >,"openssl", 64)
 
void botan_serpent_x86_32_decrypt (const byte in[16], byte out[16], const u32bit ks[132])
 
void botan_serpent_x86_32_encrypt (const byte in[16], byte out[16], const u32bit ks[132])
 
void botan_serpent_x86_32_key_schedule (u32bit ks[140])
 
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)
 
u64bit carry_shift (const donna128 &a, size_t shift)
 
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)
 
PK_Signerchoose_sig_format (const Private_Key &key, const std::string &hash_fn, AlgorithmIdentifier &sig_algo)
 
size_t clamp (size_t n, size_t lower_bound, size_t upper_bound)
 
std::string BOTAN_DLL clean_ws (const std::string &s)
 
template<typename T >
void clear_mem (T *ptr, size_t n)
 
u64bit combine_lower (const donna128 a, size_t s1, const donna128 b, size_t s2)
 
template<typename T >
void copy_mem (T *out, const T *in, size_t n)
 
template<typename T >
void copy_out_be (byte out[], size_t out_bytes, const T in[])
 
template<typename T >
void copy_out_le (byte out[], size_t out_bytes, const T in[])
 
template<typename T , typename Alloc >
void copy_out_vec_be (byte out[], size_t out_bytes, const std::vector< T, Alloc > &in)
 
template<typename T , typename Alloc >
void copy_out_vec_le (byte 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)
 
secure_vector< gf2mcreate_random_error_positions (unsigned code_length, unsigned error_weight, RandomNumberGenerator &rng)
 
template<typename T >
size_t ctz (T n)
 
int BOTAN_DLL curve25519_donna (uint8_t mypublic[32], const uint8_t secret[32], const uint8_t basepoint[32])
 
int curve25519_donna (u8 *mypublic, const u8 *secret, const u8 *basepoint)
 
ECDSA_Signature decode_concatenation (const std::vector< byte > &concat)
 
ECDSA_PublicKeydecode_eac1_1_key (const std::vector< byte > &, AlgorithmIdentifier &)
 
void divide (const BigInt &x, const BigInt &y_arg, BigInt &q, BigInt &r)
 
size_t dl_work_factor (size_t bits)
 
secure_vector< byteEC2OSP (const PointGFp &point, byte format)
 
size_t ecp_work_factor (size_t bits)
 
std::string erase_chars (const std::string &str, const std::set< char > &chars)
 
template<typename T >
u16bit expand_mask_16bit (T tst)
 
Key_Constraints find_constraints (const Public_Key &pub_key, Key_Constraints limits)
 
secure_vector< gf2mfind_roots_gf2m_decomp (const polyn_gf2m &polyn, u32bit code_length)
 
BigInt gcd (const BigInt &a, const BigInt &b)
 
void gcm_multiply_clmul (byte x[16], const byte H[16])
 
std::string generate_bcrypt (const std::string &pass, RandomNumberGenerator &rng, u16bit work_factor)
 
bool generate_dsa_primes (RandomNumberGenerator &rng, BigInt &p, BigInt &q, size_t pbits, size_t qbits, const std::vector< byte > &seed_c)
 
std::vector< bytegenerate_dsa_primes (RandomNumberGenerator &rng, BigInt &p, BigInt &q, size_t pbits, size_t qbits)
 
McEliece_PrivateKey generate_mceliece_key (RandomNumberGenerator &rng, u32bit ext_deg, u32bit code_length, u32bit t)
 
std::string generate_passhash9 (const std::string &pass, RandomNumberGenerator &rng, u16bit work_factor, byte alg_id)
 
BigInt generate_rfc6979_nonce (const BigInt &x, const BigInt &q, const BigInt &h, const std::string &hash)
 
BigInt generate_srp6_verifier (const std::string &identifier, const std::string &password, const std::vector< byte > &salt, const std::string &group_id, const std::string &hash_id)
 
AEAD_Modeget_aead (const std::string &algo_spec, Cipher_Dir direction)
 
BlockCipherModePaddingMethodget_bc_pad (const std::string &algo_spec)
 
BlockCipherget_block_cipher (const std::string &algo_spec, const std::string &provider)
 
std::vector< std::string > get_block_cipher_providers (const std::string &algo_spec)
 
template<typename T >
byte get_byte (size_t byte_num, T input)
 
Keyed_Filterget_cipher (const std::string &algo_spec, Cipher_Dir direction)
 
Keyed_Filterget_cipher (const std::string &algo_spec, const SymmetricKey &key, const InitializationVector &iv, Cipher_Dir direction)
 
Keyed_Filterget_cipher (const std::string &algo_spec, const SymmetricKey &key, Cipher_Dir direction)
 
Cipher_Modeget_cipher_mode (const std::string &algo_spec, Cipher_Dir direction)
 
BOTAN_DLL EMEget_eme (const std::string &algo_spec)
 
BOTAN_DLL EMSAget_emsa (const std::string &algo_spec)
 
HashFunctionget_hash (const std::string &algo_spec, const std::string &provider="")
 
HashFunctionget_hash_function (const std::string &algo_spec, const std::string &provider)
 
std::vector< std::string > get_hash_function_providers (const std::string &algo_spec)
 
KDFget_kdf (const std::string &algo_spec)
 
MessageAuthenticationCodeget_mac (const std::string &algo_spec, const std::string &provider)
 
std::vector< std::string > get_mac_providers (const std::string &algo_spec)
 
PBKDFget_pbkdf (const std::string &algo_spec, const std::string &provider)
 
StreamCipherget_stream_cipher (const std::string &algo_spec, const std::string &provider)
 
std::vector< std::string > get_stream_cipher_providers (const std::string &algo_spec)
 
Transformget_transform (const std::string &specstr, const std::string &provider, const std::string &dirstr)
 
gf2m_small_m::gf2m gray_to_lex (gf2m_small_m::gf2m gray)
 
template<typename T >
size_t hamming_weight (T n)
 
std::string hash_for_deterministic_signature (const std::string &emsa)
 
size_t hex_decode (byte output[], const char input[], size_t input_length, size_t &input_consumed, bool ignore_ws)
 
size_t hex_decode (byte output[], const char input[], size_t input_length, bool ignore_ws)
 
size_t hex_decode (byte output[], const std::string &input, bool ignore_ws)
 
std::vector< bytehex_decode (const char input[], size_t input_length, bool ignore_ws)
 
std::vector< bytehex_decode (const std::string &input, bool ignore_ws)
 
secure_vector< bytehex_decode_locked (const char input[], size_t input_length, bool ignore_ws)
 
secure_vector< bytehex_decode_locked (const std::string &input, bool ignore_ws)
 
void hex_encode (char output[], const byte input[], size_t input_length, bool uppercase)
 
std::string hex_encode (const byte input[], size_t input_length, bool uppercase)
 
template<typename Alloc >
std::string hex_encode (const std::vector< byte, Alloc > &input, bool uppercase=true)
 
template<typename T >
size_t high_bit (T n)
 
byte ieee1363_hash_id (const std::string &name)
 
BigInt inverse_mod (const BigInt &n, const BigInt &mod)
 
std::string ipv4_to_string (u32bit ip)
 
template<typename T >
bool is_power_of_2 (T arg)
 
bool is_prime (const BigInt &n, RandomNumberGenerator &rng, size_t prob, bool is_random)
 
s32bit jacobi (const BigInt &a, const BigInt &n)
 
BigInt lcm (const BigInt &a, const BigInt &b)
 
gf2m_small_m::gf2m lex_to_gray (gf2m_small_m::gf2m lex)
 
std::vector< std::string > list_all_readable_files_in_or_under (const std::string &dir_path)
 
template<typename T >
load_be (const byte in[], size_t off)
 
template<typename T >
void load_be (const byte in[], T &x0, T &x1)
 
template<typename T >
void load_be (const byte in[], T &x0, T &x1, T &x2, T &x3)
 
template<typename T >
void load_be (const byte 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 byte in[], size_t count)
 
template<>
u16bit load_be< u16bit > (const byte in[], size_t off)
 
template<>
u32bit load_be< u32bit > (const byte in[], size_t off)
 
template<>
u64bit load_be< u64bit > (const byte in[], size_t off)
 
template<typename T >
load_le (const byte in[], size_t off)
 
template<typename T >
void load_le (const byte in[], T &x0, T &x1)
 
template<typename T >
void load_le (const byte in[], T &x0, T &x1, T &x2, T &x3)
 
template<typename T >
void load_le (const byte 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 byte in[], size_t count)
 
template<>
u16bit load_le< u16bit > (const byte in[], size_t off)
 
template<>
u32bit load_le< u32bit > (const byte in[], size_t off)
 
template<>
u64bit load_le< u64bit > (const byte in[], size_t off)
 
template<typename T >
size_t low_bit (T n)
 
size_t low_zero_bits (const BigInt &n)
 
template<typename T >
T * make_a (const typename T::Spec &spec, const std::string provider="")
 
template<typename T >
T * make_block_cipher_mode (const Transform::Spec &spec)
 
template<typename T , size_t LEN1>
T * make_block_cipher_mode_len (const Transform::Spec &spec)
 
template<typename T , size_t LEN1, size_t LEN2>
T * make_block_cipher_mode_len2 (const Transform::Spec &spec)
 
template<typename CBC_T , typename CTS_T >
Transformmake_cbc_mode (const Transform::Spec &spec)
 
Transformmake_compressor (const std::string &type, size_t level)
 
EAC1_1_CVC make_cvc_cert (PK_Signer &signer, const std::vector< byte > &public_key, ASN1_Car const &car, ASN1_Chr const &chr, byte holder_auth_templ, ASN1_Ced ced, ASN1_Cex cex, RandomNumberGenerator &rng)
 
Transformmake_decompressor (const std::string &type)
 
template<typename T >
Transformmake_ecb_mode (const Transform::Spec &spec)
 
template<typename T >
T * make_new_T (const typename Algo_Registry< T >::Spec &)
 
template<typename T , size_t DEF_VAL>
T * make_new_T_1len (const typename Algo_Registry< T >::Spec &spec)
 
template<typename T >
T * make_new_T_1str (const typename Algo_Registry< T >::Spec &spec, const std::string &def)
 
template<typename T >
T * make_new_T_1str_req (const typename Algo_Registry< T >::Spec &spec)
 
template<typename T , typename X >
T * make_new_T_1X (const typename Algo_Registry< T >::Spec &spec)
 
template<typename T , size_t DEF1, size_t DEF2>
T * make_new_T_2len (const typename Algo_Registry< T >::Spec &spec)
 
template<typename OP , typename T >
OP * make_pk_op (const typename T::Spec &spec)
 
Private_Keymake_private_key (const AlgorithmIdentifier &alg_id, const secure_vector< byte > &key_bits, RandomNumberGenerator &rng)
 
Public_Keymake_public_key (const AlgorithmIdentifier &alg_id, const secure_vector< byte > &key_bits)
 
u16bit make_u16bit (byte i0, byte i1)
 
u32bit make_u32bit (byte i0, byte i1, byte i2, byte i3)
 
u64bit make_u64bit (byte i0, byte i1, byte i2, byte i3, byte i4, byte i5, byte i6, byte i7)
 
template<typename T , typename Pred >
void map_remove_if (Pred pred, T &assoc)
 
secure_vector< bytemceies_decrypt (const McEliece_PrivateKey &privkey, const secure_vector< byte > &ct, byte ad[], size_t ad_len)
 
secure_vector< bytemceies_encrypt (const McEliece_PublicKey &pubkey, const secure_vector< byte > &pt, byte ad[], size_t ad_len, RandomNumberGenerator &rng)
 
secure_vector< bytemceliece_decrypt (secure_vector< gf2m > &error_pos, const byte *ciphertext, u32bit ciphertext_len, const McEliece_PrivateKey &key)
 
std::vector< bytemceliece_encrypt (const secure_vector< byte > &cleartext, const std::vector< byte > &public_matrix, const secure_vector< gf2m > &err_pos, u32bit code_length)
 
BOTAN_DLL size_t mceliece_work_factor (size_t code_size, size_t k, size_t t)
 
void mgf1_mask (HashFunction &hash, const byte in[], size_t in_len, byte out[], size_t out_len)
 
word monty_inverse (word input)
 
void mul64x64_128 (u64bit a, u64bit b, u64bit *lo, u64bit *hi)
 
BigInt mul_add (const BigInt &a, const BigInt &b, const BigInt &c)
 
PointGFp multi_exponentiate (const PointGFp &p1, const BigInt &z1, const PointGFp &p2, const BigInt &z2)
 
template<typename K , typename V >
void multimap_insert (std::multimap< K, V > &multimap, const K &key, const V &value)
 
bool operator!= (EAC1_1_Req const &lhs, EAC1_1_Req const &rhs)
 
bool operator!= (const ECDSA_Signature &lhs, const ECDSA_Signature &rhs)
 
bool operator!= (const CRL_Entry &a1, const CRL_Entry &a2)
 
bool operator!= (const AlgorithmIdentifier &a1, const AlgorithmIdentifier &a2)
 
bool operator!= (EAC1_1_CVC const &lhs, EAC1_1_CVC const &rhs)
 
bool operator!= (EAC1_1_ADO const &lhs, EAC1_1_ADO const &rhs)
 
template<typename T >
bool operator!= (const secure_allocator< T > &, const secure_allocator< T > &)
 
bool operator!= (const OID &a, const OID &b)
 
bool operator!= (const OctetString &s1, const OctetString &s2)
 
bool operator!= (const EC_Group &lhs, const EC_Group &rhs)
 
bool operator!= (const X509_DN &dn1, const X509_DN &dn2)
 
bool operator!= (const CurveGFp &lhs, const CurveGFp &rhs)
 
bool operator!= (const EAC_Time &t1, const EAC_Time &t2)
 
bool operator!= (const ASN1_EAC_String &lhs, const ASN1_EAC_String &rhs)
 
bool operator!= (const PointGFp &lhs, const PointGFp &rhs)
 
bool operator!= (const X509_Time &t1, const X509_Time &t2)
 
bool operator!= (const X509_Certificate &cert1, const X509_Certificate &cert2)
 
bool operator!= (const BigInt &a, const BigInt &b)
 
BigInt operator% (const BigInt &n, const BigInt &mod)
 
word operator% (const BigInt &n, word mod)
 
donna128 operator* (const donna128 &x, u64bit y)
 
BigInt operator* (const BigInt &x, const BigInt &y)
 
PointGFp operator* (const BigInt &scalar, const PointGFp &point)
 
PointGFp operator* (const PointGFp &point, const BigInt &scalar)
 
BigInt operator+ (const BigInt &x, const BigInt &y)
 
donna128 operator+ (const donna128 &x, const donna128 &y)
 
OID operator+ (const OID &oid, u32bit component)
 
donna128 operator+ (const donna128 &x, u64bit y)
 
OctetString operator+ (const OctetString &k1, const OctetString &k2)
 
PointGFp operator+ (const PointGFp &lhs, const PointGFp &rhs)
 
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)
 
BigInt operator- (const BigInt &x, const BigInt &y)
 
PointGFp operator- (const PointGFp &lhs)
 
PointGFp operator- (const PointGFp &lhs, const PointGFp &rhs)
 
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 EAC_Time &t1, const EAC_Time &t2)
 
bool operator< (const X509_Time &t1, const X509_Time &t2)
 
bool operator< (const BigInt &a, const BigInt &b)
 
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 &out, const X509_DN &dn)
 
BOTAN_DLL std::ostream & operator<< (std::ostream &out, Pipe &pipe)
 
bool operator<= (const EAC_Time &t1, const EAC_Time &t2)
 
bool operator<= (const X509_Time &t1, const X509_Time &t2)
 
bool operator<= (const BigInt &a, const BigInt &b)
 
bool operator== (const CRL_Entry &a1, const CRL_Entry &a2)
 
bool operator== (const AlgorithmIdentifier &a1, const AlgorithmIdentifier &a2)
 
template<typename T >
bool operator== (const secure_allocator< T > &, const secure_allocator< T > &)
 
bool operator== (const OctetString &s1, const OctetString &s2)
 
bool operator== (const ASN1_EAC_String &lhs, const ASN1_EAC_String &rhs)
 
bool operator== (const X509_DN &dn1, const X509_DN &dn2)
 
bool operator== (const CurveGFp &lhs, const CurveGFp &rhs)
 
bool operator== (const EAC_Time &t1, const EAC_Time &t2)
 
bool operator== (const X509_Time &t1, const X509_Time &t2)
 
bool operator== (const BigInt &a, const BigInt &b)
 
bool operator> (const EAC_Time &t1, const EAC_Time &t2)
 
bool operator> (const X509_Time &t1, const X509_Time &t2)
 
bool operator> (const BigInt &a, const BigInt &b)
 
bool operator>= (const EAC_Time &t1, const EAC_Time &t2)
 
bool operator>= (const X509_Time &t1, const X509_Time &t2)
 
bool operator>= (const BigInt &a, const BigInt &b)
 
int operator>> (int fd, Pipe &pipe)
 
std::istream & operator>> (std::istream &stream, BigInt &n)
 
BigInt operator>> (const BigInt &x, size_t shift)
 
BOTAN_DLL std::istream & operator>> (std::istream &in, Pipe &pipe)
 
OctetString operator^ (const OctetString &k1, const OctetString &k2)
 
template<typename T , typename Alloc , typename Alloc2 >
std::vector< T, Alloc > & operator^= (std::vector< T, Alloc > &out, const std::vector< T, Alloc2 > &in)
 
donna128 operator| (const donna128 &x, const donna128 &y)
 
template<typename Alloc >
PointGFp OS2ECP (const std::vector< byte, Alloc > &data, const CurveGFp &curve)
 
PointGFp OS2ECP (const byte data[], size_t data_len, const CurveGFp &curve)
 
std::vector< std::string > parse_algorithm_name (const std::string &namex)
 
std::vector< u32bitparse_asn1_oid (const std::string &oid)
 
secure_vector< bytepbes2_decrypt (const secure_vector< byte > &key_bits, const std::string &passphrase, const std::vector< byte > &params)
 
std::pair< AlgorithmIdentifier, std::vector< byte > > pbes2_encrypt (const secure_vector< byte > &key_bits, const std::string &passphrase, std::chrono::milliseconds msec, const std::string &cipher, const std::string &digest, RandomNumberGenerator &rng)
 
size_t pbkdf2 (MessageAuthenticationCode &prf, byte out[], size_t out_len, const std::string &passphrase, const byte salt[], size_t salt_len, size_t iterations, std::chrono::milliseconds msec)
 
secure_vector< bytePGP_decode (DataSource &source, std::string &label, std::map< std::string, std::string > &headers)
 
secure_vector< bytePGP_decode (DataSource &source, std::string &label)
 
std::string PGP_encode (const byte input[], size_t length, const std::string &label, const std::map< std::string, std::string > &headers)
 
std::string PGP_encode (const byte input[], size_t length, const std::string &type)
 
std::vector< bytepkcs_hash_id (const std::string &name)
 
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)
 
template<typename T >
std::vector< std::string > providers_of (const typename T::Spec &spec)
 
bool quick_check_prime (const BigInt &n, RandomNumberGenerator &rng)
 
gf2m random_code_element (unsigned code_length, Botan::RandomNumberGenerator &rng)
 
BigInt random_prime (RandomNumberGenerator &rng, size_t bits, const BigInt &coprime, size_t equiv, size_t modulo)
 
BigInt random_safe_prime (RandomNumberGenerator &rng, size_t bits)
 
std::map< std::string, std::string > BOTAN_DLL read_cfg (std::istream &is)
 
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 BOTAN_DLL ressol (const BigInt &x, const BigInt &p)
 
u16bit reverse_bytes (u16bit val)
 
u32bit reverse_bytes (u32bit val)
 
u64bit reverse_bytes (u64bit val)
 
secure_vector< byterfc3394_keyunwrap (const secure_vector< byte > &key, const SymmetricKey &kek)
 
secure_vector< byterfc3394_keywrap (const secure_vector< byte > &key, const SymmetricKey &kek)
 
template<typename T >
rotate_left (T input, size_t rot)
 
template<typename T >
rotate_right (T input, size_t rot)
 
template<typename T >
round_down (T n, T align_to)
 
template<typename T >
round_up (T n, T align_to)
 
template<typename T >
bool same_mem (const T *p1, const T *p2, size_t n)
 
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)
 
template<typename T >
void set_mem (T *ptr, size_t n, byte val)
 
template<typename T >
size_t significant_bytes (T n)
 
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< byte > &salt, const BigInt &B, RandomNumberGenerator &rng)
 
std::string srp6_group_identifier (const BigInt &N, const BigInt &g)
 
void store_be (u16bit in, byte out[2])
 
void store_be (u32bit in, byte out[4])
 
void store_be (u64bit in, byte out[8])
 
template<typename T >
void store_be (byte out[], T x0, T x1)
 
template<typename T >
void store_be (byte out[], T x0, T x1, T x2, T x3)
 
template<typename T >
void store_be (byte out[], T x0, T x1, T x2, T x3, T x4, T x5, T x6, T x7)
 
void store_le (u16bit in, byte out[2])
 
void store_le (u32bit in, byte out[4])
 
void store_le (u64bit in, byte out[8])
 
template<typename T >
void store_le (byte out[], T x0, T x1)
 
template<typename T >
void store_le (byte out[], T x0, T x1, T x2, T x3)
 
template<typename T >
void store_le (byte 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)
 
u32bit 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)
 
RandomNumberGeneratorsystem_rng ()
 
u32bit timespec_to_u32bit (const std::string &timespec)
 
std::vector< byteto_byte_vector (const std::string &s)
 
u32bit to_u32bit (const std::string &str)
 
template<typename T >
std::vector< T > unlock (const secure_vector< T > &in)
 
template<typename T >
bool value_exists (const std::vector< T > &vec, const T &val)
 
bool verify_prime (const BigInt &n, RandomNumberGenerator &rng)
 
const char * version_cstr ()
 
u32bit version_datestamp ()
 
u32bit version_major ()
 
u32bit version_minor ()
 
u32bit version_patch ()
 
std::string version_string ()
 
void word3_muladd (word *w2, word *w1, word *w0, word a, word b)
 
void word3_muladd_2 (word *w2, word *w1, word *w0, word a, word b)
 
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_linmul3 (word z[4], const word x[4], word y, word carry)
 
word word8_madd3 (word z[8], const word x[8], word y, word carry)
 
word word8_muladd (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 * > &certstores)
 
Path_Validation_Result x509_path_validate (const X509_Certificate &end_cert, const Path_Validation_Restrictions &restrictions, const std::vector< Certificate_Store * > &certstores)
 
Path_Validation_Result x509_path_validate (const std::vector< X509_Certificate > &end_certs, const Path_Validation_Restrictions &restrictions, const Certificate_Store &store)
 
Path_Validation_Result x509_path_validate (const X509_Certificate &end_cert, const Path_Validation_Restrictions &restrictions, const Certificate_Store &store)
 
template<typename T >
void xor_buf (T out[], const T in[], size_t length)
 
template<typename T >
void xor_buf (T out[], const T in[], const T in2[], size_t length)
 
template<typename Alloc , typename Alloc2 >
void xor_buf (std::vector< byte, Alloc > &out, const std::vector< byte, Alloc2 > &in, size_t n)
 
template<typename Alloc >
void xor_buf (std::vector< byte, Alloc > &out, const byte *in, size_t n)
 
template<typename Alloc , typename Alloc2 >
void xor_buf (std::vector< byte, Alloc > &out, const byte *in, const std::vector< byte, Alloc2 > &in2, size_t n)
 
template<typename T , typename Alloc >
void zap (std::vector< T, Alloc > &vec)
 
BOTAN_DLL void zero_mem (void *ptr, size_t n)
 
template<typename T , typename Alloc >
void zeroise (std::vector< T, Alloc > &vec)
 

Variables

const u64bit Camellia_SBOX1 [256]
 
const u64bit Camellia_SBOX2 [256]
 
const u64bit Camellia_SBOX3 [256]
 
const u64bit Camellia_SBOX4 [256]
 
const u64bit Camellia_SBOX5 [256]
 
const u64bit Camellia_SBOX6 [256]
 
const u64bit Camellia_SBOX7 [256]
 
const u64bit Camellia_SBOX8 [256]
 
const u32bit CAST_SBOX1 [256]
 
const u32bit CAST_SBOX2 [256]
 
const u32bit CAST_SBOX3 [256]
 
const u32bit CAST_SBOX4 [256]
 
const u64bit DES_FPTAB1 [256]
 
const u64bit DES_FPTAB2 [256]
 
const u64bit DES_IPTAB1 [256]
 
const u64bit DES_IPTAB2 [256]
 
const u32bit DES_SPBOX1 [256]
 
const u32bit DES_SPBOX2 [256]
 
const u32bit DES_SPBOX3 [256]
 
const u32bit DES_SPBOX4 [256]
 
const u32bit DES_SPBOX5 [256]
 
const u32bit DES_SPBOX6 [256]
 
const u32bit DES_SPBOX7 [256]
 
const u32bit DES_SPBOX8 [256]
 
const size_t HEX_CODEC_BUFFER_SIZE = 256
 
const size_t MP_WORD_BITS = BOTAN_MP_WORD_BITS
 
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)
 
const size_t PRIME_TABLE_SIZE = 6541
 
const u16bit BOTAN_DLL PRIMES []
 

Detailed Description

(C) Copyright Projet SECRET, INRIA, Rocquencourt (C) Bhaskar Biswas and Nicolas Sendrier

(C) 2014 cryptosource GmbH (C) 2014 Falko Strenzke fstre.nosp@m.nzke.nosp@m.@cryp.nosp@m.toso.nosp@m.urce..nosp@m.de

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

(C) 2014 cryptosource GmbH (C) 2014 Falko Strenzke fstre.nosp@m.nzke.nosp@m.@cryp.nosp@m.toso.nosp@m.urce..nosp@m.de

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

(C) Copyright Projet SECRET, INRIA, Rocquencourt (C) Bhaskar Biswas and Nicolas Sendrier (C) 2014 Jack Lloyd

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

Dynamically Loaded Object (C) 2010 Jack Lloyd

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

The primary namespace for the botan library

Typedef Documentation

typedef uint8_t Botan::byte

Definition at line 31 of file types.h.

Definition at line 144 of file ec_group.h.

typedef std::runtime_error Botan::Exception

Definition at line 19 of file exceptn.h.

typedef limb Botan::felem[5]

Definition at line 39 of file donna.cpp.

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

Definition at line 139 of file symkey.h.

typedef std::invalid_argument Botan::Invalid_Argument

Definition at line 20 of file exceptn.h.

Definition at line 38 of file donna.cpp.

Definition at line 143 of file pk_keys.h.

Definition at line 145 of file pk_keys.h.

typedef int32_t Botan::s32bit

Definition at line 36 of file types.h.

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

Definition at line 94 of file secmem.h.

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

Definition at line 93 of file secmem.h.

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

Definition at line 134 of file symkey.h.

Definition at line 174 of file transform.h.

Definition at line 66 of file transform_filter.h.

typedef uint16_t Botan::u16bit

Definition at line 32 of file types.h.

typedef uint32_t Botan::u32bit

Definition at line 33 of file types.h.

typedef uint64_t Botan::u64bit

Definition at line 34 of file types.h.

typedef byte Botan::u8

Definition at line 37 of file donna.cpp.

Definition at line 42 of file donna.cpp.

Definition at line 144 of file pk_keys.h.

Enumeration Type Documentation

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 
BMP_STRING 
UTC_TIME 
GENERALIZED_TIME 
NO_OBJECT 
DIRECTORY_STRING 

Definition at line 19 of file asn1_obj.h.

19  {
20  UNIVERSAL = 0x00,
21  APPLICATION = 0x40,
22  CONTEXT_SPECIFIC = 0x80,
23 
24  CONSTRUCTED = 0x20,
25 
27 
28  EOC = 0x00,
29  BOOLEAN = 0x01,
30  INTEGER = 0x02,
31  BIT_STRING = 0x03,
32  OCTET_STRING = 0x04,
33  NULL_TAG = 0x05,
34  OBJECT_ID = 0x06,
35  ENUMERATED = 0x0A,
36  SEQUENCE = 0x10,
37  SET = 0x11,
38 
39  UTF8_STRING = 0x0C,
40  NUMERIC_STRING = 0x12,
41  PRINTABLE_STRING = 0x13,
42  T61_STRING = 0x14,
43  IA5_STRING = 0x16,
44  VISIBLE_STRING = 0x1A,
45  BMP_STRING = 0x1E,
46 
47  UTC_TIME = 0x17,
48  GENERALIZED_TIME = 0x18,
49 
50  NO_OBJECT = 0xFF00,
51  DIRECTORY_STRING = 0xFF01
52 };
Enumerator
VERIFIED 
OCSP_RESPONSE_GOOD 
NO_REVOCATION_DATA 
SIGNATURE_METHOD_TOO_WEAK 
UNTRUSTED_HASH 
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 
POLICY_ERROR 
INVALID_USAGE 
CERT_CHAIN_TOO_LONG 
CA_CERT_NOT_FOR_CERT_ISSUER 
CA_CERT_NOT_FOR_CRL_ISSUER 
OCSP_CERT_NOT_LISTED 
OCSP_BAD_STATUS 
CERT_IS_REVOKED 
CRL_BAD_SIGNATURE 
SIGNATURE_ERROR 

Definition at line 13 of file cert_status.h.

13  {
14  VERIFIED = 0x00000000,
17 
18  // Local policy failures
21 
22  // Time problems
23  CERT_NOT_YET_VALID = 2000,
29 
30  // Chain generation problems
31  CERT_ISSUER_NOT_FOUND = 3000,
33 
34  // Validation errors
35  POLICY_ERROR = 4000,
39 
40  // Revocation errors
44 
45  // Hard failures
46  CERT_IS_REVOKED = 5000,
49 };

The different charsets (nominally) supported by Botan.

Enumerator
LOCAL_CHARSET 
UCS2_CHARSET 
UTF8_CHARSET 
LATIN1_CHARSET 

Definition at line 19 of file charset.h.

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

Enumerator
ENCRYPTION 
DECRYPTION 

Definition at line 38 of file cipher_mode.h.

X.509v2 CRL Reason Code.

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

Definition at line 19 of file crl_ent.h.

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 179 of file filter.h.

This class represents elliptic curce domain parameters

Enumerator
EC_DOMPAR_ENC_EXPLICIT 
EC_DOMPAR_ENC_IMPLICITCA 
EC_DOMPAR_ENC_OID 

Definition at line 22 of file ec_group.h.

Enum marking if protection against fault attacks should be used

Enumerator
ENABLE_FAULT_PROTECTION 
DISABLE_FAULT_PROTECTION 

Definition at line 29 of file pubkey.h.

X.509v3 Key Constraints.

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 18 of file key_constraint.h.

The two types of signature format supported by Botan.

Enumerator
IEEE_1363 
DER_SEQUENCE 

Definition at line 24 of file pubkey.h.

The two types of X509 encoding supported by Botan.

Enumerator
RAW_BER 
PEM 

Definition at line 21 of file x509_key.h.

Function Documentation

BigInt Botan::abs ( const BigInt n)
inline

Return the absolute value

Parameters
nan integer
Returns
absolute value of n

Definition at line 44 of file numthry.h.

References Botan::BigInt::abs().

44 { return n.abs(); }
const BigInt & n
Definition: rsa.cpp:107
std::map< std::string, double > BOTAN_DLL Botan::algorithm_benchmark ( const std::string &  name,
RandomNumberGenerator rng,
std::chrono::milliseconds  milliseconds,
size_t  buf_size 
)

Algorithm benchmark

Parameters
namethe name of the algorithm to test (cipher, hash, or MAC)
afthe algorithm factory used to create objects
rngthe rng to use to generate random inputs
millisecondstotal time for the benchmark to run
buf_sizesize of buffer to benchmark against, in KiB
Returns
results a map from provider to speed in mebibytes per second

Definition at line 150 of file benchmark.cpp.

154  {
155  //Algorithm_Factory& af = global_state().algorithm_factory();
156  const auto providers = get_all_providers_of(name);
157 
158  std::map<std::string, double> all_results; // provider -> ops/sec
159 
160  if(!providers.empty())
161  {
162  const std::chrono::nanoseconds ns_per_provider = milliseconds / providers.size();
163 
164  for(auto provider : providers)
165  {
166  auto results = time_algorithm_ops(name, provider, rng, ns_per_provider, buf_size);
167  all_results[provider] = find_first_in(results, { "", "update", "encrypt" });
168  }
169  }
170 
171  return all_results;
172  }
void BOTAN_DLL Botan::aont_package ( RandomNumberGenerator rng,
BlockCipher cipher,
const byte  input[],
size_t  input_len,
byte  output[] 
)

Rivest's Package Tranform

Parameters
rngthe random number generator to use
cipherthe block cipher to use
inputthe input data buffer
input_lenthe length of the input data in bytes
outputthe output data buffer (must be at least input_len + cipher->BLOCK_SIZE bytes long)

Definition at line 17 of file package.cpp.

References Botan::OctetString::begin(), Botan::BlockCipher::block_size(), clear_mem(), copy_mem(), Botan::BlockCipher::encrypt(), get_byte(), Botan::Pipe::process_msg(), Botan::Pipe::read(), Botan::Pipe::remaining(), Botan::SymmetricAlgorithm::set_key(), Botan::SymmetricAlgorithm::valid_keylength(), xor_buf(), and zeroise().

21  {
22  const size_t BLOCK_SIZE = cipher->block_size();
23 
24  if(!cipher->valid_keylength(BLOCK_SIZE))
25  throw Invalid_Argument("AONT::package: Invalid cipher");
26 
27  // The all-zero string which is used both as the CTR IV and as K0
28  const std::string all_zeros(BLOCK_SIZE*2, '0');
29 
30  SymmetricKey package_key(rng, BLOCK_SIZE);
31 
32  Pipe pipe(new StreamCipher_Filter(new CTR_BE(cipher), package_key));
33 
34  pipe.process_msg(input, input_len);
35  pipe.read(output, pipe.remaining());
36 
37  // Set K0 (the all zero key)
38  cipher->set_key(SymmetricKey(all_zeros));
39 
40  secure_vector<byte> buf(BLOCK_SIZE);
41 
42  const size_t blocks =
43  (input_len + BLOCK_SIZE - 1) / BLOCK_SIZE;
44 
45  byte* final_block = output + input_len;
46  clear_mem(final_block, BLOCK_SIZE);
47 
48  // XOR the hash blocks into the final block
49  for(size_t i = 0; i != blocks; ++i)
50  {
51  const size_t left = std::min<size_t>(BLOCK_SIZE,
52  input_len - BLOCK_SIZE * i);
53 
54  zeroise(buf);
55  copy_mem(&buf[0], output + (BLOCK_SIZE * i), left);
56 
57  for(size_t j = 0; j != sizeof(i); ++j)
58  buf[BLOCK_SIZE - 1 - j] ^= get_byte(sizeof(i)-1-j, i);
59 
60  cipher->encrypt(&buf[0]);
61 
62  xor_buf(&final_block[0], &buf[0], BLOCK_SIZE);
63  }
64 
65  // XOR the random package key into the final block
66  xor_buf(&final_block[0], package_key.begin(), BLOCK_SIZE);
67  }
void xor_buf(T out[], const T in[], size_t length)
Definition: xor_buf.h:23
void clear_mem(T *ptr, size_t n)
Definition: mem_ops.h:28
std::invalid_argument Invalid_Argument
Definition: exceptn.h:20
byte get_byte(size_t byte_num, T input)
Definition: get_byte.h:21
OctetString SymmetricKey
Definition: symkey.h:134
uint8_t byte
Definition: types.h:31
void copy_mem(T *out, const T *in, size_t n)
Definition: mem_ops.h:39
void zeroise(std::vector< T, Alloc > &vec)
Definition: secmem.h:168
void BOTAN_DLL Botan::aont_unpackage ( BlockCipher cipher,
const byte  input[],
size_t  input_len,
byte  output[] 
)

Rivest's Package Tranform (Inversion)

Parameters
cipherthe block cipher to use
inputthe input data buffer
input_lenthe length of the input data in bytes
outputthe output data buffer (must be at least input_len - cipher->BLOCK_SIZE bytes long)

Definition at line 69 of file package.cpp.

References Botan::BlockCipher::block_size(), copy_mem(), Botan::BlockCipher::encrypt(), get_byte(), Botan::Pipe::process_msg(), Botan::Pipe::read(), Botan::Pipe::remaining(), Botan::SymmetricAlgorithm::set_key(), Botan::SymmetricAlgorithm::valid_keylength(), xor_buf(), and zeroise().

72  {
73  const size_t BLOCK_SIZE = cipher->block_size();
74 
75  if(!cipher->valid_keylength(BLOCK_SIZE))
76  throw Invalid_Argument("AONT::unpackage: Invalid cipher");
77 
78  if(input_len < BLOCK_SIZE)
79  throw Invalid_Argument("AONT::unpackage: Input too short");
80 
81  // The all-zero string which is used both as the CTR IV and as K0
82  const std::string all_zeros(BLOCK_SIZE*2, '0');
83 
84  cipher->set_key(SymmetricKey(all_zeros));
85 
86  secure_vector<byte> package_key(BLOCK_SIZE);
87  secure_vector<byte> buf(BLOCK_SIZE);
88 
89  // Copy the package key (masked with the block hashes)
90  copy_mem(&package_key[0],
91  input + (input_len - BLOCK_SIZE),
92  BLOCK_SIZE);
93 
94  const size_t blocks = ((input_len - 1) / BLOCK_SIZE);
95 
96  // XOR the blocks into the package key bits
97  for(size_t i = 0; i != blocks; ++i)
98  {
99  const size_t left = std::min<size_t>(BLOCK_SIZE,
100  input_len - BLOCK_SIZE * (i+1));
101 
102  zeroise(buf);
103  copy_mem(&buf[0], input + (BLOCK_SIZE * i), left);
104 
105  for(size_t j = 0; j != sizeof(i); ++j)
106  buf[BLOCK_SIZE - 1 - j] ^= get_byte(sizeof(i)-1-j, i);
107 
108  cipher->encrypt(&buf[0]);
109 
110  xor_buf(&package_key[0], &buf[0], BLOCK_SIZE);
111  }
112 
113  Pipe pipe(new StreamCipher_Filter(new CTR_BE(cipher), package_key));
114 
115  pipe.process_msg(input, input_len - BLOCK_SIZE);
116 
117  pipe.read(output, pipe.remaining());
118  }
void xor_buf(T out[], const T in[], size_t length)
Definition: xor_buf.h:23
std::invalid_argument Invalid_Argument
Definition: exceptn.h:20
byte get_byte(size_t byte_num, T input)
Definition: get_byte.h:21
OctetString SymmetricKey
Definition: symkey.h:134
void copy_mem(T *out, const T *in, size_t n)
Definition: mem_ops.h:39
void zeroise(std::vector< T, Alloc > &vec)
Definition: secmem.h:168
void BOTAN_DLL Botan::assertion_failure ( const char *  expr_str,
const char *  assertion_made,
const char *  func,
const char *  file,
int  line 
)

Called when an assertion fails

Definition at line 13 of file assert.cpp.

18  {
19  std::ostringstream format;
20 
21  format << "False assertion ";
22 
23  if(assertion_made && assertion_made[0] != 0)
24  format << "'" << assertion_made << "' (expression " << expr_str << ") ";
25  else
26  format << expr_str << " ";
27 
28  if(func)
29  format << "in " << func << " ";
30 
31  format << "@" << file << ":" << line;
32 
33  throw std::runtime_error(format.str());
34  }
size_t BOTAN_DLL Botan::base64_decode ( byte  output[],
const char  input[],
size_t  input_length,
size_t &  input_consumed,
bool  final_inputs,
bool  ignore_ws = true 
)

Perform base64 decoding

Parameters
outputan array of at least input_length*3/4 bytes
inputsome base64 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 97 of file base64.cpp.

References clear_mem().

Referenced by base64_decode(), check_passhash9(), Botan::Base64_Decoder::end_msg(), Botan::SRP6_Authenticator_File::SRP6_Authenticator_File(), and Botan::Base64_Decoder::write().

103  {
104  /*
105  * Base64 Decoder Lookup Table
106  * Warning: assumes ASCII encodings
107  */
108  static const byte BASE64_TO_BIN[256] = {
109  0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x80,
110  0x80, 0xFF, 0xFF, 0x80, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
111  0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
112  0xFF, 0xFF, 0x80, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
113  0xFF, 0xFF, 0xFF, 0x3E, 0xFF, 0xFF, 0xFF, 0x3F, 0x34, 0x35,
114  0x36, 0x37, 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0xFF, 0xFF,
115  0xFF, 0x81, 0xFF, 0xFF, 0xFF, 0x00, 0x01, 0x02, 0x03, 0x04,
116  0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E,
117  0x0F, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18,
118  0x19, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x1A, 0x1B, 0x1C,
119  0x1D, 0x1E, 0x1F, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26,
120  0x27, 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F, 0x30,
121  0x31, 0x32, 0x33, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
122  0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
123  0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
124  0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
125  0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
126  0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
127  0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
128  0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
129  0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
130  0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
131  0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
132  0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
133  0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
134  0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF };
135 
136  byte* out_ptr = output;
137  byte decode_buf[4];
138  size_t decode_buf_pos = 0;
139  size_t final_truncate = 0;
140 
141  clear_mem(output, input_length * 3 / 4);
142 
143  for(size_t i = 0; i != input_length; ++i)
144  {
145  const byte bin = BASE64_TO_BIN[static_cast<byte>(input[i])];
146 
147  if(bin <= 0x3F)
148  {
149  decode_buf[decode_buf_pos] = bin;
150  decode_buf_pos += 1;
151  }
152  else if(!(bin == 0x81 || (bin == 0x80 && ignore_ws)))
153  {
154  std::string bad_char(1, input[i]);
155  if(bad_char == "\t")
156  bad_char = "\\t";
157  else if(bad_char == "\n")
158  bad_char = "\\n";
159  else if(bad_char == "\r")
160  bad_char = "\\r";
161 
162  throw std::invalid_argument(
163  std::string("base64_decode: invalid base64 character '") +
164  bad_char + "'");
165  }
166 
167  /*
168  * If we're at the end of the input, pad with 0s and truncate
169  */
170  if(final_inputs && (i == input_length - 1))
171  {
172  if(decode_buf_pos)
173  {
174  for(size_t j = decode_buf_pos; j != 4; ++j)
175  decode_buf[j] = 0;
176  final_truncate = (4 - decode_buf_pos);
177  decode_buf_pos = 4;
178  }
179  }
180 
181  if(decode_buf_pos == 4)
182  {
183  out_ptr[0] = (decode_buf[0] << 2) | (decode_buf[1] >> 4);
184  out_ptr[1] = (decode_buf[1] << 4) | (decode_buf[2] >> 2);
185  out_ptr[2] = (decode_buf[2] << 6) | decode_buf[3];
186 
187  out_ptr += 3;
188  decode_buf_pos = 0;
189  input_consumed = i+1;
190  }
191  }
192 
193  while(input_consumed < input_length &&
194  BASE64_TO_BIN[static_cast<byte>(input[input_consumed])] == 0x80)
195  {
196  ++input_consumed;
197  }
198 
199  size_t written = (out_ptr - output) - final_truncate;
200 
201  return written;
202  }
void clear_mem(T *ptr, size_t n)
Definition: mem_ops.h:28
uint8_t byte
Definition: types.h:31
size_t BOTAN_DLL Botan::base64_decode ( byte  output[],
const char  input[],
size_t  input_length,
bool  ignore_ws = true 
)

Perform base64 decoding

Parameters
outputan array of at least input_length*3/4 bytes
inputsome base64 input
input_lengthlength of input in bytes
ignore_wsignore whitespace on input; if false, throw an exception if whitespace is encountered
Returns
number of bytes written to output

Definition at line 204 of file base64.cpp.

References base64_decode().

208  {
209  size_t consumed = 0;
210  size_t written = base64_decode(output, input, input_length,
211  consumed, true, ignore_ws);
212 
213  if(consumed != input_length)
214  throw std::invalid_argument("base64_decode: input did not have full bytes");
215 
216  return written;
217  }
secure_vector< byte > base64_decode(const std::string &input, bool ignore_ws)
Definition: base64.cpp:244
size_t BOTAN_DLL Botan::base64_decode ( byte  output[],
const std::string &  input,
bool  ignore_ws = true 
)

Perform base64 decoding

Parameters
outputan array of at least input_length/3*4 bytes
inputsome base64 input
ignore_wsignore whitespace on input; if false, throw an exception if whitespace is encountered
Returns
number of bytes written to output

Definition at line 219 of file base64.cpp.

References base64_decode().

222  {
223  return base64_decode(output, input.data(), input.length(), ignore_ws);
224  }
secure_vector< byte > base64_decode(const std::string &input, bool ignore_ws)
Definition: base64.cpp:244
secure_vector< byte > BOTAN_DLL Botan::base64_decode ( const char  input[],
size_t  input_length,
bool  ignore_ws = true 
)

Perform base64 decoding

Parameters
inputsome base64 input
input_lengththe length of input in bytes
ignore_wsignore whitespace on input; if false, throw an exception if whitespace is encountered
Returns
decoded base64 output

Definition at line 226 of file base64.cpp.

References base64_decode().

229  {
230  const size_t output_length = (input_length == 0)
231  ? 0
232  : (round_up<size_t>(input_length, 4) * 3) / 4;
233  secure_vector<byte> bin(output_length);
234 
235  size_t written = base64_decode(&bin[0],
236  input,
237  input_length,
238  ignore_ws);
239 
240  bin.resize(written);
241  return bin;
242  }
secure_vector< byte > base64_decode(const std::string &input, bool ignore_ws)
Definition: base64.cpp:244
secure_vector< byte > BOTAN_DLL Botan::base64_decode ( const std::string &  input,
bool  ignore_ws = true 
)

Perform base64 decoding

Parameters
inputsome base64 input
ignore_wsignore whitespace on input; if false, throw an exception if whitespace is encountered
Returns
decoded base64 output

Definition at line 244 of file base64.cpp.

References base64_decode().

246  {
247  return base64_decode(input.data(), input.size(), ignore_ws);
248  }
secure_vector< byte > base64_decode(const std::string &input, bool ignore_ws)
Definition: base64.cpp:244
size_t BOTAN_DLL Botan::base64_encode ( char  output[],
const byte  input[],
size_t  input_length,
size_t &  input_consumed,
bool  final_inputs 
)

Perform base64 encoding

Parameters
outputan array of at least input_length*4/3 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 35 of file base64.cpp.

Referenced by Botan::OCSP::Request::base64_encode(), base64_encode(), and generate_passhash9().

40  {
41  input_consumed = 0;
42 
43  size_t input_remaining = input_length;
44  size_t output_produced = 0;
45 
46  while(input_remaining >= 3)
47  {
48  do_base64_encode(out + output_produced, in + input_consumed);
49 
50  input_consumed += 3;
51  output_produced += 4;
52  input_remaining -= 3;
53  }
54 
55  if(final_inputs && input_remaining)
56  {
57  byte remainder[3] = { 0 };
58  for(size_t i = 0; i != input_remaining; ++i)
59  remainder[i] = in[input_consumed + i];
60 
61  do_base64_encode(out + output_produced, remainder);
62 
63  size_t empty_bits = 8 * (3 - input_remaining);
64  size_t index = output_produced + 4 - 1;
65  while(empty_bits >= 8)
66  {
67  out[index--] = '=';
68  empty_bits -= 6;
69  }
70 
71  input_consumed += input_remaining;
72  output_produced += 4;
73  }
74 
75  return output_produced;
76  }
uint8_t byte
Definition: types.h:31
template<typename Alloc >
std::string Botan::base64_encode ( const std::vector< byte, Alloc > &  input)

Perform base64 encoding

Parameters
inputsome input
Returns
base64adecimal representation of input

Definition at line 50 of file base64.h.

References base64_encode().

51  {
52  return base64_encode(&input[0], input.size());
53  }
std::string base64_encode(const std::vector< byte, Alloc > &input)
Definition: base64.h:50
std::string BOTAN_DLL Botan::base64_encode ( const byte  input[],
size_t  input_length 
)

Perform base64 encoding

Parameters
inputsome input
input_lengthlength of input in bytes
Returns
base64adecimal representation of input

Definition at line 78 of file base64.cpp.

References base64_encode(), and BOTAN_ASSERT_EQUAL.

80  {
81  const size_t output_length = (input_length == 0)
82  ? 0
83  : (round_up<size_t>(input_length, 3) / 3) * 4;
84  std::string output(output_length, 0);
85 
86  size_t consumed = 0;
87  size_t produced = base64_encode(&output[0],
88  input, input_length,
89  consumed, true);
90 
91  BOTAN_ASSERT_EQUAL(consumed, input_length, "Consumed the entire input");
92  BOTAN_ASSERT_EQUAL(produced, output.size(), "Produced expected size");
93 
94  return output;
95  }
std::string base64_encode(const byte input[], size_t input_length)
Definition: base64.cpp:78
#define BOTAN_ASSERT_EQUAL(expr1, expr2, assertion_made)
Definition: assert.h:40
void Botan::bigint_add2 ( word  x[],
size_t  x_size,
const word  y[],
size_t  y_size 
)

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 70 of file mp_asm.cpp.

References bigint_add2_nc().

Referenced by mul_add(), Botan::BigInt::operator+=(), and Botan::BigInt::operator-=().

71  {
72  if(bigint_add2_nc(x, x_size, y, y_size))
73  x[x_size] += 1;
74  }
const BigInt & x
Definition: dsa.cpp:98
const BigInt & y
Definition: dsa.cpp:159
word bigint_add2_nc(word x[], size_t x_size, const word y[], size_t y_size)
Definition: mp_asm.cpp:22
word Botan::bigint_add2_nc ( word  x[],
size_t  x_size,
const word  y[],
size_t  y_size 
)

Two operand addition with carry out

Definition at line 22 of file mp_asm.cpp.

References BOTAN_ASSERT, word8_add2(), and word_add().

Referenced by bigint_add2().

23  {
24  word carry = 0;
25 
26  BOTAN_ASSERT(x_size >= y_size, "Expected sizes");
27 
28  const size_t blocks = y_size - (y_size % 8);
29 
30  for(size_t i = 0; i != blocks; i += 8)
31  carry = word8_add2(x + i, y + i, carry);
32 
33  for(size_t i = blocks; i != y_size; ++i)
34  x[i] = word_add(x[i], y[i], &carry);
35 
36  for(size_t i = y_size; i != x_size; ++i)
37  x[i] = word_add(x[i], 0, &carry);
38 
39  return carry;
40  }
const BigInt & x
Definition: dsa.cpp:98
word word8_add2(word x[8], const word y[8], word carry)
Definition: mp_asmi.h:33
const BigInt & y
Definition: dsa.cpp:159
#define BOTAN_ASSERT(expr, assertion_made)
Definition: assert.h:27
word word_add(word x, word y, word *carry)
Definition: mp_asmi.h:21
void Botan::bigint_add3 ( word  z[],
const word  x[],
size_t  x_size,
const word  y[],
size_t  y_size 
)

Three operand addition

Definition at line 79 of file mp_asm.cpp.

References bigint_add3_nc().

Referenced by operator+(), and operator-().

81  {
82  z[(x_size > y_size ? x_size : y_size)] +=
83  bigint_add3_nc(z, x, x_size, y, y_size);
84  }
const BigInt & x
Definition: dsa.cpp:98
const BigInt & y
Definition: dsa.cpp:159
word bigint_add3_nc(word z[], const word x[], size_t x_size, const word y[], size_t y_size)
Definition: mp_asm.cpp:45
word Botan::bigint_add3_nc ( word  z[],
const word  x[],
size_t  x_size,
const word  y[],
size_t  y_size 
)

Three operand addition with carry out

Definition at line 45 of file mp_asm.cpp.

References word8_add3(), and word_add().

Referenced by bigint_add3().

47  {
48  if(x_size < y_size)
49  { return bigint_add3_nc(z, y, y_size, x, x_size); }
50 
51  word carry = 0;
52 
53  const size_t blocks = y_size - (y_size % 8);
54 
55  for(size_t i = 0; i != blocks; i += 8)
56  carry = word8_add3(z + i, x + i, y + i, carry);
57 
58  for(size_t i = blocks; i != y_size; ++i)
59  z[i] = word_add(x[i], y[i], &carry);
60 
61  for(size_t i = y_size; i != x_size; ++i)
62  z[i] = word_add(x[i], 0, &carry);
63 
64  return carry;
65  }
const BigInt & x
Definition: dsa.cpp:98
const BigInt & y
Definition: dsa.cpp:159
word bigint_add3_nc(word z[], const word x[], size_t x_size, const word y[], size_t y_size)
Definition: mp_asm.cpp:45
word word8_add3(word z[8], const word x[8], const word y[8], word carry)
Definition: mp_asmi.h:49
word word_add(word x, word y, word *carry)
Definition: mp_asmi.h:21
s32bit Botan::bigint_cmp ( const word  x[],
size_t  x_size,
const word  y[],
size_t  y_size 
)

Compare x and y

Definition at line 18 of file mp_misc.cpp.

Referenced by Botan::BigInt::cmp(), operator+(), Botan::BigInt::operator+=(), operator-(), and Botan::BigInt::operator-=().

20  {
21  if(x_size < y_size) { return (-bigint_cmp(y, y_size, x, x_size)); }
22 
23  while(x_size > y_size)
24  {
25  if(x[x_size-1])
26  return 1;
27  x_size--;
28  }
29 
30  for(size_t i = x_size; i > 0; --i)
31  {
32  if(x[i-1] > y[i-1])
33  return 1;
34  if(x[i-1] < y[i-1])
35  return -1;
36  }
37 
38  return 0;
39  }
const BigInt & x
Definition: dsa.cpp:98
const BigInt & y
Definition: dsa.cpp:159
s32bit bigint_cmp(const word x[], size_t x_size, const word y[], size_t y_size)
Definition: mp_misc.cpp:18
void Botan::bigint_comba_mul16 ( word  z[32],
const word  x[16],
const word  y[16] 
)

Definition at line 806 of file mp_comba.cpp.

References word3_muladd().

Referenced by bigint_mul().

807  {
808  word w2 = 0, w1 = 0, w0 = 0;
809 
810  word3_muladd(&w2, &w1, &w0, x[ 0], y[ 0]);
811  z[ 0] = w0; w0 = 0;
812 
813  word3_muladd(&w0, &w2, &w1, x[ 0], y[ 1]);
814  word3_muladd(&w0, &w2, &w1, x[ 1], y[ 0]);
815  z[ 1] = w1; w1 = 0;
816 
817  word3_muladd(&w1, &w0, &w2, x[ 0], y[ 2]);
818  word3_muladd(&w1, &w0, &w2, x[ 1], y[ 1]);
819  word3_muladd(&w1, &w0, &w2, x[ 2], y[ 0]);
820  z[ 2] = w2; w2 = 0;
821 
822  word3_muladd(&w2, &w1, &w0, x[ 0], y[ 3]);
823  word3_muladd(&w2, &w1, &w0, x[ 1], y[ 2]);
824  word3_muladd(&w2, &w1, &w0, x[ 2], y[ 1]);
825  word3_muladd(&w2, &w1, &w0, x[ 3], y[ 0]);
826  z[ 3] = w0; w0 = 0;
827 
828  word3_muladd(&w0, &w2, &w1, x[ 0], y[ 4]);
829  word3_muladd(&w0, &w2, &w1, x[ 1], y[ 3]);
830  word3_muladd(&w0, &w2, &w1, x[ 2], y[ 2]);
831  word3_muladd(&w0, &w2, &w1, x[ 3], y[ 1]);
832  word3_muladd(&w0, &w2, &w1, x[ 4], y[ 0]);
833  z[ 4] = w1; w1 = 0;
834 
835  word3_muladd(&w1, &w0, &w2, x[ 0], y[ 5]);
836  word3_muladd(&w1, &w0, &w2, x[ 1], y[ 4]);
837  word3_muladd(&w1, &w0, &w2, x[ 2], y[ 3]);
838  word3_muladd(&w1, &w0, &w2, x[ 3], y[ 2]);
839  word3_muladd(&w1, &w0, &w2, x[ 4], y[ 1]);
840  word3_muladd(&w1, &w0, &w2, x[ 5], y[ 0]);
841  z[ 5] = w2; w2 = 0;
842 
843  word3_muladd(&w2, &w1, &w0, x[ 0], y[ 6]);
844  word3_muladd(&w2, &w1, &w0, x[ 1], y[ 5]);
845  word3_muladd(&w2, &w1, &w0, x[ 2], y[ 4]);
846  word3_muladd(&w2, &w1, &w0, x[ 3], y[ 3]);
847  word3_muladd(&w2, &w1, &w0, x[ 4], y[ 2]);
848  word3_muladd(&w2, &w1, &w0, x[ 5], y[ 1]);
849  word3_muladd(&w2, &w1, &w0, x[ 6], y[ 0]);
850  z[ 6] = w0; w0 = 0;
851 
852  word3_muladd(&w0, &w2, &w1, x[ 0], y[ 7]);
853  word3_muladd(&w0, &w2, &w1, x[ 1], y[ 6]);
854  word3_muladd(&w0, &w2, &w1, x[ 2], y[ 5]);
855  word3_muladd(&w0, &w2, &w1, x[ 3], y[ 4]);
856  word3_muladd(&w0, &w2, &w1, x[ 4], y[ 3]);
857  word3_muladd(&w0, &w2, &w1, x[ 5], y[ 2]);
858  word3_muladd(&w0, &w2, &w1, x[ 6], y[ 1]);
859  word3_muladd(&w0, &w2, &w1, x[ 7], y[ 0]);
860  z[ 7] = w1; w1 = 0;
861 
862  word3_muladd(&w1, &w0, &w2, x[ 0], y[ 8]);
863  word3_muladd(&w1, &w0, &w2, x[ 1], y[ 7]);
864  word3_muladd(&w1, &w0, &w2, x[ 2], y[ 6]);
865  word3_muladd(&w1, &w0, &w2, x[ 3], y[ 5]);
866  word3_muladd(&w1, &w0, &w2, x[ 4], y[ 4]);
867  word3_muladd(&w1, &w0, &w2, x[ 5], y[ 3]);
868  word3_muladd(&w1, &w0, &w2, x[ 6], y[ 2]);
869  word3_muladd(&w1, &w0, &w2, x[ 7], y[ 1]);
870  word3_muladd(&w1, &w0, &w2, x[ 8], y[ 0]);
871  z[ 8] = w2; w2 = 0;
872 
873  word3_muladd(&w2, &w1, &w0, x[ 0], y[ 9]);
874  word3_muladd(&w2, &w1, &w0, x[ 1], y[ 8]);
875  word3_muladd(&w2, &w1, &w0, x[ 2], y[ 7]);
876  word3_muladd(&w2, &w1, &w0, x[ 3], y[ 6]);
877  word3_muladd(&w2, &w1, &w0, x[ 4], y[ 5]);
878  word3_muladd(&w2, &w1, &w0, x[ 5], y[ 4]);
879  word3_muladd(&w2, &w1, &w0, x[ 6], y[ 3]);
880  word3_muladd(&w2, &w1, &w0, x[ 7], y[ 2]);
881  word3_muladd(&w2, &w1, &w0, x[ 8], y[ 1]);
882  word3_muladd(&w2, &w1, &w0, x[ 9], y[ 0]);
883  z[ 9] = w0; w0 = 0;
884 
885  word3_muladd(&w0, &w2, &w1, x[ 0], y[10]);
886  word3_muladd(&w0, &w2, &w1, x[ 1], y[ 9]);
887  word3_muladd(&w0, &w2, &w1, x[ 2], y[ 8]);
888  word3_muladd(&w0, &w2, &w1, x[ 3], y[ 7]);
889  word3_muladd(&w0, &w2, &w1, x[ 4], y[ 6]);
890  word3_muladd(&w0, &w2, &w1, x[ 5], y[ 5]);
891  word3_muladd(&w0, &w2, &w1, x[ 6], y[ 4]);
892  word3_muladd(&w0, &w2, &w1, x[ 7], y[ 3]);
893  word3_muladd(&w0, &w2, &w1, x[ 8], y[ 2]);
894  word3_muladd(&w0, &w2, &w1, x[ 9], y[ 1]);
895  word3_muladd(&w0, &w2, &w1, x[10], y[ 0]);
896  z[10] = w1; w1 = 0;
897 
898  word3_muladd(&w1, &w0, &w2, x[ 0], y[11]);
899  word3_muladd(&w1, &w0, &w2, x[ 1], y[10]);
900  word3_muladd(&w1, &w0, &w2, x[ 2], y[ 9]);
901  word3_muladd(&w1, &w0, &w2, x[ 3], y[ 8]);
902  word3_muladd(&w1, &w0, &w2, x[ 4], y[ 7]);
903  word3_muladd(&w1, &w0, &w2, x[ 5], y[ 6]);
904  word3_muladd(&w1, &w0, &w2, x[ 6], y[ 5]);
905  word3_muladd(&w1, &w0, &w2, x[ 7], y[ 4]);
906  word3_muladd(&w1, &w0, &w2, x[ 8], y[ 3]);
907  word3_muladd(&w1, &w0, &w2, x[ 9], y[ 2]);
908  word3_muladd(&w1, &w0, &w2, x[10], y[ 1]);
909  word3_muladd(&w1, &w0, &w2, x[11], y[ 0]);
910  z[11] = w2; w2 = 0;
911 
912  word3_muladd(&w2, &w1, &w0, x[ 0], y[12]);
913  word3_muladd(&w2, &w1, &w0, x[ 1], y[11]);
914  word3_muladd(&w2, &w1, &w0, x[ 2], y[10]);
915  word3_muladd(&w2, &w1, &w0, x[ 3], y[ 9]);
916  word3_muladd(&w2, &w1, &w0, x[ 4], y[ 8]);
917  word3_muladd(&w2, &w1, &w0, x[ 5], y[ 7]);
918  word3_muladd(&w2, &w1, &w0, x[ 6], y[ 6]);
919  word3_muladd(&w2, &w1, &w0, x[ 7], y[ 5]);
920  word3_muladd(&w2, &w1, &w0, x[ 8], y[ 4]);
921  word3_muladd(&w2, &w1, &w0, x[ 9], y[ 3]);
922  word3_muladd(&w2, &w1, &w0, x[10], y[ 2]);
923  word3_muladd(&w2, &w1, &w0, x[11], y[ 1]);
924  word3_muladd(&w2, &w1, &w0, x[12], y[ 0]);
925  z[12] = w0; w0 = 0;
926 
927  word3_muladd(&w0, &w2, &w1, x[ 0], y[13]);
928  word3_muladd(&w0, &w2, &w1, x[ 1], y[12]);
929  word3_muladd(&w0, &w2, &w1, x[ 2], y[11]);
930  word3_muladd(&w0, &w2, &w1, x[ 3], y[10]);
931  word3_muladd(&w0, &w2, &w1, x[ 4], y[ 9]);
932  word3_muladd(&w0, &w2, &w1, x[ 5], y[ 8]);
933  word3_muladd(&w0, &w2, &w1, x[ 6], y[ 7]);
934  word3_muladd(&w0, &w2, &w1, x[ 7], y[ 6]);
935  word3_muladd(&w0, &w2, &w1, x[ 8], y[ 5]);
936  word3_muladd(&w0, &w2, &w1, x[ 9], y[ 4]);
937  word3_muladd(&w0, &w2, &w1, x[10], y[ 3]);
938  word3_muladd(&w0, &w2, &w1, x[11], y[ 2]);
939  word3_muladd(&w0, &w2, &w1, x[12], y[ 1]);
940  word3_muladd(&w0, &w2, &w1, x[13], y[ 0]);
941  z[13] = w1; w1 = 0;
942 
943  word3_muladd(&w1, &w0, &w2, x[ 0], y[14]);
944  word3_muladd(&w1, &w0, &w2, x[ 1], y[13]);
945  word3_muladd(&w1, &w0, &w2, x[ 2], y[12]);
946  word3_muladd(&w1, &w0, &w2, x[ 3], y[11]);
947  word3_muladd(&w1, &w0, &w2, x[ 4], y[10]);
948  word3_muladd(&w1, &w0, &w2, x[ 5], y[ 9]);
949  word3_muladd(&w1, &w0, &w2, x[ 6], y[ 8]);
950  word3_muladd(&w1, &w0, &w2, x[ 7], y[ 7]);
951  word3_muladd(&w1, &w0, &w2, x[ 8], y[ 6]);
952  word3_muladd(&w1, &w0, &w2, x[ 9], y[ 5]);
953  word3_muladd(&w1, &w0, &w2, x[10], y[ 4]);
954  word3_muladd(&w1, &w0, &w2, x[11], y[ 3]);
955  word3_muladd(&w1, &w0, &w2, x[12], y[ 2]);
956  word3_muladd(&w1, &w0, &w2, x[13], y[ 1]);
957  word3_muladd(&w1, &w0, &w2, x[14], y[ 0]);
958  z[14] = w2; w2 = 0;
959 
960  word3_muladd(&w2, &w1, &w0, x[ 0], y[15]);
961  word3_muladd(&w2, &w1, &w0, x[ 1], y[14]);
962  word3_muladd(&w2, &w1, &w0, x[ 2], y[13]);
963  word3_muladd(&w2, &w1, &w0, x[ 3], y[12]);
964  word3_muladd(&w2, &w1, &w0, x[ 4], y[11]);
965  word3_muladd(&w2, &w1, &w0, x[ 5], y[10]);
966  word3_muladd(&w2, &w1, &w0, x[ 6], y[ 9]);
967  word3_muladd(&w2, &w1, &w0, x[ 7], y[ 8]);
968  word3_muladd(&w2, &w1, &w0, x[ 8], y[ 7]);
969  word3_muladd(&w2, &w1, &w0, x[ 9], y[ 6]);
970  word3_muladd(&w2, &w1, &w0, x[10], y[ 5]);
971  word3_muladd(&w2, &w1, &w0, x[11], y[ 4]);
972  word3_muladd(&w2, &w1, &w0, x[12], y[ 3]);
973  word3_muladd(&w2, &w1, &w0, x[13], y[ 2]);
974  word3_muladd(&w2, &w1, &w0, x[14], y[ 1]);
975  word3_muladd(&w2, &w1, &w0, x[15], y[ 0]);
976  z[15] = w0; w0 = 0;
977 
978  word3_muladd(&w0, &w2, &w1, x[ 1], y[15]);
979  word3_muladd(&w0, &w2, &w1, x[ 2], y[14]);
980  word3_muladd(&w0, &w2, &w1, x[ 3], y[13]);
981  word3_muladd(&w0, &w2, &w1, x[ 4], y[12]);
982  word3_muladd(&w0, &w2, &w1, x[ 5], y[11]);
983  word3_muladd(&w0, &w2, &w1, x[ 6], y[10]);
984  word3_muladd(&w0, &w2, &w1, x[ 7], y[ 9]);
985  word3_muladd(&w0, &w2, &w1, x[ 8], y[ 8]);
986  word3_muladd(&w0, &w2, &w1, x[ 9], y[ 7]);
987  word3_muladd(&w0, &w2, &w1, x[10], y[ 6]);
988  word3_muladd(&w0, &w2, &w1, x[11], y[ 5]);
989  word3_muladd(&w0, &w2, &w1, x[12], y[ 4]);
990  word3_muladd(&w0, &w2, &w1, x[13], y[ 3]);
991  word3_muladd(&w0, &w2, &w1, x[14], y[ 2]);
992  word3_muladd(&w0, &w2, &w1, x[15], y[ 1]);
993  z[16] = w1; w1 = 0;
994 
995  word3_muladd(&w1, &w0, &w2, x[ 2], y[15]);
996  word3_muladd(&w1, &w0, &w2, x[ 3], y[14]);
997  word3_muladd(&w1, &w0, &w2, x[ 4], y[13]);
998  word3_muladd(&w1, &w0, &w2, x[ 5], y[12]);
999  word3_muladd(&w1, &w0, &w2, x[ 6], y[11]);
1000  word3_muladd(&w1, &w0, &w2, x[ 7], y[10]);
1001  word3_muladd(&w1, &w0, &w2, x[ 8], y[ 9]);
1002  word3_muladd(&w1, &w0, &w2, x[ 9], y[ 8]);
1003  word3_muladd(&w1, &w0, &w2, x[10], y[ 7]);
1004  word3_muladd(&w1, &w0, &w2, x[11], y[ 6]);
1005  word3_muladd(&w1, &w0, &w2, x[12], y[ 5]);
1006  word3_muladd(&w1, &w0, &w2, x[13], y[ 4]);
1007  word3_muladd(&w1, &w0, &w2, x[14], y[ 3]);
1008  word3_muladd(&w1, &w0, &w2, x[15], y[ 2]);
1009  z[17] = w2; w2 = 0;
1010 
1011  word3_muladd(&w2, &w1, &w0, x[ 3], y[15]);
1012  word3_muladd(&w2, &w1, &w0, x[ 4], y[14]);
1013  word3_muladd(&w2, &w1, &w0, x[ 5], y[13]);
1014  word3_muladd(&w2, &w1, &w0, x[ 6], y[12]);
1015  word3_muladd(&w2, &w1, &w0, x[ 7], y[11]);
1016  word3_muladd(&w2, &w1, &w0, x[ 8], y[10]);
1017  word3_muladd(&w2, &w1, &w0, x[ 9], y[ 9]);
1018  word3_muladd(&w2, &w1, &w0, x[10], y[ 8]);
1019  word3_muladd(&w2, &w1, &w0, x[11], y[ 7]);
1020  word3_muladd(&w2, &w1, &w0, x[12], y[ 6]);
1021  word3_muladd(&w2, &w1, &w0, x[13], y[ 5]);
1022  word3_muladd(&w2, &w1, &w0, x[14], y[ 4]);
1023  word3_muladd(&w2, &w1, &w0, x[15], y[ 3]);
1024  z[18] = w0; w0 = 0;
1025 
1026  word3_muladd(&w0, &w2, &w1, x[ 4], y[15]);
1027  word3_muladd(&w0, &w2, &w1, x[ 5], y[14]);
1028  word3_muladd(&w0, &w2, &w1, x[ 6], y[13]);
1029  word3_muladd(&w0, &w2, &w1, x[ 7], y[12]);
1030  word3_muladd(&w0, &w2, &w1, x[ 8], y[11]);
1031  word3_muladd(&w0, &w2, &w1, x[ 9], y[10]);
1032  word3_muladd(&w0, &w2, &w1, x[10], y[ 9]);
1033  word3_muladd(&w0, &w2, &w1, x[11], y[ 8]);
1034  word3_muladd(&w0, &w2, &w1, x[12], y[ 7]);
1035  word3_muladd(&w0, &w2, &w1, x[13], y[ 6]);
1036  word3_muladd(&w0, &w2, &w1, x[14], y[ 5]);
1037  word3_muladd(&w0, &w2, &w1, x[15], y[ 4]);
1038  z[19] = w1; w1 = 0;
1039 
1040  word3_muladd(&w1, &w0, &w2, x[ 5], y[15]);
1041  word3_muladd(&w1, &w0, &w2, x[ 6], y[14]);
1042  word3_muladd(&w1, &w0, &w2, x[ 7], y[13]);
1043  word3_muladd(&w1, &w0, &w2, x[ 8], y[12]);
1044  word3_muladd(&w1, &w0, &w2, x[ 9], y[11]);
1045  word3_muladd(&w1, &w0, &w2, x[10], y[10]);
1046  word3_muladd(&w1, &w0, &w2, x[11], y[ 9]);
1047  word3_muladd(&w1, &w0, &w2, x[12], y[ 8]);
1048  word3_muladd(&w1, &w0, &w2, x[13], y[ 7]);
1049  word3_muladd(&w1, &w0, &w2, x[14], y[ 6]);
1050  word3_muladd(&w1, &w0, &w2, x[15], y[ 5]);
1051  z[20] = w2; w2 = 0;
1052 
1053  word3_muladd(&w2, &w1, &w0, x[ 6], y[15]);
1054  word3_muladd(&w2, &w1, &w0, x[ 7], y[14]);
1055  word3_muladd(&w2, &w1, &w0, x[ 8], y[13]);
1056  word3_muladd(&w2, &w1, &w0, x[ 9], y[12]);
1057  word3_muladd(&w2, &w1, &w0, x[10], y[11]);
1058  word3_muladd(&w2, &w1, &w0, x[11], y[10]);
1059  word3_muladd(&w2, &w1, &w0, x[12], y[ 9]);
1060  word3_muladd(&w2, &w1, &w0, x[13], y[ 8]);
1061  word3_muladd(&w2, &w1, &w0, x[14], y[ 7]);
1062  word3_muladd(&w2, &w1, &w0, x[15], y[ 6]);
1063  z[21] = w0; w0 = 0;
1064 
1065  word3_muladd(&w0, &w2, &w1, x[ 7], y[15]);
1066  word3_muladd(&w0, &w2, &w1, x[ 8], y[14]);
1067  word3_muladd(&w0, &w2, &w1, x[ 9], y[13]);
1068  word3_muladd(&w0, &w2, &w1, x[10], y[12]);
1069  word3_muladd(&w0, &w2, &w1, x[11], y[11]);
1070  word3_muladd(&w0, &w2, &w1, x[12], y[10]);
1071  word3_muladd(&w0, &w2, &w1, x[13], y[ 9]);
1072  word3_muladd(&w0, &w2, &w1, x[14], y[ 8]);
1073  word3_muladd(&w0, &w2, &w1, x[15], y[ 7]);
1074  z[22] = w1; w1 = 0;
1075 
1076  word3_muladd(&w1, &w0, &w2, x[ 8], y[15]);
1077  word3_muladd(&w1, &w0, &w2, x[ 9], y[14]);
1078  word3_muladd(&w1, &w0, &w2, x[10], y[13]);
1079  word3_muladd(&w1, &w0, &w2, x[11], y[12]);
1080  word3_muladd(&w1, &w0, &w2, x[12], y[11]);
1081  word3_muladd(&w1, &w0, &w2, x[13], y[10]);
1082  word3_muladd(&w1, &w0, &w2, x[14], y[ 9]);
1083  word3_muladd(&w1, &w0, &w2, x[15], y[ 8]);
1084  z[23] = w2; w2 = 0;
1085 
1086  word3_muladd(&w2, &w1, &w0, x[ 9], y[15]);
1087  word3_muladd(&w2, &w1, &w0, x[10], y[14]);
1088  word3_muladd(&w2, &w1, &w0, x[11], y[13]);
1089  word3_muladd(&w2, &w1, &w0, x[12], y[12]);
1090  word3_muladd(&w2, &w1, &w0, x[13], y[11]);
1091  word3_muladd(&w2, &w1, &w0, x[14], y[10]);
1092  word3_muladd(&w2, &w1, &w0, x[15], y[ 9]);
1093  z[24] = w0; w0 = 0;
1094 
1095  word3_muladd(&w0, &w2, &w1, x[10], y[15]);
1096  word3_muladd(&w0, &w2, &w1, x[11], y[14]);
1097  word3_muladd(&w0, &w2, &w1, x[12], y[13]);
1098  word3_muladd(&w0, &w2, &w1, x[13], y[12]);
1099  word3_muladd(&w0, &w2, &w1, x[14], y[11]);
1100  word3_muladd(&w0, &w2, &w1, x[15], y[10]);
1101  z[25] = w1; w1 = 0;
1102 
1103  word3_muladd(&w1, &w0, &w2, x[11], y[15]);
1104  word3_muladd(&w1, &w0, &w2, x[12], y[14]);
1105  word3_muladd(&w1, &w0, &w2, x[13], y[13]);
1106  word3_muladd(&w1, &w0, &w2, x[14], y[12]);
1107  word3_muladd(&w1, &w0, &w2, x[15], y[11]);
1108  z[26] = w2; w2 = 0;
1109 
1110  word3_muladd(&w2, &w1, &w0, x[12], y[15]);
1111  word3_muladd(&w2, &w1, &w0, x[13], y[14]);
1112  word3_muladd(&w2, &w1, &w0, x[14], y[13]);
1113  word3_muladd(&w2, &w1, &w0, x[15], y[12]);
1114  z[27] = w0; w0 = 0;
1115 
1116  word3_muladd(&w0, &w2, &w1, x[13], y[15]);
1117  word3_muladd(&w0, &w2, &w1, x[14], y[14]);
1118  word3_muladd(&w0, &w2, &w1, x[15], y[13]);
1119  z[28] = w1; w1 = 0;
1120 
1121  word3_muladd(&w1, &w0, &w2, x[14], y[15]);
1122  word3_muladd(&w1, &w0, &w2, x[15], y[14]);
1123  z[29] = w2; w2 = 0;
1124 
1125  word3_muladd(&w2, &w1, &w0, x[15], y[15]);
1126  z[30] = w0;
1127  z[31] = w1;
1128  }
const BigInt & x
Definition: dsa.cpp:98
const BigInt & y
Definition: dsa.cpp:159
void word3_muladd(word *w2, word *w1, word *w0, word a, word b)
Definition: mp_asmi.h:175
void Botan::bigint_comba_mul4 ( word  z[8],
const word  x[4],
const word  y[4] 
)

Definition at line 51 of file mp_comba.cpp.

References word3_muladd().

Referenced by bigint_mul().

52  {
53  word w2 = 0, w1 = 0, w0 = 0;
54 
55  word3_muladd(&w2, &w1, &w0, x[ 0], y[ 0]);
56  z[ 0] = w0; w0 = 0;
57 
58  word3_muladd(&w0, &w2, &w1, x[ 0], y[ 1]);
59  word3_muladd(&w0, &w2, &w1, x[ 1], y[ 0]);
60  z[ 1] = w1; w1 = 0;
61 
62  word3_muladd(&w1, &w0, &w2, x[ 0], y[ 2]);
63  word3_muladd(&w1, &w0, &w2, x[ 1], y[ 1]);
64  word3_muladd(&w1, &w0, &w2, x[ 2], y[ 0]);
65  z[ 2] = w2; w2 = 0;
66 
67  word3_muladd(&w2, &w1, &w0, x[ 0], y[ 3]);
68  word3_muladd(&w2, &w1, &w0, x[ 1], y[ 2]);
69  word3_muladd(&w2, &w1, &w0, x[ 2], y[ 1]);
70  word3_muladd(&w2, &w1, &w0, x[ 3], y[ 0]);
71  z[ 3] = w0; w0 = 0;
72 
73  word3_muladd(&w0, &w2, &w1, x[ 1], y[ 3]);
74  word3_muladd(&w0, &w2, &w1, x[ 2], y[ 2]);
75  word3_muladd(&w0, &w2, &w1, x[ 3], y[ 1]);
76  z[ 4] = w1; w1 = 0;
77 
78  word3_muladd(&w1, &w0, &w2, x[ 2], y[ 3]);
79  word3_muladd(&w1, &w0, &w2, x[ 3], y[ 2]);
80  z[ 5] = w2; w2 = 0;
81 
82  word3_muladd(&w2, &w1, &w0, x[ 3], y[ 3]);
83  z[ 6] = w0;
84  z[ 7] = w1;
85  }
const BigInt & x
Definition: dsa.cpp:98
const BigInt & y
Definition: dsa.cpp:159
void word3_muladd(word *w2, word *w1, word *w0, word a, word b)
Definition: mp_asmi.h:175
void Botan::bigint_comba_mul6 ( word  z[12],
const word  x[6],
const word  y[6] 
)

Definition at line 142 of file mp_comba.cpp.

References word3_muladd().

Referenced by bigint_mul().

143  {
144  word w2 = 0, w1 = 0, w0 = 0;
145 
146  word3_muladd(&w2, &w1, &w0, x[ 0], y[ 0]);
147  z[ 0] = w0; w0 = 0;
148 
149  word3_muladd(&w0, &w2, &w1, x[ 0], y[ 1]);
150  word3_muladd(&w0, &w2, &w1, x[ 1], y[ 0]);
151  z[ 1] = w1; w1 = 0;
152 
153  word3_muladd(&w1, &w0, &w2, x[ 0], y[ 2]);
154  word3_muladd(&w1, &w0, &w2, x[ 1], y[ 1]);
155  word3_muladd(&w1, &w0, &w2, x[ 2], y[ 0]);
156  z[ 2] = w2; w2 = 0;
157 
158  word3_muladd(&w2, &w1, &w0, x[ 0], y[ 3]);
159  word3_muladd(&w2, &w1, &w0, x[ 1], y[ 2]);
160  word3_muladd(&w2, &w1, &w0, x[ 2], y[ 1]);
161  word3_muladd(&w2, &w1, &w0, x[ 3], y[ 0]);
162  z[ 3] = w0; w0 = 0;
163 
164  word3_muladd(&w0, &w2, &w1, x[ 0], y[ 4]);
165  word3_muladd(&w0, &w2, &w1, x[ 1], y[ 3]);
166  word3_muladd(&w0, &w2, &w1, x[ 2], y[ 2]);
167  word3_muladd(&w0, &w2, &w1, x[ 3], y[ 1]);
168  word3_muladd(&w0, &w2, &w1, x[ 4], y[ 0]);
169  z[ 4] = w1; w1 = 0;
170 
171  word3_muladd(&w1, &w0, &w2, x[ 0], y[ 5]);
172  word3_muladd(&w1, &w0, &w2, x[ 1], y[ 4]);
173  word3_muladd(&w1, &w0, &w2, x[ 2], y[ 3]);
174  word3_muladd(&w1, &w0, &w2, x[ 3], y[ 2]);
175  word3_muladd(&w1, &w0, &w2, x[ 4], y[ 1]);
176  word3_muladd(&w1, &w0, &w2, x[ 5], y[ 0]);
177  z[ 5] = w2; w2 = 0;
178 
179  word3_muladd(&w2, &w1, &w0, x[ 1], y[ 5]);
180  word3_muladd(&w2, &w1, &w0, x[ 2], y[ 4]);
181  word3_muladd(&w2, &w1, &w0, x[ 3], y[ 3]);
182  word3_muladd(&w2, &w1, &w0, x[ 4], y[ 2]);
183  word3_muladd(&w2, &w1, &w0, x[ 5], y[ 1]);
184  z[ 6] = w0; w0 = 0;
185 
186  word3_muladd(&w0, &w2, &w1, x[ 2], y[ 5]);
187  word3_muladd(&w0, &w2, &w1, x[ 3], y[ 4]);
188  word3_muladd(&w0, &w2, &w1, x[ 4], y[ 3]);
189  word3_muladd(&w0, &w2, &w1, x[ 5], y[ 2]);
190  z[ 7] = w1; w1 = 0;
191 
192  word3_muladd(&w1, &w0, &w2, x[ 3], y[ 5]);
193  word3_muladd(&w1, &w0, &w2, x[ 4], y[ 4]);
194  word3_muladd(&w1, &w0, &w2, x[ 5], y[ 3]);
195  z[ 8] = w2; w2 = 0;
196 
197  word3_muladd(&w2, &w1, &w0, x[ 4], y[ 5]);
198  word3_muladd(&w2, &w1, &w0, x[ 5], y[ 4]);
199  z[ 9] = w0; w0 = 0;
200 
201  word3_muladd(&w0, &w2, &w1, x[ 5], y[ 5]);
202  z[10] = w1;
203  z[11] = w2;
204  }
const BigInt & x
Definition: dsa.cpp:98
const BigInt & y
Definition: dsa.cpp:159
void word3_muladd(word *w2, word *w1, word *w0, word a, word b)
Definition: mp_asmi.h:175
void Botan::bigint_comba_mul8 ( word  z[16],
const word  x[8],
const word  y[8] 
)

Definition at line 284 of file mp_comba.cpp.

References word3_muladd().

Referenced by bigint_mul().

285  {
286  word w2 = 0, w1 = 0, w0 = 0;
287 
288  word3_muladd(&w2, &w1, &w0, x[ 0], y[ 0]);
289  z[ 0] = w0; w0 = 0;
290 
291  word3_muladd(&w0, &w2, &w1, x[ 0], y[ 1]);
292  word3_muladd(&w0, &w2, &w1, x[ 1], y[ 0]);
293  z[ 1] = w1; w1 = 0;
294 
295  word3_muladd(&w1, &w0, &w2, x[ 0], y[ 2]);
296  word3_muladd(&w1, &w0, &w2, x[ 1], y[ 1]);
297  word3_muladd(&w1, &w0, &w2, x[ 2], y[ 0]);
298  z[ 2] = w2; w2 = 0;
299 
300  word3_muladd(&w2, &w1, &w0, x[ 0], y[ 3]);
301  word3_muladd(&w2, &w1, &w0, x[ 1], y[ 2]);
302  word3_muladd(&w2, &w1, &w0, x[ 2], y[ 1]);
303  word3_muladd(&w2, &w1, &w0, x[ 3], y[ 0]);
304  z[ 3] = w0; w0 = 0;
305 
306  word3_muladd(&w0, &w2, &w1, x[ 0], y[ 4]);
307  word3_muladd(&w0, &w2, &w1, x[ 1], y[ 3]);
308  word3_muladd(&w0, &w2, &w1, x[ 2], y[ 2]);
309  word3_muladd(&w0, &w2, &w1, x[ 3], y[ 1]);
310  word3_muladd(&w0, &w2, &w1, x[ 4], y[ 0]);
311  z[ 4] = w1; w1 = 0;
312 
313  word3_muladd(&w1, &w0, &w2, x[ 0], y[ 5]);
314  word3_muladd(&w1, &w0, &w2, x[ 1], y[ 4]);
315  word3_muladd(&w1, &w0, &w2, x[ 2], y[ 3]);
316  word3_muladd(&w1, &w0, &w2, x[ 3], y[ 2]);
317  word3_muladd(&w1, &w0, &w2, x[ 4], y[ 1]);
318  word3_muladd(&w1, &w0, &w2, x[ 5], y[ 0]);
319  z[ 5] = w2; w2 = 0;
320 
321  word3_muladd(&w2, &w1, &w0, x[ 0], y[ 6]);
322  word3_muladd(&w2, &w1, &w0, x[ 1], y[ 5]);
323  word3_muladd(&w2, &w1, &w0, x[ 2], y[ 4]);
324  word3_muladd(&w2, &w1, &w0, x[ 3], y[ 3]);
325  word3_muladd(&w2, &w1, &w0, x[ 4], y[ 2]);
326  word3_muladd(&w2, &w1, &w0, x[ 5], y[ 1]);
327  word3_muladd(&w2, &w1, &w0, x[ 6], y[ 0]);
328  z[ 6] = w0; w0 = 0;
329 
330  word3_muladd(&w0, &w2, &w1, x[ 0], y[ 7]);
331  word3_muladd(&w0, &w2, &w1, x[ 1], y[ 6]);
332  word3_muladd(&w0, &w2, &w1, x[ 2], y[ 5]);
333  word3_muladd(&w0, &w2, &w1, x[ 3], y[ 4]);
334  word3_muladd(&w0, &w2, &w1, x[ 4], y[ 3]);
335  word3_muladd(&w0, &w2, &w1, x[ 5], y[ 2]);
336  word3_muladd(&w0, &w2, &w1, x[ 6], y[ 1]);
337  word3_muladd(&w0, &w2, &w1, x[ 7], y[ 0]);
338  z[ 7] = w1; w1 = 0;
339 
340  word3_muladd(&w1, &w0, &w2, x[ 1], y[ 7]);
341  word3_muladd(&w1, &w0, &w2, x[ 2], y[ 6]);
342  word3_muladd(&w1, &w0, &w2, x[ 3], y[ 5]);
343  word3_muladd(&w1, &w0, &w2, x[ 4], y[ 4]);
344  word3_muladd(&w1, &w0, &w2, x[ 5], y[ 3]);
345  word3_muladd(&w1, &w0, &w2, x[ 6], y[ 2]);
346  word3_muladd(&w1, &w0, &w2, x[ 7], y[ 1]);
347  z[ 8] = w2; w2 = 0;
348 
349  word3_muladd(&w2, &w1, &w0, x[ 2], y[ 7]);
350  word3_muladd(&w2, &w1, &w0, x[ 3], y[ 6]);
351  word3_muladd(&w2, &w1, &w0, x[ 4], y[ 5]);
352  word3_muladd(&w2, &w1, &w0, x[ 5], y[ 4]);
353  word3_muladd(&w2, &w1, &w0, x[ 6], y[ 3]);
354  word3_muladd(&w2, &w1, &w0, x[ 7], y[ 2]);
355  z[ 9] = w0; w0 = 0;
356 
357  word3_muladd(&w0, &w2, &w1, x[ 3], y[ 7]);
358  word3_muladd(&w0, &w2, &w1, x[ 4], y[ 6]);
359  word3_muladd(&w0, &w2, &w1, x[ 5], y[ 5]);
360  word3_muladd(&w0, &w2, &w1, x[ 6], y[ 4]);
361  word3_muladd(&w0, &w2, &w1, x[ 7], y[ 3]);
362  z[10] = w1; w1 = 0;
363 
364  word3_muladd(&w1, &w0, &w2, x[ 4], y[ 7]);
365  word3_muladd(&w1, &w0, &w2, x[ 5], y[ 6]);
366  word3_muladd(&w1, &w0, &w2, x[ 6], y[ 5]);
367  word3_muladd(&w1, &w0, &w2, x[ 7], y[ 4]);
368  z[11] = w2; w2 = 0;
369 
370  word3_muladd(&w2, &w1, &w0, x[ 5], y[ 7]);
371  word3_muladd(&w2, &w1, &w0, x[ 6], y[ 6]);
372  word3_muladd(&w2, &w1, &w0, x[ 7], y[ 5]);
373  z[12] = w0; w0 = 0;
374 
375  word3_muladd(&w0, &w2, &w1, x[ 6], y[ 7]);
376  word3_muladd(&w0, &w2, &w1, x[ 7], y[ 6]);
377  z[13] = w1; w1 = 0;
378 
379  word3_muladd(&w1, &w0, &w2, x[ 7], y[ 7]);
380  z[14] = w2;
381  z[15] = w0;
382  }
const BigInt & x
Definition: dsa.cpp:98
const BigInt & y
Definition: dsa.cpp:159
void word3_muladd(word *w2, word *w1, word *w0, word a, word b)
Definition: mp_asmi.h:175
void Botan::bigint_comba_mul9 ( word  z[18],
const word  x[9],
const word  y[9] 
)

Definition at line 475 of file mp_comba.cpp.

References word3_muladd().

Referenced by bigint_mul().

476  {
477  word w2 = 0, w1 = 0, w0 = 0;
478 
479  word3_muladd(&w2, &w1, &w0, x[ 0], y[ 0]);
480  z[ 0] = w0; w0 = 0;
481 
482  word3_muladd(&w0, &w2, &w1, x[ 0], y[ 1]);
483  word3_muladd(&w0, &w2, &w1, x[ 1], y[ 0]);
484  z[ 1] = w1; w1 = 0;
485 
486  word3_muladd(&w1, &w0, &w2, x[ 0], y[ 2]);
487  word3_muladd(&w1, &w0, &w2, x[ 1], y[ 1]);
488  word3_muladd(&w1, &w0, &w2, x[ 2], y[ 0]);
489  z[ 2] = w2; w2 = 0;
490 
491  word3_muladd(&w2, &w1, &w0, x[ 0], y[ 3]);
492  word3_muladd(&w2, &w1, &w0, x[ 1], y[ 2]);
493  word3_muladd(&w2, &w1, &w0, x[ 2], y[ 1]);
494  word3_muladd(&w2, &w1, &w0, x[ 3], y[ 0]);
495  z[ 3] = w0; w0 = 0;
496 
497  word3_muladd(&w0, &w2, &w1, x[ 0], y[ 4]);
498  word3_muladd(&w0, &w2, &w1, x[ 1], y[ 3]);
499  word3_muladd(&w0, &w2, &w1, x[ 2], y[ 2]);
500  word3_muladd(&w0, &w2, &w1, x[ 3], y[ 1]);
501  word3_muladd(&w0, &w2, &w1, x[ 4], y[ 0]);
502  z[ 4] = w1; w1 = 0;
503 
504  word3_muladd(&w1, &w0, &w2, x[ 0], y[ 5]);
505  word3_muladd(&w1, &w0, &w2, x[ 1], y[ 4]);
506  word3_muladd(&w1, &w0, &w2, x[ 2], y[ 3]);
507  word3_muladd(&w1, &w0, &w2, x[ 3], y[ 2]);
508  word3_muladd(&w1, &w0, &w2, x[ 4], y[ 1]);
509  word3_muladd(&w1, &w0, &w2, x[ 5], y[ 0]);
510  z[ 5] = w2; w2 = 0;
511 
512  word3_muladd(&w2, &w1, &w0, x[ 0], y[ 6]);
513  word3_muladd(&w2, &w1, &w0, x[ 1], y[ 5]);
514  word3_muladd(&w2, &w1, &w0, x[ 2], y[ 4]);
515  word3_muladd(&w2, &w1, &w0, x[ 3], y[ 3]);
516  word3_muladd(&w2, &w1, &w0, x[ 4], y[ 2]);
517  word3_muladd(&w2, &w1, &w0, x[ 5], y[ 1]);
518  word3_muladd(&w2, &w1, &w0, x[ 6], y[ 0]);
519  z[ 6] = w0; w0 = 0;
520 
521  word3_muladd(&w0, &w2, &w1, x[ 0], y[ 7]);
522  word3_muladd(&w0, &w2, &w1, x[ 1], y[ 6]);
523  word3_muladd(&w0, &w2, &w1, x[ 2], y[ 5]);
524  word3_muladd(&w0, &w2, &w1, x[ 3], y[ 4]);
525  word3_muladd(&w0, &w2, &w1, x[ 4], y[ 3]);
526  word3_muladd(&w0, &w2, &w1, x[ 5], y[ 2]);
527  word3_muladd(&w0, &w2, &w1, x[ 6], y[ 1]);
528  word3_muladd(&w0, &w2, &w1, x[ 7], y[ 0]);
529  z[ 7] = w1; w1 = 0;
530 
531  word3_muladd(&w1, &w0, &w2, x[ 0], y[ 8]);
532  word3_muladd(&w1, &w0, &w2, x[ 1], y[ 7]);
533  word3_muladd(&w1, &w0, &w2, x[ 2], y[ 6]);
534  word3_muladd(&w1, &w0, &w2, x[ 3], y[ 5]);
535  word3_muladd(&w1, &w0, &w2, x[ 4], y[ 4]);
536  word3_muladd(&w1, &w0, &w2, x[ 5], y[ 3]);
537  word3_muladd(&w1, &w0, &w2, x[ 6], y[ 2]);
538  word3_muladd(&w1, &w0, &w2, x[ 7], y[ 1]);
539  word3_muladd(&w1, &w0, &w2, x[ 8], y[ 0]);
540  z[ 8] = w2; w2 = 0;
541 
542  word3_muladd(&w2, &w1, &w0, x[ 1], y[ 8]);
543  word3_muladd(&w2, &w1, &w0, x[ 2], y[ 7]);
544  word3_muladd(&w2, &w1, &w0, x[ 3], y[ 6]);
545  word3_muladd(&w2, &w1, &w0, x[ 4], y[ 5]);
546  word3_muladd(&w2, &w1, &w0, x[ 5], y[ 4]);
547  word3_muladd(&w2, &w1, &w0, x[ 6], y[ 3]);
548  word3_muladd(&w2, &w1, &w0, x[ 7], y[ 2]);
549  word3_muladd(&w2, &w1, &w0, x[ 8], y[ 1]);
550  z[ 9] = w0; w0 = 0;
551 
552  word3_muladd(&w0, &w2, &w1, x[ 2], y[ 8]);
553  word3_muladd(&w0, &w2, &w1, x[ 3], y[ 7]);
554  word3_muladd(&w0, &w2, &w1, x[ 4], y[ 6]);
555  word3_muladd(&w0, &w2, &w1, x[ 5], y[ 5]);
556  word3_muladd(&w0, &w2, &w1, x[ 6], y[ 4]);
557  word3_muladd(&w0, &w2, &w1, x[ 7], y[ 3]);
558  word3_muladd(&w0, &w2, &w1, x[ 8], y[ 2]);
559  z[10] = w1; w1 = 0;
560 
561  word3_muladd(&w1, &w0, &w2, x[ 3], y[ 8]);
562  word3_muladd(&w1, &w0, &w2, x[ 4], y[ 7]);
563  word3_muladd(&w1, &w0, &w2, x[ 5], y[ 6]);
564  word3_muladd(&w1, &w0, &w2, x[ 6], y[ 5]);
565  word3_muladd(&w1, &w0, &w2, x[ 7], y[ 4]);
566  word3_muladd(&w1, &w0, &w2, x[ 8], y[ 3]);
567  z[11] = w2; w2 = 0;
568 
569  word3_muladd(&w2, &w1, &w0, x[ 4], y[ 8]);
570  word3_muladd(&w2, &w1, &w0, x[ 5], y[ 7]);
571  word3_muladd(&w2, &w1, &w0, x[ 6], y[ 6]);
572  word3_muladd(&w2, &w1, &w0, x[ 7], y[ 5]);
573  word3_muladd(&w2, &w1, &w0, x[ 8], y[ 4]);
574  z[12] = w0; w0 = 0;
575 
576  word3_muladd(&w0, &w2, &w1, x[ 5], y[ 8]);
577  word3_muladd(&w0, &w2, &w1, x[ 6], y[ 7]);
578  word3_muladd(&w0, &w2, &w1, x[ 7], y[ 6]);
579  word3_muladd(&w0, &w2, &w1, x[ 8], y[ 5]);
580  z[13] = w1; w1 = 0;
581 
582  word3_muladd(&w1, &w0, &w2, x[ 6], y[ 8]);
583  word3_muladd(&w1, &w0, &w2, x[ 7], y[ 7]);
584  word3_muladd(&w1, &w0, &w2, x[ 8], y[ 6]);
585  z[14] = w2; w2 = 0;
586 
587  word3_muladd(&w2, &w1, &w0, x[ 7], y[ 8]);
588  word3_muladd(&w2, &w1, &w0, x[ 8], y[ 7]);
589  z[15] = w0; w0 = 0;
590 
591  word3_muladd(&w0, &w2, &w1, x[ 8], y[ 8]);
592  z[16] = w1;
593  z[17] = w2;
594  }
const BigInt & x
Definition: dsa.cpp:98
const BigInt & y
Definition: dsa.cpp:159
void word3_muladd(word *w2, word *w1, word *w0, word a, word b)
Definition: mp_asmi.h:175
void Botan::bigint_comba_sqr16 ( word  z[32],
const word  x[16] 
)

Definition at line 599 of file mp_comba.cpp.

References word3_muladd(), and word3_muladd_2().

Referenced by bigint_sqr().

600  {
601  word w2 = 0, w1 = 0, w0 = 0;
602 
603  word3_muladd(&w2, &w1, &w0, x[ 0], x[ 0]);
604  z[ 0] = w0; w0 = 0;
605 
606  word3_muladd_2(&w0, &w2, &w1, x[ 0], x[ 1]);
607  z[ 1] = w1; w1 = 0;
608 
609  word3_muladd_2(&w1, &w0, &w2, x[ 0], x[ 2]);
610  word3_muladd(&w1, &w0, &w2, x[ 1], x[ 1]);
611  z[ 2] = w2; w2 = 0;
612 
613  word3_muladd_2(&w2, &w1, &w0, x[ 0], x[ 3]);
614  word3_muladd_2(&w2, &w1, &w0, x[ 1], x[ 2]);
615  z[ 3] = w0; w0 = 0;
616 
617  word3_muladd_2(&w0, &w2, &w1, x[ 0], x[ 4]);
618  word3_muladd_2(&w0, &w2, &w1, x[ 1], x[ 3]);
619  word3_muladd(&w0, &w2, &w1, x[ 2], x[ 2]);
620  z[ 4] = w1; w1 = 0;
621 
622  word3_muladd_2(&w1, &w0, &w2, x[ 0], x[ 5]);
623  word3_muladd_2(&w1, &w0, &w2, x[ 1], x[ 4]);
624  word3_muladd_2(&w1, &w0, &w2, x[ 2], x[ 3]);
625  z[ 5] = w2; w2 = 0;
626 
627  word3_muladd_2(&w2, &w1, &w0, x[ 0], x[ 6]);
628  word3_muladd_2(&w2, &w1, &w0, x[ 1], x[ 5]);
629  word3_muladd_2(&w2, &w1, &w0, x[ 2], x[ 4]);
630  word3_muladd(&w2, &w1, &w0, x[ 3], x[ 3]);
631  z[ 6] = w0; w0 = 0;
632 
633  word3_muladd_2(&w0, &w2, &w1, x[ 0], x[ 7]);
634  word3_muladd_2(&w0, &w2, &w1, x[ 1], x[ 6]);
635  word3_muladd_2(&w0, &w2, &w1, x[ 2], x[ 5]);
636  word3_muladd_2(&w0, &w2, &w1, x[ 3], x[ 4]);
637  z[ 7] = w1; w1 = 0;
638 
639  word3_muladd_2(&w1, &w0, &w2, x[ 0], x[ 8]);
640  word3_muladd_2(&w1, &w0, &w2, x[ 1], x[ 7]);
641  word3_muladd_2(&w1, &w0, &w2, x[ 2], x[ 6]);
642  word3_muladd_2(&w1, &w0, &w2, x[ 3], x[ 5]);
643  word3_muladd(&w1, &w0, &w2, x[ 4], x[ 4]);
644  z[ 8] = w2; w2 = 0;
645 
646  word3_muladd_2(&w2, &w1, &w0, x[ 0], x[ 9]);
647  word3_muladd_2(&w2, &w1, &w0, x[ 1], x[ 8]);
648  word3_muladd_2(&w2, &w1, &w0, x[ 2], x[ 7]);
649  word3_muladd_2(&w2, &w1, &w0, x[ 3], x[ 6]);
650  word3_muladd_2(&w2, &w1, &w0, x[ 4], x[ 5]);
651  z[ 9] = w0; w0 = 0;
652 
653  word3_muladd_2(&w0, &w2, &w1, x[ 0], x[10]);
654  word3_muladd_2(&w0, &w2, &w1, x[ 1], x[ 9]);
655  word3_muladd_2(&w0, &w2, &w1, x[ 2], x[ 8]);
656  word3_muladd_2(&w0, &w2, &w1, x[ 3], x[ 7]);
657  word3_muladd_2(&w0, &w2, &w1, x[ 4], x[ 6]);
658  word3_muladd(&w0, &w2, &w1, x[ 5], x[ 5]);
659  z[10] = w1; w1 = 0;
660 
661  word3_muladd_2(&w1, &w0, &w2, x[ 0], x[11]);
662  word3_muladd_2(&w1, &w0, &w2, x[ 1], x[10]);
663  word3_muladd_2(&w1, &w0, &w2, x[ 2], x[ 9]);
664  word3_muladd_2(&w1, &w0, &w2, x[ 3], x[ 8]);
665  word3_muladd_2(&w1, &w0, &w2, x[ 4], x[ 7]);
666  word3_muladd_2(&w1, &w0, &w2, x[ 5], x[ 6]);
667  z[11] = w2; w2 = 0;
668 
669  word3_muladd_2(&w2, &w1, &w0, x[ 0], x[12]);
670  word3_muladd_2(&w2, &w1, &w0, x[ 1], x[11]);
671  word3_muladd_2(&w2, &w1, &w0, x[ 2], x[10]);
672  word3_muladd_2(&w2, &w1, &w0, x[ 3], x[ 9]);
673  word3_muladd_2(&w2, &w1, &w0, x[ 4], x[ 8]);
674  word3_muladd_2(&w2, &w1, &w0, x[ 5], x[ 7]);
675  word3_muladd(&w2, &w1, &w0, x[ 6], x[ 6]);
676  z[12] = w0; w0 = 0;
677 
678  word3_muladd_2(&w0, &w2, &w1, x[ 0], x[13]);
679  word3_muladd_2(&w0, &w2, &w1, x[ 1], x[12]);
680  word3_muladd_2(&w0, &w2, &w1, x[ 2], x[11]);
681  word3_muladd_2(&w0, &w2, &w1, x[ 3], x[10]);
682  word3_muladd_2(&w0, &w2, &w1, x[ 4], x[ 9]);
683  word3_muladd_2(&w0, &w2, &w1, x[ 5], x[ 8]);
684  word3_muladd_2(&w0, &w2, &w1, x[ 6], x[ 7]);
685  z[13] = w1; w1 = 0;
686 
687  word3_muladd_2(&w1, &w0, &w2, x[ 0], x[14]);
688  word3_muladd_2(&w1, &w0, &w2, x[ 1], x[13]);
689  word3_muladd_2(&w1, &w0, &w2, x[ 2], x[12]);
690  word3_muladd_2(&w1, &w0, &w2, x[ 3], x[11]);
691  word3_muladd_2(&w1, &w0, &w2, x[ 4], x[10]);
692  word3_muladd_2(&w1, &w0, &w2, x[ 5], x[ 9]);
693  word3_muladd_2(&w1, &w0, &w2, x[ 6], x[ 8]);
694  word3_muladd(&w1, &w0, &w2, x[ 7], x[ 7]);
695  z[14] = w2; w2 = 0;
696 
697  word3_muladd_2(&w2, &w1, &w0, x[ 0], x[15]);
698  word3_muladd_2(&w2, &w1, &w0, x[ 1], x[14]);
699  word3_muladd_2(&w2, &w1, &w0, x[ 2], x[13]);
700  word3_muladd_2(&w2, &w1, &w0, x[ 3], x[12]);
701  word3_muladd_2(&w2, &w1, &w0, x[ 4], x[11]);
702  word3_muladd_2(&w2, &w1, &w0, x[ 5], x[10]);
703  word3_muladd_2(&w2, &w1, &w0, x[ 6], x[ 9]);
704  word3_muladd_2(&w2, &w1, &w0, x[ 7], x[ 8]);
705  z[15] = w0; w0 = 0;
706 
707  word3_muladd_2(&w0, &w2, &w1, x[ 1], x[15]);
708  word3_muladd_2(&w0, &w2, &w1, x[ 2], x[14]);
709  word3_muladd_2(&w0, &w2, &w1, x[ 3], x[13]);
710  word3_muladd_2(&w0, &w2, &w1, x[ 4], x[12]);
711  word3_muladd_2(&w0, &w2, &w1, x[ 5], x[11]);
712  word3_muladd_2(&w0, &w2, &w1, x[ 6], x[10]);
713  word3_muladd_2(&w0, &w2, &w1, x[ 7], x[ 9]);
714  word3_muladd(&w0, &w2, &w1, x[ 8], x[ 8]);
715  z[16] = w1; w1 = 0;
716 
717  word3_muladd_2(&w1, &w0, &w2, x[ 2], x[15]);
718  word3_muladd_2(&w1, &w0, &w2, x[ 3], x[14]);
719  word3_muladd_2(&w1, &w0, &w2, x[ 4], x[13]);
720  word3_muladd_2(&w1, &w0, &w2, x[ 5], x[12]);
721  word3_muladd_2(&w1, &w0, &w2, x[ 6], x[11]);
722  word3_muladd_2(&w1, &w0, &w2, x[ 7], x[10]);
723  word3_muladd_2(&w1, &w0, &w2, x[ 8], x[ 9]);
724  z[17] = w2; w2 = 0;
725 
726  word3_muladd_2(&w2, &w1, &w0, x[ 3], x[15]);
727  word3_muladd_2(&w2, &w1, &w0, x[ 4], x[14]);
728  word3_muladd_2(&w2, &w1, &w0, x[ 5], x[13]);
729  word3_muladd_2(&w2, &w1, &w0, x[ 6], x[12]);
730  word3_muladd_2(&w2, &w1, &w0, x[ 7], x[11]);
731  word3_muladd_2(&w2, &w1, &w0, x[ 8], x[10]);
732  word3_muladd(&w2, &w1, &w0, x[ 9], x[ 9]);
733  z[18] = w0; w0 = 0;
734 
735  word3_muladd_2(&w0, &w2, &w1, x[ 4], x[15]);
736  word3_muladd_2(&w0, &w2, &w1, x[ 5], x[14]);
737  word3_muladd_2(&w0, &w2, &w1, x[ 6], x[13]);
738  word3_muladd_2(&w0, &w2, &w1, x[ 7], x[12]);
739  word3_muladd_2(&w0, &w2, &w1, x[ 8], x[11]);
740  word3_muladd_2(&w0, &w2, &w1, x[ 9], x[10]);
741  z[19] = w1; w1 = 0;
742 
743  word3_muladd_2(&w1, &w0, &w2, x[ 5], x[15]);
744  word3_muladd_2(&w1, &w0, &w2, x[ 6], x[14]);
745  word3_muladd_2(&w1, &w0, &w2, x[ 7], x[13]);
746  word3_muladd_2(&w1, &w0, &w2, x[ 8], x[12]);
747  word3_muladd_2(&w1, &w0, &w2, x[ 9], x[11]);
748  word3_muladd(&w1, &w0, &w2, x[10], x[10]);
749  z[20] = w2; w2 = 0;
750 
751  word3_muladd_2(&w2, &w1, &w0, x[ 6], x[15]);
752  word3_muladd_2(&w2, &w1, &w0, x[ 7], x[14]);
753  word3_muladd_2(&w2, &w1, &w0, x[ 8], x[13]);
754  word3_muladd_2(&w2, &w1, &w0, x[ 9], x[12]);
755  word3_muladd_2(&w2, &w1, &w0, x[10], x[11]);
756  z[21] = w0; w0 = 0;
757 
758  word3_muladd_2(&w0, &w2, &w1, x[ 7], x[15]);
759  word3_muladd_2(&w0, &w2, &w1, x[ 8], x[14]);
760  word3_muladd_2(&w0, &w2, &w1, x[ 9], x[13]);
761  word3_muladd_2(&w0, &w2, &w1, x[10], x[12]);
762  word3_muladd(&w0, &w2, &w1, x[11], x[11]);
763  z[22] = w1; w1 = 0;
764 
765  word3_muladd_2(&w1, &w0, &w2, x[ 8], x[15]);
766  word3_muladd_2(&w1, &w0, &w2, x[ 9], x[14]);
767  word3_muladd_2(&w1, &w0, &w2, x[10], x[13]);
768  word3_muladd_2(&w1, &w0, &w2, x[11], x[12]);
769  z[23] = w2; w2 = 0;
770 
771  word3_muladd_2(&w2, &w1, &w0, x[ 9], x[15]);
772  word3_muladd_2(&w2, &w1, &w0, x[10], x[14]);
773  word3_muladd_2(&w2, &w1, &w0, x[11], x[13]);
774  word3_muladd(&w2, &w1, &w0, x[12], x[12]);
775  z[24] = w0; w0 = 0;
776 
777  word3_muladd_2(&w0, &w2, &w1, x[10], x[15]);
778  word3_muladd_2(&w0, &w2, &w1, x[11], x[14]);
779  word3_muladd_2(&w0, &w2, &w1, x[12], x[13]);
780  z[25] = w1; w1 = 0;
781 
782  word3_muladd_2(&w1, &w0, &w2, x[11], x[15]);
783  word3_muladd_2(&w1, &w0, &w2, x[12], x[14]);
784  word3_muladd(&w1, &w0, &w2, x[13], x[13]);
785  z[26] = w2; w2 = 0;
786 
787  word3_muladd_2(&w2, &w1, &w0, x[12], x[15]);
788  word3_muladd_2(&w2, &w1, &w0, x[13], x[14]);
789  z[27] = w0; w0 = 0;
790 
791  word3_muladd_2(&w0, &w2, &w1, x[13], x[15]);
792  word3_muladd(&w0, &w2, &w1, x[14], x[14]);
793  z[28] = w1; w1 = 0;
794 
795  word3_muladd_2(&w1, &w0, &w2, x[14], x[15]);
796  z[29] = w2; w2 = 0;
797 
798  word3_muladd(&w2, &w1, &w0, x[15], x[15]);
799  z[30] = w0;
800  z[31] = w1;
801  }
const BigInt & x
Definition: dsa.cpp:98
void word3_muladd(word *w2, word *w1, word *w0, word a, word b)
Definition: mp_asmi.h:175
void word3_muladd_2(word *w2, word *w1, word *w0, word a, word b)
Definition: mp_asmi.h:186
void Botan::bigint_comba_sqr4 ( word  z[8],
const word  x[4] 
)

Definition at line 18 of file mp_comba.cpp.

References word3_muladd(), and word3_muladd_2().

Referenced by bigint_sqr().

19  {
20  word w2 = 0, w1 = 0, w0 = 0;
21 
22  word3_muladd(&w2, &w1, &w0, x[ 0], x[ 0]);
23  z[ 0] = w0; w0 = 0;
24 
25  word3_muladd_2(&w0, &w2, &w1, x[ 0], x[ 1]);
26  z[ 1] = w1; w1 = 0;
27 
28  word3_muladd_2(&w1, &w0, &w2, x[ 0], x[ 2]);
29  word3_muladd(&w1, &w0, &w2, x[ 1], x[ 1]);
30  z[ 2] = w2; w2 = 0;
31 
32  word3_muladd_2(&w2, &w1, &w0, x[ 0], x[ 3]);
33  word3_muladd_2(&w2, &w1, &w0, x[ 1], x[ 2]);
34  z[ 3] = w0; w0 = 0;
35 
36  word3_muladd_2(&w0, &w2, &w1, x[ 1], x[ 3]);
37  word3_muladd(&w0, &w2, &w1, x[ 2], x[ 2]);
38  z[ 4] = w1; w1 = 0;
39 
40  word3_muladd_2(&w1, &w0, &w2, x[ 2], x[ 3]);
41  z[ 5] = w2; w2 = 0;
42 
43  word3_muladd(&w2, &w1, &w0, x[ 3], x[ 3]);
44  z[ 6] = w0;
45  z[ 7] = w1;
46  }
const BigInt & x
Definition: dsa.cpp:98
void word3_muladd(word *w2, word *w1, word *w0, word a, word b)
Definition: mp_asmi.h:175
void word3_muladd_2(word *w2, word *w1, word *w0, word a, word b)
Definition: mp_asmi.h:186
void Botan::bigint_comba_sqr6 ( word  z[12],
const word  x[6] 
)

Definition at line 90 of file mp_comba.cpp.

References word3_muladd(), and word3_muladd_2().

Referenced by bigint_sqr().

91  {
92  word w2 = 0, w1 = 0, w0 = 0;
93 
94  word3_muladd(&w2, &w1, &w0, x[ 0], x[ 0]);
95  z[ 0] = w0; w0 = 0;
96 
97  word3_muladd_2(&w0, &w2, &w1, x[ 0], x[ 1]);
98  z[ 1] = w1; w1 = 0;
99 
100  word3_muladd_2(&w1, &w0, &w2, x[ 0], x[ 2]);
101  word3_muladd(&w1, &w0, &w2, x[ 1], x[ 1]);
102  z[ 2] = w2; w2 = 0;
103 
104  word3_muladd_2(&w2, &w1, &w0, x[ 0], x[ 3]);
105  word3_muladd_2(&w2, &w1, &w0, x[ 1], x[ 2]);
106  z[ 3] = w0; w0 = 0;
107 
108  word3_muladd_2(&w0, &w2, &w1, x[ 0], x[ 4]);
109  word3_muladd_2(&w0, &w2, &w1, x[ 1], x[ 3]);
110  word3_muladd(&w0, &w2, &w1, x[ 2], x[ 2]);
111  z[ 4] = w1; w1 = 0;
112 
113  word3_muladd_2(&w1, &w0, &w2, x[ 0], x[ 5]);
114  word3_muladd_2(&w1, &w0, &w2, x[ 1], x[ 4]);
115  word3_muladd_2(&w1, &w0, &w2, x[ 2], x[ 3]);
116  z[ 5] = w2; w2 = 0;
117 
118  word3_muladd_2(&w2, &w1, &w0, x[ 1], x[ 5]);
119  word3_muladd_2(&w2, &w1, &w0, x[ 2], x[ 4]);
120  word3_muladd(&w2, &w1, &w0, x[ 3], x[ 3]);
121  z[ 6] = w0; w0 = 0;
122 
123  word3_muladd_2(&w0, &w2, &w1, x[ 2], x[ 5]);
124  word3_muladd_2(&w0, &w2, &w1, x[ 3], x[ 4]);
125  z[ 7] = w1; w1 = 0;
126 
127  word3_muladd_2(&w1, &w0, &w2, x[ 3], x[ 5]);
128  word3_muladd(&w1, &w0, &w2, x[ 4], x[ 4]);
129  z[ 8] = w2; w2 = 0;
130 
131  word3_muladd_2(&w2, &w1, &w0, x[ 4], x[ 5]);
132  z[ 9] = w0; w0 = 0;
133 
134  word3_muladd(&w0, &w2, &w1, x[ 5], x[ 5]);
135  z[10] = w1;
136  z[11] = w2;
137  }
const BigInt & x
Definition: dsa.cpp:98
void word3_muladd(word *w2, word *w1, word *w0, word a, word b)
Definition: mp_asmi.h:175
void word3_muladd_2(word *w2, word *w1, word *w0, word a, word b)
Definition: mp_asmi.h:186
void Botan::bigint_comba_sqr8 ( word  z[16],
const word  x[8] 
)

Definition at line 209 of file mp_comba.cpp.

References word3_muladd(), and word3_muladd_2().

Referenced by bigint_sqr().

210  {
211  word w2 = 0, w1 = 0, w0 = 0;
212 
213  word3_muladd(&w2, &w1, &w0, x[ 0], x[ 0]);
214  z[ 0] = w0; w0 = 0;
215 
216  word3_muladd_2(&w0, &w2, &w1, x[ 0], x[ 1]);
217  z[ 1] = w1; w1 = 0;
218 
219  word3_muladd_2(&w1, &w0, &w2, x[ 0], x[ 2]);
220  word3_muladd(&w1, &w0, &w2, x[ 1], x[ 1]);
221  z[ 2] = w2; w2 = 0;
222 
223  word3_muladd_2(&w2, &w1, &w0, x[ 0], x[ 3]);
224  word3_muladd_2(&w2, &w1, &w0, x[ 1], x[ 2]);
225  z[ 3] = w0; w0 = 0;
226 
227  word3_muladd_2(&w0, &w2, &w1, x[ 0], x[ 4]);
228  word3_muladd_2(&w0, &w2, &w1, x[ 1], x[ 3]);
229  word3_muladd(&w0, &w2, &w1, x[ 2], x[ 2]);
230  z[ 4] = w1; w1 = 0;
231 
232  word3_muladd_2(&w1, &w0, &w2, x[ 0], x[ 5]);
233  word3_muladd_2(&w1, &w0, &w2, x[ 1], x[ 4]);
234  word3_muladd_2(&w1, &w0, &w2, x[ 2], x[ 3]);
235  z[ 5] = w2; w2 = 0;
236 
237  word3_muladd_2(&w2, &w1, &w0, x[ 0], x[ 6]);
238  word3_muladd_2(&w2, &w1, &w0, x[ 1], x[ 5]);
239  word3_muladd_2(&w2, &w1, &w0, x[ 2], x[ 4]);
240  word3_muladd(&w2, &w1, &w0, x[ 3], x[ 3]);
241  z[ 6] = w0; w0 = 0;
242 
243  word3_muladd_2(&w0, &w2, &w1, x[ 0], x[ 7]);
244  word3_muladd_2(&w0, &w2, &w1, x[ 1], x[ 6]);
245  word3_muladd_2(&w0, &w2, &w1, x[ 2], x[ 5]);
246  word3_muladd_2(&w0, &w2, &w1, x[ 3], x[ 4]);
247  z[ 7] = w1; w1 = 0;
248 
249  word3_muladd_2(&w1, &w0, &w2, x[ 1], x[ 7]);
250  word3_muladd_2(&w1, &w0, &w2, x[ 2], x[ 6]);
251  word3_muladd_2(&w1, &w0, &w2, x[ 3], x[ 5]);
252  word3_muladd(&w1, &w0, &w2, x[ 4], x[ 4]);
253  z[ 8] = w2; w2 = 0;
254 
255  word3_muladd_2(&w2, &w1, &w0, x[ 2], x[ 7]);
256  word3_muladd_2(&w2, &w1, &w0, x[ 3], x[ 6]);
257  word3_muladd_2(&w2, &w1, &w0, x[ 4], x[ 5]);
258  z[ 9] = w0; w0 = 0;
259 
260  word3_muladd_2(&w0, &w2, &w1, x[ 3], x[ 7]);
261  word3_muladd_2(&w0, &w2, &w1, x[ 4], x[ 6]);
262  word3_muladd(&w0, &w2, &w1, x[ 5], x[ 5]);
263  z[10] = w1; w1 = 0;
264 
265  word3_muladd_2(&w1, &w0, &w2, x[ 4], x[ 7]);
266  word3_muladd_2(&w1, &w0, &w2, x[ 5], x[ 6]);
267  z[11] = w2; w2 = 0;
268 
269  word3_muladd_2(&w2, &w1, &w0, x[ 5], x[ 7]);
270  word3_muladd(&w2, &w1, &w0, x[ 6], x[ 6]);
271  z[12] = w0; w0 = 0;
272 
273  word3_muladd_2(&w0, &w2, &w1, x[ 6], x[ 7]);
274  z[13] = w1; w1 = 0;
275 
276  word3_muladd(&w1, &w0, &w2, x[ 7], x[ 7]);
277  z[14] = w2;
278  z[15] = w0;
279  }
const BigInt & x
Definition: dsa.cpp:98
void word3_muladd(word *w2, word *w1, word *w0, word a, word b)
Definition: mp_asmi.h:175
void word3_muladd_2(word *w2, word *w1, word *w0, word a, word b)
Definition: mp_asmi.h:186
void Botan::bigint_comba_sqr9 ( word  z[18],
const word  x[9] 
)

Definition at line 387 of file mp_comba.cpp.

References word3_muladd(), and word3_muladd_2().

Referenced by bigint_sqr().

388  {
389  word w2 = 0, w1 = 0, w0 = 0;
390 
391  word3_muladd(&w2, &w1, &w0, x[ 0], x[ 0]);
392  z[ 0] = w0; w0 = 0;
393 
394  word3_muladd_2(&w0, &w2, &w1, x[ 0], x[ 1]);
395  z[ 1] = w1; w1 = 0;
396 
397  word3_muladd_2(&w1, &w0, &w2, x[ 0], x[ 2]);
398  word3_muladd(&w1, &w0, &w2, x[ 1], x[ 1]);
399  z[ 2] = w2; w2 = 0;
400 
401  word3_muladd_2(&w2, &w1, &w0, x[ 0], x[ 3]);
402  word3_muladd_2(&w2, &w1, &w0, x[ 1], x[ 2]);
403  z[ 3] = w0; w0 = 0;
404 
405  word3_muladd_2(&w0, &w2, &w1, x[ 0], x[ 4]);
406  word3_muladd_2(&w0, &w2, &w1, x[ 1], x[ 3]);
407  word3_muladd(&w0, &w2, &w1, x[ 2], x[ 2]);
408  z[ 4] = w1; w1 = 0;
409 
410  word3_muladd_2(&w1, &w0, &w2, x[ 0], x[ 5]);
411  word3_muladd_2(&w1, &w0, &w2, x[ 1], x[ 4]);
412  word3_muladd_2(&w1, &w0, &w2, x[ 2], x[ 3]);
413  z[ 5] = w2; w2 = 0;
414 
415  word3_muladd_2(&w2, &w1, &w0, x[ 0], x[ 6]);
416  word3_muladd_2(&w2, &w1, &w0, x[ 1], x[ 5]);
417  word3_muladd_2(&w2, &w1, &w0, x[ 2], x[ 4]);
418  word3_muladd(&w2, &w1, &w0, x[ 3], x[ 3]);
419  z[ 6] = w0; w0 = 0;
420 
421  word3_muladd_2(&w0, &w2, &w1, x[ 0], x[ 7]);
422  word3_muladd_2(&w0, &w2, &w1, x[ 1], x[ 6]);
423  word3_muladd_2(&w0, &w2, &w1, x[ 2], x[ 5]);
424  word3_muladd_2(&w0, &w2, &w1, x[ 3], x[ 4]);
425  z[ 7] = w1; w1 = 0;
426 
427  word3_muladd_2(&w1, &w0, &w2, x[ 0], x[ 8]);
428  word3_muladd_2(&w1, &w0, &w2, x[ 1], x[ 7]);
429  word3_muladd_2(&w1, &w0, &w2, x[ 2], x[ 6]);
430  word3_muladd_2(&w1, &w0, &w2, x[ 3], x[ 5]);
431  word3_muladd(&w1, &w0, &w2, x[ 4], x[ 4]);
432  z[ 8] = w2; w2 = 0;
433 
434  word3_muladd_2(&w2, &w1, &w0, x[ 1], x[ 8]);
435  word3_muladd_2(&w2, &w1, &w0, x[ 2], x[ 7]);
436  word3_muladd_2(&w2, &w1, &w0, x[ 3], x[ 6]);
437  word3_muladd_2(&w2, &w1, &w0, x[ 4], x[ 5]);
438  z[ 9] = w0; w0 = 0;
439 
440  word3_muladd_2(&w0, &w2, &w1, x[ 2], x[ 8]);
441  word3_muladd_2(&w0, &w2, &w1, x[ 3], x[ 7]);
442  word3_muladd_2(&w0, &w2, &w1, x[ 4], x[ 6]);
443  word3_muladd(&w0, &w2, &w1, x[ 5], x[ 5]);
444  z[10] = w1; w1 = 0;
445 
446  word3_muladd_2(&w1, &w0, &w2, x[ 3], x[ 8]);
447  word3_muladd_2(&w1, &w0, &w2, x[ 4], x[ 7]);
448  word3_muladd_2(&w1, &w0, &w2, x[ 5], x[ 6]);
449  z[11] = w2; w2 = 0;
450 
451  word3_muladd_2(&w2, &w1, &w0, x[ 4], x[ 8]);
452  word3_muladd_2(&w2, &w1, &w0, x[ 5], x[ 7]);
453  word3_muladd(&w2, &w1, &w0, x[ 6], x[ 6]);
454  z[12] = w0; w0 = 0;
455 
456  word3_muladd_2(&w0, &w2, &w1, x[ 5], x[ 8]);
457  word3_muladd_2(&w0, &w2, &w1, x[ 6], x[ 7]);
458  z[13] = w1; w1 = 0;
459 
460  word3_muladd_2(&w1, &w0, &w2, x[ 6], x[ 8]);
461  word3_muladd(&w1, &w0, &w2, x[ 7], x[ 7]);
462  z[14] = w2; w2 = 0;
463 
464  word3_muladd_2(&w2, &w1, &w0, x[ 7], x[ 8]);
465  z[15] = w0; w0 = 0;
466 
467  word3_muladd(&w0, &w2, &w1, x[ 8], x[ 8]);
468  z[16] = w1;
469  z[17] = w2;
470  }
const BigInt & x
Definition: dsa.cpp:98
void word3_muladd(word *w2, word *w1, word *w0, word a, word b)
Definition: mp_asmi.h:175
void word3_muladd_2(word *w2, word *w1, word *w0, word a, word b)
Definition: mp_asmi.h:186
word Botan::bigint_divop ( word  n1,
word  n0,
word  d 
)

Compute ((n1<<bits) + n0) / d

Definition at line 44 of file mp_misc.cpp.

References MP_WORD_BITS, and MP_WORD_TOP_BIT.

Referenced by bigint_modop(), divide(), and monty_inverse().

45  {
46  word high = n1 % d, quotient = 0;
47 
48  for(size_t i = 0; i != MP_WORD_BITS; ++i)
49  {
50  word high_top_bit = (high & MP_WORD_TOP_BIT);
51 
52  high <<= 1;
53  high |= (n0 >> (MP_WORD_BITS-1-i)) & 1;
54  quotient <<= 1;
55 
56  if(high_top_bit || high >= d)
57  {
58  high -= d;
59  quotient |= 1;
60  }
61  }
62 
63  return quotient;
64  }
const word MP_WORD_TOP_BIT
Definition: mp_types.h:41
const size_t MP_WORD_BITS
Definition: mp_core.h:19
void Botan::bigint_linmul2 ( word  x[],
size_t  x_size,
word  y 
)

Definition at line 154 of file mp_asm.cpp.

References word8_linmul2(), and word_madd2().

Referenced by Botan::BigInt::operator*=().

155  {
156  const size_t blocks = x_size - (x_size % 8);
157 
158  word carry = 0;
159 
160  for(size_t i = 0; i != blocks; i += 8)
161  carry = word8_linmul2(x + i, y, carry);
162 
163  for(size_t i = blocks; i != x_size; ++i)
164  x[i] = word_madd2(x[i], y, &carry);
165 
166  x[x_size] = carry;
167  }
const BigInt & x
Definition: dsa.cpp:98
const BigInt & y
Definition: dsa.cpp:159
word word_madd2(word a, word b, word *c)
Definition: mp_madd.h:21
word word8_linmul2(word x[8], word y, word carry)
Definition: mp_asmi.h:127
void Botan::bigint_linmul3 ( word  z[],
const word  x[],
size_t  x_size,
word  y 
)

Definition at line 172 of file mp_asm.cpp.

References word8_linmul3(), and word_madd2().

Referenced by bigint_mul(), bigint_sqr(), operator*(), and Botan::BigInt::operator*=().

173  {
174  const size_t blocks = x_size - (x_size % 8);
175 
176  word carry = 0;
177 
178  for(size_t i = 0; i != blocks; i += 8)
179  carry = word8_linmul3(z + i, x + i, y, carry);
180 
181  for(size_t i = blocks; i != x_size; ++i)
182  z[i] = word_madd2(x[i], y, &carry);
183 
184  z[x_size] = carry;
185  }
const BigInt & x
Definition: dsa.cpp:98
const BigInt & y
Definition: dsa.cpp:159
word word8_linmul3(word z[8], const word x[8], word y, word carry)
Definition: mp_asmi.h:143
word word_madd2(word a, word b, word *c)
Definition: mp_madd.h:21
word Botan::bigint_modop ( word  n1,
word  n0,
word  d 
)

Compute ((n1<<bits) + n0) % d

Definition at line 69 of file mp_misc.cpp.

References bigint_divop(), and word_madd2().

Referenced by operator%(), and Botan::BigInt::operator%=().

70  {
71  word z = bigint_divop(n1, n0, d);
72  word dummy = 0;
73  z = word_madd2(z, d, &dummy);
74  return (n0-z);
75  }
word bigint_divop(word n1, word n0, word d)
Definition: mp_misc.cpp:44
word word_madd2(word a, word b, word *c)
Definition: mp_madd.h:21
void Botan::bigint_monty_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,
const word  p[],
size_t  p_size,
word  p_dash,
word  workspace[] 
)

Definition at line 86 of file mp_monty.cpp.

References bigint_monty_redc(), and bigint_mul().

Referenced by Botan::Montgomery_Exponentiator::execute(), and Botan::Montgomery_Exponentiator::set_base().

91  {
92  bigint_mul(&z[0], z_size, &ws[0],
93  &x[0], x_size, x_sw,
94  &y[0], y_size, y_sw);
95 
96  bigint_monty_redc(&z[0],
97  &p[0], p_size, p_dash,
98  &ws[0]);
99  }
const BigInt & x
Definition: dsa.cpp:98
const BigInt & y
Definition: dsa.cpp:159
void bigint_mul(word z[], size_t z_size, word workspace[], const word x[], size_t x_size, size_t x_sw, const word y[], size_t y_size, size_t y_sw)
Definition: mp_karat.cpp:224
void bigint_monty_redc(word z[], const word p[], size_t p_size, word p_dash, word workspace[])
Definition: mp_monty.cpp:21
void Botan::bigint_monty_redc ( word  z[],
const word  p[],
size_t  p_size,
word  p_dash,
word  workspace[] 
)

Montgomery Reduction

Parameters
zinteger to reduce, of size exactly 2*(p_size+1). Output is in the first p_size+1 words, higher words are set to zero.
pmodulus
p_sizesize of p
p_dashMontgomery value
workspacearray of at least 2*(p_size+1) words

Definition at line 21 of file mp_monty.cpp.

References BOTAN_ASSERT, clear_mem(), copy_mem(), word8_madd3(), word_madd3(), word_sub(), and y.

Referenced by bigint_monty_mul(), bigint_monty_sqr(), and Botan::Montgomery_Exponentiator::execute().

24  {
25  const size_t z_size = 2*(p_size+1);
26 
27  const size_t blocks_of_8 = p_size - (p_size % 8);
28 
29  for(size_t i = 0; i != p_size; ++i)
30  {
31  word* z_i = z + i;
32 
33  const word y = z_i[0] * p_dash;
34 
35  /*
36  bigint_linmul3(ws, p, p_size, y);
37  bigint_add2(z_i, z_size - i, ws, p_size+1);
38  */
39 
40  word carry = 0;
41 
42  for(size_t j = 0; j != blocks_of_8; j += 8)
43  carry = word8_madd3(z_i + j, p + j, y, carry);
44 
45  for(size_t j = blocks_of_8; j != p_size; ++j)
46  z_i[j] = word_madd3(p[j], y, z_i[j], &carry);
47 
48  word z_sum = z_i[p_size] + carry;
49  carry = (z_sum < z_i[p_size]);
50  z_i[p_size] = z_sum;
51 
52  for(size_t j = p_size + 1; carry && j != z_size - i; ++j)
53  {
54  ++z_i[j];
55  carry = !z_i[j];
56  }
57  }
58 
59  /*
60  * The result might need to be reduced mod p. To avoid a timing
61  * channel, always perform the subtraction. If in the compution
62  * of x - p a borrow is required then x was already < p.
63  *
64  * x - p starts at ws[0] and is p_size+1 bytes long
65  * x starts at ws[p_size+1] and is also p_size+1 bytes log
66  * (that's the copy_mem)
67  *
68  * Select which address to copy from indexing off of the final
69  * borrow.
70  */
71 
72  word borrow = 0;
73  for(size_t i = 0; i != p_size; ++i)
74  ws[i] = word_sub(z[p_size + i], p[i], &borrow);
75 
76  ws[p_size] = word_sub(z[p_size+p_size], 0, &borrow);
77 
78  BOTAN_ASSERT(borrow == 0 || borrow == 1, "Expected borrow");
79 
80  copy_mem(ws + p_size + 1, z + p_size, p_size + 1);
81 
82  copy_mem(z, ws + borrow*(p_size+1), p_size + 1);
83  clear_mem(z + p_size + 1, z_size - p_size - 1);
84  }
const BigInt & y
Definition: dsa.cpp:159
void clear_mem(T *ptr, size_t n)
Definition: mem_ops.h:28
word word_madd3(word a, word b, word c, word *d)
Definition: mp_madd.h:45
#define BOTAN_ASSERT(expr, assertion_made)
Definition: assert.h:27
word word8_madd3(word z[8], const word x[8], word y, word carry)
Definition: mp_asmi.h:159
void copy_mem(T *out, const T *in, size_t n)
Definition: mem_ops.h:39
word word_sub(word x, word y, word *carry)
Definition: mp_asmi.h:66
void Botan::bigint_monty_sqr ( word  z[],
size_t  z_size,
const word  x[],
size_t  x_size,
size_t  x_sw,
const word  p[],
size_t  p_size,
word  p_dash,
word  workspace[] 
)

Definition at line 101 of file mp_monty.cpp.

References bigint_monty_redc(), and bigint_sqr().

Referenced by Botan::Montgomery_Exponentiator::execute().

105  {
106  bigint_sqr(&z[0], z_size, &ws[0],
107  &x[0], x_size, x_sw);
108 
109  bigint_monty_redc(&z[0],
110  &p[0], p_size, p_dash,
111  &ws[0]);
112  }
const BigInt & x
Definition: dsa.cpp:98
void bigint_sqr(word z[], size_t z_size, word workspace[], const word x[], size_t x_size, size_t x_sw)
Definition: mp_karat.cpp:281
void bigint_monty_redc(word z[], const word p[], size_t p_size, word p_dash, word workspace[])
Definition: mp_monty.cpp:21
void Botan::bigint_mul ( word  z[],
size_t  z_size,
word  workspace[],
const word  x[],
size_t  x_size,
size_t  x_sw,
const word  y[],
size_t  y_size,
size_t  y_sw 
)

Definition at line 224 of file mp_karat.cpp.

References bigint_comba_mul16(), bigint_comba_mul4(), bigint_comba_mul6(), bigint_comba_mul8(), bigint_comba_mul9(), bigint_linmul3(), and bigint_simple_mul().

Referenced by bigint_monty_mul(), Botan::CurveGFp_NIST::curve_mul(), mul_add(), operator*(), and Botan::BigInt::operator*=().

227  {
228  if(x_sw == 1)
229  {
230  bigint_linmul3(z, y, y_sw, x[0]);
231  }
232  else if(y_sw == 1)
233  {
234  bigint_linmul3(z, x, x_sw, y[0]);
235  }
236  else if(x_sw <= 4 && x_size >= 4 &&
237  y_sw <= 4 && y_size >= 4 && z_size >= 8)
238  {
239  bigint_comba_mul4(z, x, y);
240  }
241  else if(x_sw <= 6 && x_size >= 6 &&
242  y_sw <= 6 && y_size >= 6 && z_size >= 12)
243  {
244  bigint_comba_mul6(z, x, y);
245  }
246  else if(x_sw <= 8 && x_size >= 8 &&
247  y_sw <= 8 && y_size >= 8 && z_size >= 16)
248  {
249  bigint_comba_mul8(z, x, y);
250  }
251  else if(x_sw <= 9 && x_size >= 9 &&
252  y_sw <= 9 && y_size >= 9 && z_size >= 18)
253  {
254  bigint_comba_mul9(z, x, y);
255  }
256  else if(x_sw <= 16 && x_size >= 16 &&
257  y_sw <= 16 && y_size >= 16 && z_size >= 32)
258  {
259  bigint_comba_mul16(z, x, y);
260  }
261  else if(x_sw < KARATSUBA_MULTIPLY_THRESHOLD ||
262  y_sw < KARATSUBA_MULTIPLY_THRESHOLD ||
263  !workspace)
264  {
265  bigint_simple_mul(z, x, x_sw, y, y_sw);
266  }
267  else
268  {
269  const size_t N = karatsuba_size(z_size, x_size, x_sw, y_size, y_sw);
270 
271  if(N)
272  karatsuba_mul(z, x, y, N, workspace);
273  else
274  bigint_simple_mul(z, x, x_sw, y, y_sw);
275  }
276  }
const BigInt & x
Definition: dsa.cpp:98
void bigint_simple_mul(word z[], const word x[], size_t x_size, const word y[], size_t y_size)
Definition: mp_mulop.cpp:20
const BigInt & y
Definition: dsa.cpp:159
void bigint_comba_mul4(word z[8], const word x[4], const word y[4])
Definition: mp_comba.cpp:51
void bigint_comba_mul9(word z[18], const word x[9], const word y[9])
Definition: mp_comba.cpp:475
void bigint_linmul3(word z[], const word x[], size_t x_size, word y)
Definition: mp_asm.cpp:172
void bigint_comba_mul8(word z[16], const word x[8], const word y[8])
Definition: mp_comba.cpp:284
void bigint_comba_mul16(word z[32], const word x[16], const word y[16])
Definition: mp_comba.cpp:806
void bigint_comba_mul6(word z[12], const word x[6], const word y[6])
Definition: mp_comba.cpp:142
void Botan::bigint_shl1 ( word  x[],
size_t  x_size,
size_t  word_shift,
size_t  bit_shift 
)

Definition at line 18 of file mp_shift.cpp.

References clear_mem(), copy_mem(), and MP_WORD_BITS.

Referenced by Botan::BigInt::operator-=(), and Botan::BigInt::operator<<=().

19  {
20  if(word_shift)
21  {
22  copy_mem(x + word_shift, x, x_size);
23  clear_mem(x, word_shift);
24  }
25 
26  if(bit_shift)
27  {
28  word carry = 0;
29  for(size_t j = word_shift; j != x_size + word_shift + 1; ++j)
30  {
31  word temp = x[j];
32  x[j] = (temp << bit_shift) | carry;
33  carry = (temp >> (MP_WORD_BITS - bit_shift));
34  }
35  }
36  }
const BigInt & x
Definition: dsa.cpp:98
void clear_mem(T *ptr, size_t n)
Definition: mem_ops.h:28
void copy_mem(T *out, const T *in, size_t n)
Definition: mem_ops.h:39
const size_t MP_WORD_BITS
Definition: mp_core.h:19
void Botan::bigint_shl2 ( word  y[],
const word  x[],
size_t  x_size,
size_t  word_shift,
size_t  bit_shift 
)

Definition at line 96 of file mp_shift.cpp.

References MP_WORD_BITS.

Referenced by operator-(), and operator<<().

98  {
99  for(size_t j = 0; j != x_size; ++j)
100  y[j + word_shift] = x[j];
101  if(bit_shift)
102  {
103  word carry = 0;
104  for(size_t j = word_shift; j != x_size + word_shift + 1; ++j)
105  {
106  word w = y[j];
107  y[j] = (w << bit_shift) | carry;
108  carry = (w >> (MP_WORD_BITS - bit_shift));
109  }
110  }
111  }
const BigInt & x
Definition: dsa.cpp:98
const BigInt & y
Definition: dsa.cpp:159
const size_t MP_WORD_BITS
Definition: mp_core.h:19
void Botan::bigint_shr1 ( word  x[],
size_t  x_size,
size_t  word_shift,
size_t  bit_shift 
)

Definition at line 41 of file mp_shift.cpp.

References clear_mem(), copy_mem(), and MP_WORD_BITS.

Referenced by Botan::BigInt::operator>>=().

42  {
43  if(x_size < word_shift)
44  {
45  clear_mem(x, x_size);
46  return;
47  }
48 
49  if(word_shift)
50  {
51  copy_mem(x, x + word_shift, x_size - word_shift);
52  clear_mem(x + x_size - word_shift, word_shift);
53  }
54 
55  if(bit_shift)
56  {
57  word carry = 0;
58 
59  size_t top = x_size - word_shift;
60 
61  while(top >= 4)
62  {
63  word w = x[top-1];
64  x[top-1] = (w >> bit_shift) | carry;
65  carry = (w << (MP_WORD_BITS - bit_shift));
66 
67  w = x[top-2];
68  x[top-2] = (w >> bit_shift) | carry;
69  carry = (w << (MP_WORD_BITS - bit_shift));
70 
71  w = x[top-3];
72  x[top-3] = (w >> bit_shift) | carry;
73  carry = (w << (MP_WORD_BITS - bit_shift));
74 
75  w = x[top-4];
76  x[top-4] = (w >> bit_shift) | carry;
77  carry = (w << (MP_WORD_BITS - bit_shift));
78 
79  top -= 4;
80  }
81 
82  while(top)
83  {
84  word w = x[top-1];
85  x[top-1] = (w >> bit_shift) | carry;
86  carry = (w << (MP_WORD_BITS - bit_shift));
87 
88  top--;
89  }
90  }
91  }
const BigInt & x
Definition: dsa.cpp:98
void clear_mem(T *ptr, size_t n)
Definition: mem_ops.h:28
void copy_mem(T *out, const T *in, size_t n)
Definition: mem_ops.h:39
const size_t MP_WORD_BITS
Definition: mp_core.h:19
void Botan::bigint_shr2 ( word  y[],
const word  x[],
size_t  x_size,
size_t  word_shift,
size_t  bit_shift 
)

Definition at line 116 of file mp_shift.cpp.

References MP_WORD_BITS.

Referenced by operator>>().

118  {
119  if(x_size < word_shift) return;
120 
121  for(size_t j = 0; j != x_size - word_shift; ++j)
122  y[j] = x[j + word_shift];
123  if(bit_shift)
124  {
125  word carry = 0;
126  for(size_t j = x_size - word_shift; j > 0; --j)
127  {
128  word w = y[j-1];
129  y[j-1] = (w >> bit_shift) | carry;
130  carry = (w << (MP_WORD_BITS - bit_shift));
131  }
132  }
133  }
const BigInt & x
Definition: dsa.cpp:98
const BigInt & y
Definition: dsa.cpp:159
const size_t MP_WORD_BITS
Definition: mp_core.h:19
void Botan::bigint_simple_mul ( word  z[],
const word  x[],
size_t  x_size,
const word  y[],
size_t  y_size 
)

Definition at line 20 of file mp_mulop.cpp.

References clear_mem(), word8_madd3(), and word_madd3().

Referenced by bigint_mul().

22  {
23  const size_t x_size_8 = x_size - (x_size % 8);