forked from qt-creator/qt-creator
Botan: Add *nix support.
Reviewed-by: kh1
This commit is contained in:
2
src/libs/3rdparty/botan/build/botan/build.h
vendored
2
src/libs/3rdparty/botan/build/botan/build.h
vendored
@@ -34,6 +34,8 @@
|
||||
|
||||
#if defined(Q_OS_WIN)
|
||||
# include "build_windows.h"
|
||||
#elif defined(Q_OS_UNIX)
|
||||
# include "build_unix.h"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
358
src/libs/3rdparty/botan/build/botan/build_unix.h
vendored
Normal file
358
src/libs/3rdparty/botan/build/botan/build_unix.h
vendored
Normal file
@@ -0,0 +1,358 @@
|
||||
|
||||
#ifndef BOTAN_BUILD_CONFIG_H__
|
||||
#define BOTAN_BUILD_CONFIG_H__
|
||||
|
||||
/* This file was automatically generated Tue Jan 12 09:38:57 2010 UTC */
|
||||
|
||||
#define BOTAN_VERSION_MAJOR 1
|
||||
#define BOTAN_VERSION_MINOR 8
|
||||
#define BOTAN_VERSION_PATCH 8
|
||||
|
||||
#ifndef BOTAN_DLL
|
||||
#define BOTAN_DLL
|
||||
#endif
|
||||
|
||||
/* Chunk sizes */
|
||||
#define BOTAN_DEFAULT_BUFFER_SIZE 4096
|
||||
#define BOTAN_MEM_POOL_CHUNK_SIZE 64*1024
|
||||
|
||||
/* BigInt toggles */
|
||||
#define BOTAN_MP_WORD_BITS 32
|
||||
#define BOTAN_KARAT_MUL_THRESHOLD 32
|
||||
#define BOTAN_KARAT_SQR_THRESHOLD 32
|
||||
#define BOTAN_PRIVATE_KEY_OP_BLINDING_BITS 64
|
||||
|
||||
/* PK key consistency checking toggles */
|
||||
#define BOTAN_PUBLIC_KEY_STRONG_CHECKS_ON_LOAD 1
|
||||
#define BOTAN_PRIVATE_KEY_STRONG_CHECKS_ON_LOAD 1
|
||||
#define BOTAN_PRIVATE_KEY_STRONG_CHECKS_ON_GENERATE 1
|
||||
|
||||
/* Should we use GCC-style inline assembler? */
|
||||
#if !defined(BOTAN_USE_GCC_INLINE_ASM) && defined(__GNUG__)
|
||||
#define BOTAN_USE_GCC_INLINE_ASM 1
|
||||
#endif
|
||||
|
||||
#ifndef BOTAN_USE_GCC_INLINE_ASM
|
||||
#define BOTAN_USE_GCC_INLINE_ASM 0
|
||||
#endif
|
||||
|
||||
/* Target identification and feature test macros */
|
||||
#define BOTAN_TARGET_OS_IS_LINUX
|
||||
#define BOTAN_TARGET_OS_HAS_POSIX_MLOCK
|
||||
|
||||
#define BOTAN_TARGET_ARCH_IS_IA32
|
||||
#define BOTAN_TARGET_CPU_IS_LITTLE_ENDIAN
|
||||
#define BOTAN_TARGET_UNALIGNED_LOADSTOR_OK 1
|
||||
|
||||
#define BOTAN_USE_STD_TR1
|
||||
|
||||
/* Module definitions */
|
||||
#define BOTAN_HAS_ADLER32
|
||||
#define BOTAN_HAS_AES
|
||||
#define BOTAN_HAS_ALGORITHM_FACTORY
|
||||
#define BOTAN_HAS_ALLOC_MMAP
|
||||
#define BOTAN_HAS_ANSI_X919_MAC
|
||||
#define BOTAN_HAS_ARC4
|
||||
#define BOTAN_HAS_ASN1
|
||||
#define BOTAN_HAS_AUTO_SEEDING_RNG
|
||||
#define BOTAN_HAS_BASE64_CODEC
|
||||
#define BOTAN_HAS_BIGINT
|
||||
#define BOTAN_HAS_BIGINT_GFP
|
||||
#define BOTAN_HAS_BIGINT_MATH
|
||||
#define BOTAN_HAS_BLOCK_CIPHER
|
||||
#define BOTAN_HAS_BLOWFISH
|
||||
#define BOTAN_HAS_CARD_VERIFIABLE_CERTIFICATES
|
||||
#define BOTAN_HAS_CAST
|
||||
#define BOTAN_HAS_CBC
|
||||
#define BOTAN_HAS_CBC_MAC
|
||||
#define BOTAN_HAS_CFB
|
||||
#define BOTAN_HAS_CIPHER_MODEBASE
|
||||
#define BOTAN_HAS_CIPHER_MODE_PADDING
|
||||
#define BOTAN_HAS_CMAC
|
||||
#define BOTAN_HAS_CMS
|
||||
#define BOTAN_HAS_CRC24
|
||||
#define BOTAN_HAS_CRC32
|
||||
#define BOTAN_HAS_CRYPTO_BOX
|
||||
#define BOTAN_HAS_CTR
|
||||
#define BOTAN_HAS_CTS
|
||||
#define BOTAN_HAS_DEFAULT_ENGINE
|
||||
#define BOTAN_HAS_DES
|
||||
#define BOTAN_HAS_DIFFIE_HELLMAN
|
||||
#define BOTAN_HAS_DLIES
|
||||
#define BOTAN_HAS_DL_GROUP
|
||||
#define BOTAN_HAS_DL_PUBLIC_KEY_FAMILY
|
||||
#define BOTAN_HAS_DSA
|
||||
#define BOTAN_HAS_EAX
|
||||
#define BOTAN_HAS_ECB
|
||||
#define BOTAN_HAS_ECC_DOMAIN_PARAMATERS
|
||||
#define BOTAN_HAS_ECC_PUBLIC_KEY_CRYPTO
|
||||
#define BOTAN_HAS_ECDSA
|
||||
#define BOTAN_HAS_ECKAEG
|
||||
#define BOTAN_HAS_ELGAMAL
|
||||
#define BOTAN_HAS_EME1
|
||||
#define BOTAN_HAS_EME_PKCS1v15
|
||||
#define BOTAN_HAS_EMSA1
|
||||
#define BOTAN_HAS_EMSA1_BSI
|
||||
#define BOTAN_HAS_EMSA2
|
||||
#define BOTAN_HAS_EMSA3
|
||||
#define BOTAN_HAS_EMSA4
|
||||
#define BOTAN_HAS_EMSA_RAW
|
||||
#define BOTAN_HAS_ENGINES
|
||||
#define BOTAN_HAS_ENTROPY_SRC_DEVICE
|
||||
#define BOTAN_HAS_ENTROPY_SRC_EGD
|
||||
#define BOTAN_HAS_ENTROPY_SRC_FTW
|
||||
#define BOTAN_HAS_ENTROPY_SRC_UNIX
|
||||
#define BOTAN_HAS_FILTERS
|
||||
#define BOTAN_HAS_FORK_256
|
||||
#define BOTAN_HAS_GOST_28147_89
|
||||
#define BOTAN_HAS_GOST_34_11
|
||||
#define BOTAN_HAS_HASH_ID
|
||||
#define BOTAN_HAS_HAS_160
|
||||
#define BOTAN_HAS_HEX_CODEC
|
||||
#define BOTAN_HAS_HMAC
|
||||
#define BOTAN_HAS_HMAC_RNG
|
||||
#define BOTAN_HAS_IDEA
|
||||
#define BOTAN_HAS_IF_PUBLIC_KEY_FAMILY
|
||||
#define BOTAN_HAS_KASUMI
|
||||
#define BOTAN_HAS_KDF1
|
||||
#define BOTAN_HAS_KDF2
|
||||
#define BOTAN_HAS_KDF_BASE
|
||||
#define BOTAN_HAS_KEYPAIR_TESTING
|
||||
#define BOTAN_HAS_LIBSTATE_MODULE
|
||||
#define BOTAN_HAS_LION
|
||||
#define BOTAN_HAS_LUBY_RACKOFF
|
||||
#define BOTAN_HAS_MARS
|
||||
#define BOTAN_HAS_MD2
|
||||
#define BOTAN_HAS_MD4
|
||||
#define BOTAN_HAS_MD5
|
||||
#define BOTAN_HAS_MDX_HASH_FUNCTION
|
||||
#define BOTAN_HAS_MGF1
|
||||
#define BOTAN_HAS_MISTY1
|
||||
#define BOTAN_HAS_MUTEX_NOOP
|
||||
#define BOTAN_HAS_MUTEX_PTHREAD
|
||||
#define BOTAN_HAS_MUTEX_WRAPPERS
|
||||
#define BOTAN_HAS_NOEKEON
|
||||
#define BOTAN_HAS_NYBERG_RUEPPEL
|
||||
#define BOTAN_HAS_OFB
|
||||
#define BOTAN_HAS_OID_LOOKUP
|
||||
#define BOTAN_HAS_OPENPGP_CODEC
|
||||
#define BOTAN_HAS_PARALLEL_HASH
|
||||
#define BOTAN_HAS_PASSWORD_BASED_ENCRYPTION
|
||||
#define BOTAN_HAS_PBE_PKCS_V15
|
||||
#define BOTAN_HAS_PBE_PKCS_V20
|
||||
#define BOTAN_HAS_PBKDF1
|
||||
#define BOTAN_HAS_PBKDF2
|
||||
#define BOTAN_HAS_PEM_CODEC
|
||||
#define BOTAN_HAS_PGPS2K
|
||||
#define BOTAN_HAS_PIPE_UNIXFD_IO
|
||||
#define BOTAN_HAS_PK_PADDING
|
||||
#define BOTAN_HAS_PUBLIC_KEY_CRYPTO
|
||||
#define BOTAN_HAS_RANDPOOL
|
||||
#define BOTAN_HAS_RC2
|
||||
#define BOTAN_HAS_RC5
|
||||
#define BOTAN_HAS_RC6
|
||||
#define BOTAN_HAS_RIPEMD_128
|
||||
#define BOTAN_HAS_RIPEMD_160
|
||||
#define BOTAN_HAS_RSA
|
||||
#define BOTAN_HAS_RUNTIME_BENCHMARKING
|
||||
#define BOTAN_HAS_RW
|
||||
#define BOTAN_HAS_SAFER
|
||||
#define BOTAN_HAS_SALSA20
|
||||
#define BOTAN_HAS_SEED
|
||||
#define BOTAN_HAS_SELFTESTS
|
||||
#define BOTAN_HAS_SERPENT
|
||||
#define BOTAN_HAS_SHA1
|
||||
#define BOTAN_HAS_SHA2
|
||||
#define BOTAN_HAS_SKEIN_512
|
||||
#define BOTAN_HAS_SKIPJACK
|
||||
#define BOTAN_HAS_SQUARE
|
||||
#define BOTAN_HAS_SSL3_MAC
|
||||
#define BOTAN_HAS_SSL_V3_PRF
|
||||
#define BOTAN_HAS_STREAM_CIPHER
|
||||
#define BOTAN_HAS_TEA
|
||||
#define BOTAN_HAS_TIGER
|
||||
#define BOTAN_HAS_TIMER
|
||||
#define BOTAN_HAS_TIMER_POSIX
|
||||
#define BOTAN_HAS_TIMER_UNIX
|
||||
#define BOTAN_HAS_TLS_V10_PRF
|
||||
#define BOTAN_HAS_TURING
|
||||
#define BOTAN_HAS_TWOFISH
|
||||
#define BOTAN_HAS_UTIL_FUNCTIONS
|
||||
#define BOTAN_HAS_WHIRLPOOL
|
||||
#define BOTAN_HAS_WID_WAKE
|
||||
#define BOTAN_HAS_X509
|
||||
#define BOTAN_HAS_X931_RNG
|
||||
#define BOTAN_HAS_X942_PRF
|
||||
#define BOTAN_HAS_XTEA
|
||||
#define BOTAN_HAS_XTS
|
||||
|
||||
/* Local configuration options */
|
||||
|
||||
|
||||
/*
|
||||
christian@christian-linux ran 'configure.py --os=linux --cpu=ia32 --cc=gcc --disable-asm'
|
||||
|
||||
Target
|
||||
-------
|
||||
Compiler: g++ -O2 -finline-functions
|
||||
Arch: ia32/ia32
|
||||
OS: linux
|
||||
|
||||
Modules
|
||||
-------
|
||||
adler32 (Adler32)
|
||||
aes (AES)
|
||||
algo_factory (Algorithm Factory)
|
||||
alloc (Allocator)
|
||||
alloc_mmap (Disk Based Allocation System)
|
||||
arc4 (ARC4)
|
||||
asn1 (ASN.1/BER/DER module)
|
||||
auto_rng (Auto-seeded Random Number Generator)
|
||||
base64 (Base64 Codec)
|
||||
benchmark (Benchmarking)
|
||||
bigint (BigInt)
|
||||
block (Block Ciphers)
|
||||
blowfish (Blowfish)
|
||||
buf_comp (Buffered Computation)
|
||||
cast (CAST)
|
||||
cbc (CBC block cipher mode)
|
||||
cbc_mac (CBC-MAC)
|
||||
cfb (CFB block cipher mode)
|
||||
cmac (CMAC)
|
||||
cms (CMS)
|
||||
crc24 (CRC-24)
|
||||
crc32 (CRC-32)
|
||||
cryptobox (Crypto Box)
|
||||
ctr (CTR block cipher mode)
|
||||
cts (CTS block cipher mode)
|
||||
cvc (Card Verifiable Certificates)
|
||||
datastor (Datastore)
|
||||
def_engine (Default Engine)
|
||||
des (DES)
|
||||
dev_random (RNG Device Reader)
|
||||
dh (Diffie-Hellman Key Agreement)
|
||||
dl_algo (Discrete Logarithm PK Algorithms)
|
||||
dl_group (DL Group)
|
||||
dlies (DLIES)
|
||||
dsa (DSA)
|
||||
eax (EAX block cipher mode)
|
||||
ec_dompar (ECC Domain Parameters)
|
||||
ecb (ECB block cipher mode)
|
||||
ecc_key (ECC Public Key)
|
||||
ecdsa (ECDSA)
|
||||
eckaeg (ECKAEG)
|
||||
egd (EGD Entropy Source)
|
||||
elgamal (ElGamal)
|
||||
eme1 (EME1)
|
||||
eme_pkcs (PKCSv1 v1.5 EME)
|
||||
emsa1 (EMSA1)
|
||||
emsa1_bsi (EMSA1 (BSI variant))
|
||||
emsa2 (EMSA2)
|
||||
emsa3 (EMSA3)
|
||||
emsa4 (EMSA4)
|
||||
emsa_raw (EMSA-Raw)
|
||||
engine (Engines)
|
||||
entropy (Entropy Sources)
|
||||
fd_unix (Unix I/O support for Pipe)
|
||||
filters (Pipe/Filter)
|
||||
fork256 (FORK-256)
|
||||
gettimeofday (Unix Timer)
|
||||
gfpmath (GF(p) Math)
|
||||
gost_28147 (GOST 28147-89)
|
||||
gost_3411 (GOST 34.11)
|
||||
has160 (HAS-160)
|
||||
hash (Hash Functions)
|
||||
hash_id (Hash Function Identifiers)
|
||||
hex (Hex Codec)
|
||||
hmac (HMAC)
|
||||
hmac_rng (HMAC RNG)
|
||||
idea (IDEA)
|
||||
if_algo (Integer Factorization Algorithms)
|
||||
kasumi (Kasumi)
|
||||
kdf (KDF Base Class)
|
||||
kdf1 (KDF1)
|
||||
kdf2 (KDF2)
|
||||
keypair (Keypair Testing)
|
||||
libstate (Botan Libstate Module)
|
||||
lion (Lion)
|
||||
lubyrack (Luby-Rackoff)
|
||||
mac (Message Authentication Codes)
|
||||
mars (MARS)
|
||||
md2 (MD2)
|
||||
md4 (MD4)
|
||||
md5 (MD5)
|
||||
mdx_hash (MDx Hash Base)
|
||||
mem_pool (Memory Pool Allocator)
|
||||
mgf1 (MGF1)
|
||||
misty1 (MISTY-1)
|
||||
mode_pad (Cipher Mode Padding Method)
|
||||
modes (Cipher Mode Base Class)
|
||||
monty_generic (Montgomery Reduction)
|
||||
mp_generic (MPI Core (C++))
|
||||
mulop_generic (BigInt Multiply-Add)
|
||||
mutex (Mutex Wrappers)
|
||||
noekeon (Noekeon)
|
||||
noop_mutex (No-Op Mutex)
|
||||
nr (Nyberg-Rueppel)
|
||||
numbertheory (Math Functions)
|
||||
ofb (OFB block cipher mode)
|
||||
oid_lookup (OID Lookup)
|
||||
openpgp (OpenPGP Codec)
|
||||
par_hash (Parallel Hash)
|
||||
pbe (PBE Base)
|
||||
pbes1 (PKCS5 v1.5 PBE)
|
||||
pbes2 (PKCS5 v2.0 PBE)
|
||||
pbkdf1 (Pbkdf1)
|
||||
pbkdf2 (Pbkdf2)
|
||||
pem (PEM Codec)
|
||||
pgps2k (Pgps2k)
|
||||
pk_codecs (PK codecs (PKCS8, X.509))
|
||||
pk_pad (Public Key EME/EMSA Padding Modes)
|
||||
posix_rt (POSIX Timer)
|
||||
proc_walk (File Tree Walking Entropy Source)
|
||||
pthreads (Pthread Mutex)
|
||||
pubkey (Public Key Base)
|
||||
randpool (Randpool RNG)
|
||||
rc2 (RC2)
|
||||
rc5 (RC5)
|
||||
rc6 (RC6)
|
||||
rmd128 (RIPEMD-128)
|
||||
rmd160 (RIPEMD-160)
|
||||
rng (Random Number Generators)
|
||||
rsa (RSA)
|
||||
rw (Rabin-Williams)
|
||||
s2k (String to Key Functions)
|
||||
safer (SAFER)
|
||||
salsa20 (Salsa20)
|
||||
seed (SEED)
|
||||
selftest (Selftests)
|
||||
serpent (Serpent)
|
||||
sha1 (SHA-1)
|
||||
sha2 (SHA-2 (224, 256, 384, 512))
|
||||
skein (Skein)
|
||||
skipjack (Skipjack)
|
||||
square (Square)
|
||||
ssl3mac (SSLv3 MAC)
|
||||
ssl_prf (SSLv3 PRF)
|
||||
stream (Stream Ciphers)
|
||||
sym_algo (Symmetric Algorithms)
|
||||
system_alloc (Default (Malloc) Allocators)
|
||||
tea (TEA)
|
||||
tiger (Tiger)
|
||||
timer (Timer Base Class)
|
||||
tls_prf (TLS v1.0 PRF)
|
||||
turing (Turing)
|
||||
twofish (Twofish)
|
||||
unix_procs (Generic Unix Entropy Source)
|
||||
utils (Utility Functions)
|
||||
whirlpool (Whirlpool)
|
||||
wid_wake (WiderWake)
|
||||
x509 (X.509)
|
||||
x919_mac (ANSI X9.19 MAC)
|
||||
x931_rng (ANSI X9.31 PRNG)
|
||||
x942_prf (X942 PRF)
|
||||
xtea (XTEA)
|
||||
xts (XTS block cipher mode)
|
||||
*/
|
||||
|
||||
#endif
|
||||
177
src/libs/3rdparty/botan/build/botan/curve_gfp.h
vendored
Normal file
177
src/libs/3rdparty/botan/build/botan/curve_gfp.h
vendored
Normal file
@@ -0,0 +1,177 @@
|
||||
/******
|
||||
* Elliptic curves over GF(p) (header file)
|
||||
*
|
||||
* (C) 2007 Martin Doering
|
||||
* doering@cdc.informatik.tu-darmstadt.de
|
||||
* Christoph Ludwig
|
||||
* ludwig@fh-worms.de
|
||||
* Falko Strenzke
|
||||
* strenzke@flexsecure.de
|
||||
******/
|
||||
|
||||
#ifndef BOTAN_GFP_CURVE_H__
|
||||
#define BOTAN_GFP_CURVE_H__
|
||||
|
||||
#include <botan/bigint.h>
|
||||
#include <botan/gfp_element.h>
|
||||
#include <iosfwd>
|
||||
|
||||
namespace Botan {
|
||||
|
||||
/**
|
||||
* This class represents an elliptic curve over GF(p)
|
||||
*
|
||||
* Distributed under the terms of the Botan license
|
||||
*/
|
||||
class BOTAN_DLL CurveGFp
|
||||
{
|
||||
public:
|
||||
|
||||
/**
|
||||
* Construct the elliptic curve E: y^2 = x^3 + ax + b over GF(p)
|
||||
* @param a first coefficient
|
||||
* @param b second coefficient
|
||||
* @param p prime number of the field
|
||||
*/
|
||||
CurveGFp(const GFpElement& a, const GFpElement& b,
|
||||
const BigInt& p);
|
||||
|
||||
/**
|
||||
* Copy constructor
|
||||
* @param other The curve to clone
|
||||
*/
|
||||
CurveGFp(const CurveGFp& other);
|
||||
|
||||
/**
|
||||
* Assignment operator
|
||||
* @param other The curve to use as source for the assignment
|
||||
*/
|
||||
const CurveGFp& operator=(const CurveGFp& other);
|
||||
|
||||
/**
|
||||
* Set the shared GFpModulus object.
|
||||
* Warning: do not use this function unless you know in detail how
|
||||
* the sharing of values
|
||||
* in the various EC related objects works.
|
||||
* Do NOT spread pointers to a GFpModulus over different threads!
|
||||
* @param mod a shared pointer to a GFpModulus object suitable for
|
||||
* *this.
|
||||
*/
|
||||
void set_shrd_mod(const std::tr1::shared_ptr<GFpModulus> mod);
|
||||
|
||||
// getters
|
||||
|
||||
/**
|
||||
* Get coefficient a
|
||||
* @result coefficient a
|
||||
*/
|
||||
const GFpElement& get_a() const;
|
||||
|
||||
/**
|
||||
* Get coefficient b
|
||||
* @result coefficient b
|
||||
*/
|
||||
const GFpElement& get_b() const;
|
||||
|
||||
/**
|
||||
* Get the GFpElement coefficient a transformed
|
||||
* to its m-residue. This can be used for efficency reasons: the curve
|
||||
* stores the transformed version after the first invocation of this
|
||||
* function.
|
||||
* @result the coefficient a, transformed to its m-residue
|
||||
*/
|
||||
GFpElement const get_mres_a() const;
|
||||
|
||||
/**
|
||||
* Get the GFpElement coefficient b transformed
|
||||
* to its m-residue. This can be used for efficency reasons: the curve
|
||||
* stores the transformed version after the first invocation of this
|
||||
* function.
|
||||
* @result the coefficient b, transformed to its m-residue
|
||||
*/
|
||||
GFpElement const get_mres_b() const;
|
||||
|
||||
|
||||
/**
|
||||
* Get the GFpElement 1 transformed
|
||||
* to its m-residue. This can be used for efficency reasons: the curve
|
||||
* stores the transformed version after the first invocation of this
|
||||
* function.
|
||||
* @result the GFpElement 1, transformed to its m-residue
|
||||
*/
|
||||
std::tr1::shared_ptr<GFpElement const> const get_mres_one() const;
|
||||
|
||||
/**
|
||||
* Get prime modulus of the field of the curve
|
||||
* @result prime modulus of the field of the curve
|
||||
*/
|
||||
BigInt const get_p() const;
|
||||
/*inline std::tr1::shared_ptr<BigInt> const get_ptr_p() const
|
||||
{
|
||||
return mp_p;
|
||||
}*/
|
||||
|
||||
/**
|
||||
* Retrieve a shared pointer to the curves GFpModulus object for efficient storage
|
||||
* and computation of montgomery multiplication related data members and functions.
|
||||
* Warning: do not use this function unless you know in detail how the sharing of values
|
||||
* in the various EC related objects works.
|
||||
* Do NOT spread pointers to a GFpModulus over different threads!
|
||||
* @result a shared pointer to a GFpModulus object
|
||||
*/
|
||||
inline std::tr1::shared_ptr<GFpModulus> const get_ptr_mod() const
|
||||
{
|
||||
return mp_mod;
|
||||
}
|
||||
|
||||
/**
|
||||
* swaps the states of *this and other, does not throw
|
||||
* @param other The curve to swap values with
|
||||
*/
|
||||
void swap(CurveGFp& other);
|
||||
|
||||
private:
|
||||
std::tr1::shared_ptr<GFpModulus> mp_mod;
|
||||
GFpElement mA;
|
||||
GFpElement mB;
|
||||
mutable std::tr1::shared_ptr<GFpElement> mp_mres_a;
|
||||
mutable std::tr1::shared_ptr<GFpElement> mp_mres_b;
|
||||
mutable std::tr1::shared_ptr<GFpElement> mp_mres_one;
|
||||
};
|
||||
|
||||
// relational operators
|
||||
bool operator==(const CurveGFp& lhs, const CurveGFp& rhs);
|
||||
|
||||
inline bool operator!=(const CurveGFp& lhs, const CurveGFp& rhs)
|
||||
{
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
// io operators
|
||||
std::ostream& operator<<(std::ostream& output, const CurveGFp& elem);
|
||||
|
||||
// swaps the states of curve1 and curve2, does not throw!
|
||||
// cf. Meyers, Item 25
|
||||
inline
|
||||
void swap(CurveGFp& curve1, CurveGFp& curve2)
|
||||
{
|
||||
curve1.swap(curve2);
|
||||
}
|
||||
|
||||
} // namespace Botan
|
||||
|
||||
|
||||
namespace std {
|
||||
|
||||
// swaps the states of curve1 and curve2, does not throw!
|
||||
// cf. Meyers, Item 25
|
||||
template<> inline
|
||||
void swap<Botan::CurveGFp>(Botan::CurveGFp& curve1,
|
||||
Botan::CurveGFp& curve2)
|
||||
{
|
||||
curve1.swap(curve2);
|
||||
}
|
||||
|
||||
} // namespace std
|
||||
|
||||
#endif
|
||||
101
src/libs/3rdparty/botan/build/botan/cvc_ado.h
vendored
Normal file
101
src/libs/3rdparty/botan/build/botan/cvc_ado.h
vendored
Normal file
@@ -0,0 +1,101 @@
|
||||
/*
|
||||
* EAC1_1 CVC ADO
|
||||
* (C) 2008 Falko Strenzke
|
||||
* strenzke@flexsecure.de
|
||||
*
|
||||
* Distributed under the terms of the Botan license
|
||||
*/
|
||||
|
||||
#ifndef BOTAN_EAC_CVC_ADO_H__
|
||||
#define BOTAN_EAC_CVC_ADO_H__
|
||||
|
||||
#include <botan/x509_key.h>
|
||||
#include <botan/pubkey_enums.h>
|
||||
#include <botan/pubkey.h>
|
||||
#include <botan/ecdsa.h>
|
||||
#include <botan/eac_obj.h>
|
||||
#include <botan/cvc_req.h>
|
||||
#include <string>
|
||||
|
||||
namespace Botan {
|
||||
|
||||
/**
|
||||
* This class represents a TR03110 (EAC) v1.1 CVC ADO request
|
||||
*/
|
||||
|
||||
// CRTP continuation from EAC1_1_obj
|
||||
class BOTAN_DLL EAC1_1_ADO : public EAC1_1_obj<EAC1_1_ADO>
|
||||
{
|
||||
public:
|
||||
friend class EAC1_1_obj<EAC1_1_ADO>;
|
||||
|
||||
/**
|
||||
* Construct a CVC ADO request from a DER encoded CVC ADO request file.
|
||||
* @param str the path to the DER encoded file
|
||||
*/
|
||||
EAC1_1_ADO(const std::string& str);
|
||||
|
||||
/**
|
||||
* Construct a CVC ADO request from a data source
|
||||
* @param source the data source
|
||||
*/
|
||||
EAC1_1_ADO(std::tr1::shared_ptr<DataSource> source);
|
||||
|
||||
/**
|
||||
* Create a signed CVC ADO request from to be signed (TBS) data
|
||||
* @param signer the signer used to sign the CVC ADO request
|
||||
* @param tbs_bits the TBS data to sign
|
||||
*/
|
||||
static MemoryVector<byte> make_signed(
|
||||
std::auto_ptr<PK_Signer> signer,
|
||||
const MemoryRegion<byte>& tbs_bits,
|
||||
RandomNumberGenerator& rng);
|
||||
|
||||
/**
|
||||
* Get the CAR of this CVC ADO request
|
||||
* @result the CAR of this CVC ADO request
|
||||
*/
|
||||
ASN1_Car get_car() const;
|
||||
|
||||
/**
|
||||
* Get the CVC request contained in this object.
|
||||
* @result the CVC request inside this CVC ADO request
|
||||
*/
|
||||
EAC1_1_Req get_request() const;
|
||||
|
||||
/**
|
||||
* Encode this object into a pipe. Only DER is supported.
|
||||
* @param out the pipe to encode this object into
|
||||
* @param encoding the encoding type to use, must be DER
|
||||
*/
|
||||
void encode(Pipe& out, X509_Encoding encoding) const;
|
||||
|
||||
bool operator==(EAC1_1_ADO const& rhs) const;
|
||||
|
||||
/**
|
||||
* Get the TBS data of this CVC ADO request.
|
||||
* @result the TBS data
|
||||
*/
|
||||
SecureVector<byte> tbs_data() const;
|
||||
|
||||
virtual ~EAC1_1_ADO() {}
|
||||
private:
|
||||
ASN1_Car m_car;
|
||||
EAC1_1_Req m_req;
|
||||
|
||||
void force_decode();
|
||||
static void decode_info(SharedPtrConverter<DataSource> source,
|
||||
SecureVector<byte> & res_tbs_bits,
|
||||
ECDSA_Signature & res_sig);
|
||||
};
|
||||
|
||||
inline bool operator!=(EAC1_1_ADO const& lhs, EAC1_1_ADO const& rhs)
|
||||
{
|
||||
return (!(lhs == rhs));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
51
src/libs/3rdparty/botan/build/botan/cvc_ca.h
vendored
Normal file
51
src/libs/3rdparty/botan/build/botan/cvc_ca.h
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* EAC1.1 CVC Certificate Authority
|
||||
* (C) 2007 FlexSecure GmbH
|
||||
* 2008 Jack Lloyd
|
||||
*
|
||||
* Distributed under the terms of the Botan license
|
||||
*/
|
||||
|
||||
#ifndef BOTAN_CVC_CA_H__
|
||||
#define BOTAN_CVC_CA_H__
|
||||
|
||||
#include <botan/pkcs8.h>
|
||||
#include <botan/pkcs10.h>
|
||||
#include <botan/pubkey.h>
|
||||
#include <botan/cvc_cert.h>
|
||||
|
||||
namespace Botan {
|
||||
|
||||
/**
|
||||
* This class represents a CVC CA.
|
||||
*/
|
||||
class BOTAN_DLL EAC1_1_CVC_CA
|
||||
{
|
||||
public:
|
||||
|
||||
/**
|
||||
* Create an arbitrary EAC 1.1 CVC.
|
||||
* The desired key encoding must be set within the key (if applicable).
|
||||
* @param signer the signer used to sign the certificate
|
||||
* @param public_key the DER encoded public key to appear in
|
||||
* the certificate
|
||||
* @param car the CAR of the certificate
|
||||
* @param chr the CHR of the certificate
|
||||
* @param holder_auth_templ the holder authorization value byte to
|
||||
* appear in the CHAT of the certificate
|
||||
* @param ced the CED to appear in the certificate
|
||||
* @param ced the CEX to appear in the certificate
|
||||
*/
|
||||
static EAC1_1_CVC make_cert(std::auto_ptr<PK_Signer> signer,
|
||||
MemoryRegion<byte> const& public_key,
|
||||
ASN1_Car const& car,
|
||||
ASN1_Chr const& chr,
|
||||
byte holder_auth_templ,
|
||||
ASN1_Ced ced,
|
||||
ASN1_Cex cex,
|
||||
RandomNumberGenerator& rng);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
94
src/libs/3rdparty/botan/build/botan/cvc_cert.h
vendored
Normal file
94
src/libs/3rdparty/botan/build/botan/cvc_cert.h
vendored
Normal file
@@ -0,0 +1,94 @@
|
||||
/*
|
||||
* EAC1_1 CVC
|
||||
* (C) 2008 Falko Strenzke
|
||||
* 2008 Jack Lloyd
|
||||
*
|
||||
* Distributed under the terms of the Botan license
|
||||
*/
|
||||
|
||||
#ifndef BOTAN_CVC_EAC_H__
|
||||
#define BOTAN_CVC_EAC_H__
|
||||
|
||||
#include <botan/x509_key.h>
|
||||
#include <botan/pubkey_enums.h>
|
||||
#include <botan/signed_obj.h>
|
||||
#include <botan/pubkey.h>
|
||||
#include <botan/ecdsa.h>
|
||||
#include <botan/ecdsa_sig.h>
|
||||
#include <botan/eac_obj.h>
|
||||
#include <botan/cvc_gen_cert.h>
|
||||
#include <string>
|
||||
|
||||
namespace Botan {
|
||||
|
||||
/**
|
||||
* This class represents TR03110 (EAC) v1.1 CV Certificates
|
||||
*/
|
||||
class BOTAN_DLL EAC1_1_CVC : public EAC1_1_gen_CVC<EAC1_1_CVC>//Signed_Object
|
||||
{
|
||||
public:
|
||||
friend class EAC1_1_obj<EAC1_1_CVC>;
|
||||
|
||||
/**
|
||||
* Get the CAR of the certificate.
|
||||
* @result the CAR of the certificate
|
||||
*/
|
||||
ASN1_Car get_car() const;
|
||||
|
||||
/**
|
||||
* Get the CED of this certificate.
|
||||
* @result the CED this certificate
|
||||
*/
|
||||
ASN1_Ced get_ced() const;
|
||||
|
||||
/**
|
||||
* Get the CEX of this certificate.
|
||||
* @result the CEX this certificate
|
||||
*/
|
||||
ASN1_Cex get_cex() const;
|
||||
|
||||
/**
|
||||
* Get the CHAT value.
|
||||
* @result the CHAT value
|
||||
*/
|
||||
u32bit get_chat_value() const;
|
||||
|
||||
bool operator==(const EAC1_1_CVC&) const;
|
||||
|
||||
/**
|
||||
* Construct a CVC from a data source
|
||||
* @param source the data source
|
||||
*/
|
||||
EAC1_1_CVC(std::tr1::shared_ptr<DataSource>& source);
|
||||
|
||||
/**
|
||||
* Construct a CVC from a file
|
||||
* @param str the path to the certificate file
|
||||
*/
|
||||
EAC1_1_CVC(const std::string& str);
|
||||
|
||||
virtual ~EAC1_1_CVC() {}
|
||||
private:
|
||||
void force_decode();
|
||||
friend class EAC1_1_CVC_CA;
|
||||
EAC1_1_CVC() {}
|
||||
|
||||
ASN1_Car m_car;
|
||||
ASN1_Ced m_ced;
|
||||
ASN1_Cex m_cex;
|
||||
byte m_chat_val;
|
||||
OID m_chat_oid;
|
||||
};
|
||||
|
||||
/*
|
||||
* Comparison
|
||||
*/
|
||||
inline bool operator!=(EAC1_1_CVC const& lhs, EAC1_1_CVC const& rhs)
|
||||
{
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
177
src/libs/3rdparty/botan/build/botan/cvc_gen_cert.h
vendored
Normal file
177
src/libs/3rdparty/botan/build/botan/cvc_gen_cert.h
vendored
Normal file
@@ -0,0 +1,177 @@
|
||||
/*
|
||||
* EAC1_1 general CVC
|
||||
* (C) 2008 Falko Strenzke
|
||||
* 2008 Jack Lloyd
|
||||
*
|
||||
* Distributed under the terms of the Botan license
|
||||
*/
|
||||
|
||||
#ifndef BOTAN_EAC_CVC_GEN_CERT_H__
|
||||
#define BOTAN_EAC_CVC_GEN_CERT_H__
|
||||
|
||||
#include <botan/x509_key.h>
|
||||
#include <botan/eac_asn_obj.h>
|
||||
#include <botan/pubkey_enums.h>
|
||||
#include <botan/pubkey.h>
|
||||
#include <botan/ecdsa_sig.h>
|
||||
#include <string>
|
||||
#include <assert.h>
|
||||
|
||||
namespace Botan {
|
||||
|
||||
/**
|
||||
* This class represents TR03110 (EAC) v1.1 generalized CV Certificates
|
||||
*/
|
||||
template<typename Derived>
|
||||
class BOTAN_DLL EAC1_1_gen_CVC : public EAC1_1_obj<Derived> // CRTP continuation from EAC1_1_obj
|
||||
{
|
||||
friend class EAC1_1_obj<EAC1_1_gen_CVC>;
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* Get this certificates public key.
|
||||
* @result this certificates public key
|
||||
*/
|
||||
std::auto_ptr<Public_Key> subject_public_key() const;
|
||||
|
||||
/**
|
||||
* Find out whether this object is self signed.
|
||||
* @result true if this object is self signed
|
||||
*/
|
||||
bool is_self_signed() const;
|
||||
|
||||
/**
|
||||
* Get the CHR of the certificate.
|
||||
* @result the CHR of the certificate
|
||||
*/
|
||||
ASN1_Chr get_chr() const;
|
||||
|
||||
/**
|
||||
* Put the DER encoded version of this object into a pipe. PEM
|
||||
* is not supported.
|
||||
* @param out the pipe to push the DER encoded version into
|
||||
* @param encoding the encoding to use. Must be DER.
|
||||
*/
|
||||
void encode(Pipe& out, X509_Encoding encoding) const;
|
||||
|
||||
/**
|
||||
* Get the to-be-signed (TBS) data of this object.
|
||||
* @result the TBS data of this object
|
||||
*/
|
||||
SecureVector<byte> tbs_data() const;
|
||||
|
||||
/**
|
||||
* Build the DER encoded certifcate body of an object
|
||||
* @param tbs the data to be signed
|
||||
* @result the correctly encoded body of the object
|
||||
*/
|
||||
static SecureVector<byte> build_cert_body(MemoryRegion<byte> const& tbs);
|
||||
|
||||
/**
|
||||
* Create a signed generalized CVC object.
|
||||
* @param signer the signer used to sign this object
|
||||
* @param tbs_bits the body the generalized CVC object to be signed
|
||||
* @result the DER encoded signed generalized CVC object
|
||||
*/
|
||||
static MemoryVector<byte> make_signed(
|
||||
std::auto_ptr<PK_Signer> signer,
|
||||
const MemoryRegion<byte>& tbs_bits,
|
||||
RandomNumberGenerator& rng);
|
||||
virtual ~EAC1_1_gen_CVC<Derived>()
|
||||
{}
|
||||
|
||||
protected:
|
||||
ECDSA_PublicKey m_pk; // public key
|
||||
ASN1_Chr m_chr;
|
||||
bool self_signed;
|
||||
|
||||
static void decode_info(SharedPtrConverter<DataSource> source,
|
||||
SecureVector<byte> & res_tbs_bits,
|
||||
ECDSA_Signature & res_sig);
|
||||
|
||||
};
|
||||
|
||||
template<typename Derived> ASN1_Chr EAC1_1_gen_CVC<Derived>::get_chr() const
|
||||
{
|
||||
return m_chr;
|
||||
}
|
||||
|
||||
template<typename Derived> bool EAC1_1_gen_CVC<Derived>::is_self_signed() const
|
||||
{
|
||||
return self_signed;
|
||||
}
|
||||
|
||||
template<typename Derived> MemoryVector<byte> EAC1_1_gen_CVC<Derived>::make_signed(
|
||||
std::auto_ptr<PK_Signer> signer,
|
||||
const MemoryRegion<byte>& tbs_bits,
|
||||
RandomNumberGenerator& rng) // static
|
||||
{
|
||||
SecureVector<byte> concat_sig = EAC1_1_obj<Derived>::make_signature(signer.get(), tbs_bits, rng);
|
||||
assert(concat_sig.size() % 2 == 0);
|
||||
return DER_Encoder()
|
||||
.start_cons(ASN1_Tag(33), APPLICATION)
|
||||
.raw_bytes(tbs_bits)
|
||||
.encode(concat_sig, OCTET_STRING, ASN1_Tag(55), APPLICATION)
|
||||
.end_cons()
|
||||
.get_contents();
|
||||
}
|
||||
|
||||
template<typename Derived> std::auto_ptr<Public_Key> EAC1_1_gen_CVC<Derived>::subject_public_key() const
|
||||
{
|
||||
return std::auto_ptr<Public_Key>(new ECDSA_PublicKey(m_pk));
|
||||
}
|
||||
|
||||
template<typename Derived> SecureVector<byte> EAC1_1_gen_CVC<Derived>::build_cert_body(MemoryRegion<byte> const& tbs)
|
||||
{
|
||||
return DER_Encoder()
|
||||
.start_cons(ASN1_Tag(78), APPLICATION)
|
||||
.raw_bytes(tbs)
|
||||
.end_cons().get_contents();
|
||||
}
|
||||
|
||||
template<typename Derived> SecureVector<byte> EAC1_1_gen_CVC<Derived>::tbs_data() const
|
||||
{
|
||||
return build_cert_body(EAC1_1_obj<Derived>::tbs_bits);
|
||||
}
|
||||
|
||||
template<typename Derived> void EAC1_1_gen_CVC<Derived>::encode(Pipe& out, X509_Encoding encoding) const
|
||||
{
|
||||
SecureVector<byte> concat_sig(EAC1_1_obj<Derived>::m_sig.get_concatenation());
|
||||
SecureVector<byte> der = DER_Encoder()
|
||||
.start_cons(ASN1_Tag(33), APPLICATION)
|
||||
.start_cons(ASN1_Tag(78), APPLICATION)
|
||||
.raw_bytes(EAC1_1_obj<Derived>::tbs_bits)
|
||||
.end_cons()
|
||||
.encode(concat_sig, OCTET_STRING, ASN1_Tag(55), APPLICATION)
|
||||
.end_cons()
|
||||
.get_contents();
|
||||
|
||||
if (encoding == PEM)
|
||||
throw Invalid_Argument("EAC1_1_gen_CVC::encode() cannot PEM encode an EAC object");
|
||||
else
|
||||
out.write(der);
|
||||
}
|
||||
|
||||
template<typename Derived>
|
||||
void EAC1_1_gen_CVC<Derived>::decode_info(
|
||||
SharedPtrConverter<DataSource> source,
|
||||
SecureVector<byte> & res_tbs_bits,
|
||||
ECDSA_Signature & res_sig)
|
||||
{
|
||||
SecureVector<byte> concat_sig;
|
||||
BER_Decoder(*source.get_shared().get())
|
||||
.start_cons(ASN1_Tag(33))
|
||||
.start_cons(ASN1_Tag(78))
|
||||
.raw_bytes(res_tbs_bits)
|
||||
.end_cons()
|
||||
.decode(concat_sig, OCTET_STRING, ASN1_Tag(55), APPLICATION)
|
||||
.end_cons();
|
||||
res_sig = decode_concatenation(concat_sig);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
54
src/libs/3rdparty/botan/build/botan/cvc_key.h
vendored
Normal file
54
src/libs/3rdparty/botan/build/botan/cvc_key.h
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* EAC CVC Public Key
|
||||
* (C) 2008 FlexSecure Gmbh
|
||||
* Falko Strenzke
|
||||
* strenzke@flexsecure.de
|
||||
*
|
||||
* Distributed under the terms of the Botan license
|
||||
*/
|
||||
|
||||
#ifndef BOTAN_EAC1_1_CVC_PUBLIC_KEY_H__
|
||||
#define BOTAN_EAC1_1_CVC_PUBLIC_KEY_H__
|
||||
|
||||
#include <botan/pipe.h>
|
||||
#include <botan/pk_keys.h>
|
||||
#include <botan/alg_id.h>
|
||||
|
||||
namespace Botan {
|
||||
|
||||
/**
|
||||
* This class represents EAC 1.1 CVC public key encoders.
|
||||
*/
|
||||
class BOTAN_DLL EAC1_1_CVC_Encoder
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Get the DER encoded CVC public key.
|
||||
* @param alg_id the algorithm identifier to use in the encoding
|
||||
* @return the DER encoded public key
|
||||
*/
|
||||
virtual MemoryVector<byte>
|
||||
public_key(const AlgorithmIdentifier& enc) const = 0;
|
||||
|
||||
virtual ~EAC1_1_CVC_Encoder() {}
|
||||
};
|
||||
|
||||
/**
|
||||
* This class represents EAC 1.1 CVC public key decoders.
|
||||
*/
|
||||
class BOTAN_DLL EAC1_1_CVC_Decoder
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Decode a CVC public key.
|
||||
* @param enc the DER encoded public key to decode
|
||||
* @return the algorithm identifier found in the encoded public key
|
||||
*/
|
||||
virtual AlgorithmIdentifier const
|
||||
public_key(const MemoryRegion<byte>& enc) = 0;
|
||||
|
||||
virtual ~EAC1_1_CVC_Decoder() {}
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
63
src/libs/3rdparty/botan/build/botan/cvc_req.h
vendored
Normal file
63
src/libs/3rdparty/botan/build/botan/cvc_req.h
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
* EAC1_1 CVC Request
|
||||
* (C) 2008 Falko Strenzke
|
||||
* strenzke@flexsecure.de
|
||||
*
|
||||
* Distributed under the terms of the Botan license
|
||||
*/
|
||||
|
||||
#ifndef BOTAN_EAC_CVC_REQ_H__
|
||||
#define BOTAN_EAC_CVC_REQ_H__
|
||||
|
||||
#include <botan/x509_key.h>
|
||||
#include <botan/pubkey_enums.h>
|
||||
#include <botan/cvc_gen_cert.h>
|
||||
#include <botan/cvc_req.h>
|
||||
|
||||
namespace Botan {
|
||||
|
||||
/**
|
||||
* This class represents TR03110 v1.1 EAC CV Certificate Requests.
|
||||
*/
|
||||
class BOTAN_DLL EAC1_1_Req : public EAC1_1_gen_CVC<EAC1_1_Req>
|
||||
{
|
||||
public:
|
||||
friend class EAC1_1_Req_CA;
|
||||
friend class EAC1_1_ADO;
|
||||
friend class EAC1_1_obj<EAC1_1_Req>;
|
||||
|
||||
/**
|
||||
* Compare for equality with other
|
||||
* @param other compare for equality with this object
|
||||
*/
|
||||
bool operator==(const EAC1_1_Req& other) const;
|
||||
|
||||
/**
|
||||
* Construct a CVC request from a data source.
|
||||
* @param source the data source
|
||||
*/
|
||||
EAC1_1_Req(std::tr1::shared_ptr<DataSource> source);
|
||||
|
||||
/**
|
||||
* Construct a CVC request from a DER encoded CVC reqeust file.
|
||||
* @param str the path to the DER encoded file
|
||||
*/
|
||||
EAC1_1_Req(const std::string& str);
|
||||
|
||||
virtual ~EAC1_1_Req(){}
|
||||
private:
|
||||
void force_decode();
|
||||
EAC1_1_Req() {}
|
||||
};
|
||||
|
||||
/*
|
||||
* Comparison Operator
|
||||
*/
|
||||
inline bool operator!=(EAC1_1_Req const& lhs, EAC1_1_Req const& rhs)
|
||||
{
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
167
src/libs/3rdparty/botan/build/botan/cvc_self.h
vendored
Normal file
167
src/libs/3rdparty/botan/build/botan/cvc_self.h
vendored
Normal file
@@ -0,0 +1,167 @@
|
||||
/*
|
||||
* CVC Self-Signed Certificate
|
||||
* (C) 2007 FlexSecure GmbH
|
||||
* 2008 Jack Lloyd
|
||||
*
|
||||
* Distributed under the terms of the Botan license
|
||||
*/
|
||||
|
||||
#ifndef BOTAN_CVC_EAC_SELF_H__
|
||||
#define BOTAN_CVC_EAC_SELF_H__
|
||||
|
||||
#include <botan/pkcs8.h>
|
||||
#include <botan/pkcs10.h>
|
||||
#include <botan/cvc_cert.h>
|
||||
#include <botan/ecdsa.h>
|
||||
#include <botan/asn1_obj.h>
|
||||
#include <botan/cvc_req.h>
|
||||
#include <botan/cvc_ado.h>
|
||||
|
||||
namespace Botan {
|
||||
|
||||
/**
|
||||
* This class represents a set of options used for the creation of CVC certificates
|
||||
*/
|
||||
class BOTAN_DLL EAC1_1_CVC_Options
|
||||
{
|
||||
public:
|
||||
|
||||
ASN1_Car car;
|
||||
ASN1_Chr chr;
|
||||
byte holder_auth_templ;
|
||||
ASN1_Ced ced;
|
||||
ASN1_Cex cex;
|
||||
std::string hash_alg;
|
||||
};
|
||||
|
||||
/**
|
||||
* This namespace represents general EAC 1.1 convenience functions.
|
||||
*/
|
||||
namespace CVC_EAC {
|
||||
|
||||
/**
|
||||
* Create a selfsigned CVCA
|
||||
* @param rng the rng to use
|
||||
* @param key the ECDSA private key to be used to sign the certificate
|
||||
* @param opts used to set several parameters. Necessary are:
|
||||
* car, holder_auth_templ, hash_alg, ced, cex and hash_alg
|
||||
* @result the self signed certificate
|
||||
*/
|
||||
|
||||
EAC1_1_CVC create_self_signed_cert(Private_Key const& key,
|
||||
EAC1_1_CVC_Options const& opts,
|
||||
RandomNumberGenerator& rng);
|
||||
/**
|
||||
* Create a CVC request. The key encoding will be according to the provided private key.
|
||||
* @param priv_key the private key associated with the requesting entity
|
||||
* @param chr the chr to appear in the certificate (to be provided without
|
||||
* sequence number)
|
||||
* @param hash_alg the string defining the hash algorithm to be used for the creation
|
||||
* of the signature
|
||||
* @param rng the rng to use
|
||||
* @result the new request
|
||||
*/
|
||||
EAC1_1_Req create_cvc_req(Private_Key const& priv_key,
|
||||
ASN1_Chr const& chr,
|
||||
std::string const& hash_alg,
|
||||
RandomNumberGenerator& rng);
|
||||
|
||||
/**
|
||||
* Create an ADO from a request object.
|
||||
* @param priv_key the private key used to sign the ADO
|
||||
* @param req the request forming the body of the ADO
|
||||
* @param car the CAR forming the body of the ADO, i.e. the
|
||||
* CHR of the entity associated with the provided private key
|
||||
* @param rng the rng to use
|
||||
*/
|
||||
EAC1_1_ADO create_ado_req(Private_Key const& priv_key,
|
||||
EAC1_1_Req const& req,
|
||||
ASN1_Car const& car,
|
||||
RandomNumberGenerator& rng);
|
||||
}
|
||||
/**
|
||||
* This namespace represents EAC 1.1 CVC convenience functions following the specific german
|
||||
* requirements.
|
||||
*/
|
||||
namespace DE_EAC {
|
||||
|
||||
/**
|
||||
* Create a CVCA certificate.
|
||||
* @param priv_key the private key associated with the CVCA certificate
|
||||
* to be created
|
||||
* @param hash the string identifying the hash algorithm to be used
|
||||
* for signing the certificate to be created
|
||||
* @param car the CAR of the certificate to be created
|
||||
* @param iris indicates whether the entity associated with the certificate
|
||||
* shall be entitled to read the biometrical iris image
|
||||
* @param fingerpr indicates whether the entity associated with the certificate
|
||||
* shall be entitled to read the biometrical fingerprint image
|
||||
* @param rng the rng to use
|
||||
* @result the CVCA certificate created
|
||||
*/
|
||||
EAC1_1_CVC create_cvca(Private_Key const& priv_key,
|
||||
std::string const& hash,
|
||||
ASN1_Car const& car,
|
||||
bool iris,
|
||||
bool fingerpr,
|
||||
u32bit cvca_validity_months,
|
||||
RandomNumberGenerator& rng);
|
||||
|
||||
/**
|
||||
* Create a link certificate between two CVCA certificates. The key
|
||||
* encoding will be implicitCA.
|
||||
* @param signer the cvca certificate associated with the signing
|
||||
* entity
|
||||
* @param priv_key the private key associated with the signer
|
||||
* @param to_be_signed the certificate which whose CAR/CHR will be
|
||||
* the holder of the link certificate
|
||||
* @param rng a random number generator
|
||||
*/
|
||||
EAC1_1_CVC link_cvca(EAC1_1_CVC const& signer,
|
||||
Private_Key const& priv_key,
|
||||
EAC1_1_CVC const& to_be_signed,
|
||||
RandomNumberGenerator& rng);
|
||||
|
||||
/**
|
||||
* Create a CVC request. The key encoding will be implicitCA.
|
||||
* @param priv_key the private key associated with the requesting entity
|
||||
* @param chr the chr to appear in the certificate (to be provided without
|
||||
* sequence number)
|
||||
* @param hash_alg the string defining the hash algorithm to be used for the creation
|
||||
* of the signature
|
||||
* @param rng a random number generator
|
||||
* @result the new request
|
||||
*/
|
||||
EAC1_1_Req create_cvc_req(Private_Key const& priv_key,
|
||||
ASN1_Chr const& chr,
|
||||
std::string const& hash_alg,
|
||||
RandomNumberGenerator& rng);
|
||||
|
||||
/**
|
||||
* Sign a CVC request.
|
||||
* @param signer_cert the certificate of the signing entity
|
||||
* @param priv_key the private key of the signing entity
|
||||
* @param req the request to be signed
|
||||
* @param seqnr the sequence number of the certificate to be created
|
||||
* @param seqnr_len the number of digits the sequence number will be
|
||||
* encoded in
|
||||
* @param domestic indicates whether to sign a domestic or a foreign certificate:
|
||||
* set to true for domestic
|
||||
* @param rng a random number generator
|
||||
* @result the new certificate
|
||||
*
|
||||
**/
|
||||
EAC1_1_CVC sign_request(EAC1_1_CVC const& signer_cert,
|
||||
Private_Key const& priv_key,
|
||||
EAC1_1_Req const& req,
|
||||
u32bit seqnr,
|
||||
u32bit seqnr_len,
|
||||
bool domestic,
|
||||
u32bit dvca_validity_months,
|
||||
u32bit ca_is_validity_months,
|
||||
RandomNumberGenerator& rng);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
244
src/libs/3rdparty/botan/build/botan/eac_asn_obj.h
vendored
Normal file
244
src/libs/3rdparty/botan/build/botan/eac_asn_obj.h
vendored
Normal file
@@ -0,0 +1,244 @@
|
||||
/*
|
||||
* EAC ASN.1 Objects
|
||||
* (C) 2007-2008 FlexSecure GmbH
|
||||
* 2008 Jack Lloyd
|
||||
*
|
||||
* Distributed under the terms of the Botan license
|
||||
*/
|
||||
|
||||
#ifndef BOTAN_EAC_ASN1_OBJ_H__
|
||||
#define BOTAN_EAC_ASN1_OBJ_H__
|
||||
|
||||
#include <botan/asn1_obj.h>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
|
||||
namespace Botan {
|
||||
|
||||
/**
|
||||
* This class represents CVC EAC Time objects.
|
||||
* It only models year, month and day. Only limited sanity checks of
|
||||
* the inputted date value are performed.
|
||||
*/
|
||||
class BOTAN_DLL EAC_Time : public ASN1_Object
|
||||
{
|
||||
public:
|
||||
void encode_into(class DER_Encoder&) const;
|
||||
void decode_from(class BER_Decoder&);
|
||||
|
||||
/**
|
||||
* Get a this objects value as a string.
|
||||
* @return the date string
|
||||
*/
|
||||
std::string as_string() const;
|
||||
|
||||
/**
|
||||
* Get a this objects value as a readable formatted string.
|
||||
* @return the date string
|
||||
*/
|
||||
std::string readable_string() const;
|
||||
|
||||
/**
|
||||
* Find out whether this object's values have been set.
|
||||
* @return true if this object's internal values are set
|
||||
*/
|
||||
bool time_is_set() const;
|
||||
|
||||
/**
|
||||
* Compare this to another EAC_Time object.
|
||||
* @return -1 if this object's date is earlier than
|
||||
* other, +1 in the opposite case, and 0 if both dates are
|
||||
* equal.
|
||||
*/
|
||||
s32bit cmp(const EAC_Time& other) const;
|
||||
|
||||
/**
|
||||
* Set this' value by a string value.
|
||||
* @param str a string in the format "yyyy mm dd",
|
||||
* e.g. "2007 08 01"
|
||||
*/
|
||||
void set_to(const std::string& str);
|
||||
//void set_to(const std::string&, ASN1_Tag);
|
||||
|
||||
/**
|
||||
* Add the specified number of years to this.
|
||||
* @param years the number of years to add
|
||||
*/
|
||||
void add_years(u32bit years);
|
||||
|
||||
/**
|
||||
* Add the specified number of months to this.
|
||||
* @param months the number of months to add
|
||||
*/
|
||||
void add_months(u32bit months);
|
||||
|
||||
/**
|
||||
* Get the year value of this objects.
|
||||
* @return the year value
|
||||
*/
|
||||
u32bit get_year() const;
|
||||
|
||||
/**
|
||||
* Get the month value of this objects.
|
||||
* @return the month value
|
||||
*/
|
||||
u32bit get_month() const;
|
||||
|
||||
/**
|
||||
* Get the day value of this objects.
|
||||
* @return the day value
|
||||
*/
|
||||
u32bit get_day() const;
|
||||
|
||||
EAC_Time(u64bit, ASN1_Tag t = ASN1_Tag(0));
|
||||
//EAC_Time(const std::string& = "");
|
||||
EAC_Time(const std::string&, ASN1_Tag = ASN1_Tag(0));
|
||||
EAC_Time(u32bit year, u32bit month, u32bit day, ASN1_Tag = ASN1_Tag(0));
|
||||
|
||||
virtual ~EAC_Time() {}
|
||||
private:
|
||||
SecureVector<byte> encoded_eac_time() const;
|
||||
bool passes_sanity_check() const;
|
||||
u32bit year, month, day;
|
||||
ASN1_Tag tag;
|
||||
};
|
||||
|
||||
/**
|
||||
* This class represents CVC CEDs. Only limited sanity checks of
|
||||
* the inputted date value are performed.
|
||||
*/
|
||||
class BOTAN_DLL ASN1_Ced : public EAC_Time
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Construct a CED from a string value.
|
||||
* @param str a string in the format "yyyy mm dd",
|
||||
* e.g. "2007 08 01"
|
||||
*/
|
||||
ASN1_Ced(std::string const& str = "");
|
||||
|
||||
/**
|
||||
* Construct a CED from a timer value.
|
||||
* @param time the number of seconds elapsed midnight, 1st
|
||||
* January 1970 GMT (or 7pm, 31st December 1969 EST) up to the
|
||||
* desired date
|
||||
*/
|
||||
ASN1_Ced(u64bit time);
|
||||
|
||||
/**
|
||||
* Copy constructor (for general EAC_Time objects).
|
||||
* @param other the object to copy from
|
||||
*/
|
||||
ASN1_Ced(EAC_Time const& other);
|
||||
//ASN1_Ced(ASN1_Cex const& cex);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* This class represents CVC CEXs. Only limited sanity checks of
|
||||
* the inputted date value are performed.
|
||||
*/
|
||||
class BOTAN_DLL ASN1_Cex : public EAC_Time
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Construct a CED from a string value.
|
||||
* @param str a string in the format "yyyy mm dd",
|
||||
* e.g. "2007 08 01"
|
||||
*/
|
||||
ASN1_Cex(std::string const& str="");
|
||||
|
||||
/**
|
||||
* Construct a CED from a timer value.
|
||||
* @param time the number of seconds elapsed
|
||||
* midnight, 1st
|
||||
* January 1970 GMT (or 7pm, 31st December 1969 EST)
|
||||
* up to the desired date
|
||||
*/
|
||||
ASN1_Cex(u64bit time);
|
||||
|
||||
/**
|
||||
* Copy constructor (for general EAC_Time objects).
|
||||
* @param other the object to copy from
|
||||
*/
|
||||
ASN1_Cex(EAC_Time const& other);
|
||||
//ASN1_Cex(ASN1_Ced const& ced);
|
||||
};
|
||||
|
||||
/**
|
||||
* Base class for car/chr of cv certificates.
|
||||
*/
|
||||
class BOTAN_DLL ASN1_EAC_String: public ASN1_Object
|
||||
{
|
||||
public:
|
||||
void encode_into(class DER_Encoder&) const;
|
||||
void decode_from(class BER_Decoder&);
|
||||
|
||||
/**
|
||||
* Get this objects string value.
|
||||
* @return the string value
|
||||
*/
|
||||
std::string value() const;
|
||||
|
||||
/**
|
||||
* Get this objects string value.
|
||||
* @return the string value in iso8859 encoding
|
||||
*/
|
||||
std::string iso_8859() const;
|
||||
|
||||
ASN1_Tag tagging() const;
|
||||
ASN1_EAC_String(const std::string& str, ASN1_Tag the_tag);
|
||||
|
||||
virtual ~ASN1_EAC_String() {}
|
||||
protected:
|
||||
bool sanity_check() const;
|
||||
private:
|
||||
std::string iso_8859_str;
|
||||
ASN1_Tag tag;
|
||||
};
|
||||
|
||||
/**
|
||||
* This class represents CARs of CVCs. (String tagged with 2)
|
||||
*/
|
||||
class BOTAN_DLL ASN1_Car : public ASN1_EAC_String
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Create a CAR with the specified content.
|
||||
* @param str the CAR value
|
||||
*/
|
||||
ASN1_Car(std::string const& str = "");
|
||||
};
|
||||
|
||||
/**
|
||||
* This class represents CHRs of CVCs (tag 32)
|
||||
*/
|
||||
class BOTAN_DLL ASN1_Chr : public ASN1_EAC_String
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Create a CHR with the specified content.
|
||||
* @param str the CHR value
|
||||
*/
|
||||
ASN1_Chr(std::string const& str = "");
|
||||
};
|
||||
|
||||
/*
|
||||
* Comparison Operations
|
||||
*/
|
||||
bool operator==(const EAC_Time&, const EAC_Time&);
|
||||
bool operator!=(const EAC_Time&, const EAC_Time&);
|
||||
bool operator<=(const EAC_Time&, const EAC_Time&);
|
||||
bool operator>=(const EAC_Time&, const EAC_Time&);
|
||||
bool operator>(const EAC_Time&, const EAC_Time&);
|
||||
bool operator<(const EAC_Time&, const EAC_Time&);
|
||||
|
||||
bool operator==(const ASN1_EAC_String&, const ASN1_EAC_String&);
|
||||
inline bool operator!=(const ASN1_EAC_String& lhs, const ASN1_EAC_String& rhs)
|
||||
{
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
131
src/libs/3rdparty/botan/build/botan/eac_obj.h
vendored
Normal file
131
src/libs/3rdparty/botan/build/botan/eac_obj.h
vendored
Normal file
@@ -0,0 +1,131 @@
|
||||
/*
|
||||
* EAC1_1 objects
|
||||
* (C) 2008 Falko Strenzke
|
||||
* strenzke@flexsecure.de
|
||||
*
|
||||
* Distributed under the terms of the Botan license
|
||||
*/
|
||||
|
||||
#ifndef BOTAN_EAC_OBJ_H__
|
||||
#define BOTAN_EAC_OBJ_H__
|
||||
|
||||
#include <botan/pubkey.h>
|
||||
#include <botan/x509_key.h>
|
||||
#include <botan/signed_obj.h>
|
||||
#include <botan/pubkey_enums.h>
|
||||
#include <botan/pubkey.h>
|
||||
#include <botan/parsing.h>
|
||||
#include <botan/pem.h>
|
||||
#include <botan/oids.h>
|
||||
#include <botan/look_pk.h>
|
||||
#include <botan/ecdsa_sig.h>
|
||||
#include <string>
|
||||
|
||||
namespace Botan {
|
||||
|
||||
const std::string eac_cvc_emsa("EMSA1_BSI");
|
||||
|
||||
/*
|
||||
* TR03110 v1.1 EAC CV Certificate
|
||||
*/
|
||||
template<typename Derived> // CRTP is used enable the call sequence:
|
||||
class BOTAN_DLL EAC1_1_obj : public EAC_Signed_Object
|
||||
{
|
||||
// data members first:
|
||||
protected:
|
||||
|
||||
ECDSA_Signature m_sig;
|
||||
|
||||
// member functions here:
|
||||
public:
|
||||
/**
|
||||
* Return the signature as a concatenation of the encoded parts.
|
||||
* @result the concatenated signature
|
||||
*/
|
||||
SecureVector<byte> get_concat_sig() const;
|
||||
|
||||
/**
|
||||
* Verify the signature of this objects.
|
||||
* @param pub_key the public key to verify the signature with
|
||||
* @result true if the verification succeeded
|
||||
*/
|
||||
virtual bool check_signature(Public_Key& pub_key) const;
|
||||
|
||||
protected:
|
||||
void init(SharedPtrConverter<DataSource> in);
|
||||
|
||||
static SecureVector<byte> make_signature(PK_Signer* signer,
|
||||
const MemoryRegion<byte>& tbs_bits,
|
||||
RandomNumberGenerator& rng);
|
||||
|
||||
virtual ~EAC1_1_obj<Derived>(){}
|
||||
|
||||
};
|
||||
|
||||
template<typename Derived> SecureVector<byte> EAC1_1_obj<Derived>::get_concat_sig() const
|
||||
{
|
||||
return m_sig.get_concatenation();
|
||||
}
|
||||
|
||||
template<typename Derived> SecureVector<byte>
|
||||
EAC1_1_obj<Derived>::make_signature(PK_Signer* signer,
|
||||
const MemoryRegion<byte>& tbs_bits,
|
||||
RandomNumberGenerator& rng)
|
||||
{
|
||||
// this is the signature as a der sequence
|
||||
SecureVector<byte> seq_sig = signer->sign_message(tbs_bits, rng);
|
||||
|
||||
ECDSA_Signature sig(decode_seq(seq_sig));
|
||||
SecureVector<byte> concat_sig(sig.get_concatenation());
|
||||
return concat_sig;
|
||||
}
|
||||
|
||||
template<typename Derived> void EAC1_1_obj<Derived>::init(SharedPtrConverter<DataSource> in)
|
||||
{
|
||||
try
|
||||
{
|
||||
Derived::decode_info(in.get_shared(), tbs_bits, m_sig);
|
||||
}
|
||||
catch(Decoding_Error)
|
||||
{
|
||||
throw Decoding_Error(PEM_label_pref + " decoding failed");
|
||||
}
|
||||
}
|
||||
|
||||
template<typename Derived>
|
||||
bool EAC1_1_obj<Derived>::check_signature(Public_Key& pub_key) const
|
||||
{
|
||||
try
|
||||
{
|
||||
std::vector<std::string> sig_info =
|
||||
split_on(OIDS::lookup(sig_algo.oid), '/');
|
||||
|
||||
if(sig_info.size() != 2 || sig_info[0] != pub_key.algo_name())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
std::string padding = sig_info[1];
|
||||
Signature_Format format =
|
||||
(pub_key.message_parts() >= 2) ? DER_SEQUENCE : IEEE_1363;
|
||||
|
||||
if(!dynamic_cast<PK_Verifying_wo_MR_Key*>(&pub_key))
|
||||
return false;
|
||||
|
||||
std::auto_ptr<ECDSA_Signature_Encoder> enc(new ECDSA_Signature_Encoder(&m_sig));
|
||||
SecureVector<byte> seq_sig = enc->signature_bits();
|
||||
SecureVector<byte> to_sign = tbs_data();
|
||||
|
||||
PK_Verifying_wo_MR_Key& sig_key = dynamic_cast<PK_Verifying_wo_MR_Key&>(pub_key);
|
||||
std::auto_ptr<PK_Verifier> verifier(get_pk_verifier(sig_key, padding, format));
|
||||
return verifier->verify_message(to_sign, seq_sig);
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
121
src/libs/3rdparty/botan/build/botan/ec_dompar.h
vendored
Normal file
121
src/libs/3rdparty/botan/build/botan/ec_dompar.h
vendored
Normal file
@@ -0,0 +1,121 @@
|
||||
/*
|
||||
* ECDSA Domain Parameters
|
||||
* (C) 2007 Falko Strenzke, FlexSecure GmbH
|
||||
* 2008 Jack Lloyd
|
||||
*
|
||||
* Distributed under the terms of the Botan license
|
||||
*/
|
||||
|
||||
#ifndef BOTAN_ECC_DOMAIN_PARAMETERS_H__
|
||||
#define BOTAN_ECC_DOMAIN_PARAMETERS_H__
|
||||
|
||||
#include <botan/point_gfp.h>
|
||||
#include <botan/gfp_element.h>
|
||||
#include <botan/curve_gfp.h>
|
||||
#include <botan/bigint.h>
|
||||
#include <botan/der_enc.h>
|
||||
#include <botan/ber_dec.h>
|
||||
#include <botan/alg_id.h>
|
||||
#include <botan/pubkey_enums.h>
|
||||
|
||||
namespace Botan {
|
||||
|
||||
/**
|
||||
* This class represents elliptic curce domain parameters
|
||||
*/
|
||||
class BOTAN_DLL EC_Domain_Params
|
||||
{
|
||||
public:
|
||||
|
||||
/**
|
||||
* Construct Domain paramers from specified parameters
|
||||
* @param curve elliptic curve
|
||||
* @param base_point a base point
|
||||
* @param order the order of the base point
|
||||
* @param cofactor the cofactor
|
||||
*/
|
||||
EC_Domain_Params(const CurveGFp& curve,
|
||||
const PointGFp& base_point,
|
||||
const BigInt& order,
|
||||
const BigInt& cofactor);
|
||||
|
||||
/**
|
||||
* Return domain parameter curve
|
||||
* @result domain parameter curve
|
||||
*/
|
||||
const CurveGFp& get_curve() const
|
||||
{
|
||||
return m_curve;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return domain parameter curve
|
||||
* @result domain parameter curve
|
||||
*/
|
||||
const PointGFp& get_base_point() const
|
||||
{
|
||||
return m_base_point;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the order of the base point
|
||||
* @result order of the base point
|
||||
*/
|
||||
const BigInt& get_order() const
|
||||
{
|
||||
return m_order;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the cofactor
|
||||
* @result the cofactor
|
||||
*/
|
||||
const BigInt& get_cofactor() const
|
||||
{
|
||||
return m_cofactor;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the OID of these domain parameters
|
||||
* @result the OID
|
||||
*/
|
||||
std::string get_oid() const { return m_oid; }
|
||||
|
||||
private:
|
||||
friend EC_Domain_Params get_EC_Dom_Pars_by_oid(std::string oid);
|
||||
|
||||
CurveGFp m_curve;
|
||||
PointGFp m_base_point;
|
||||
BigInt m_order;
|
||||
BigInt m_cofactor;
|
||||
std::string m_oid;
|
||||
};
|
||||
|
||||
bool operator==(EC_Domain_Params const& lhs, EC_Domain_Params const& rhs);
|
||||
|
||||
inline bool operator!=(const EC_Domain_Params& lhs,
|
||||
const EC_Domain_Params& rhs)
|
||||
{
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
enum EC_dompar_enc { ENC_EXPLICIT = 0, ENC_IMPLICITCA = 1, ENC_OID = 2 };
|
||||
|
||||
SecureVector<byte> encode_der_ec_dompar(EC_Domain_Params const& dom_pars,
|
||||
EC_dompar_enc enc_type);
|
||||
|
||||
EC_Domain_Params decode_ber_ec_dompar(SecureVector<byte> const& encoded);
|
||||
|
||||
/**
|
||||
* Factory function, the only way to obtain EC domain parameters with
|
||||
* an OID. The demanded OID has to be registered in the InSiTo
|
||||
* configuration. Consult the file ec_dompar.cpp for the default
|
||||
* configuration.
|
||||
* @param oid the oid of the demanded EC domain parameters
|
||||
* @result the EC domain parameters associated with the OID
|
||||
*/
|
||||
EC_Domain_Params get_EC_Dom_Pars_by_oid(std::string oid);
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
154
src/libs/3rdparty/botan/build/botan/ecc_key.h
vendored
Normal file
154
src/libs/3rdparty/botan/build/botan/ecc_key.h
vendored
Normal file
@@ -0,0 +1,154 @@
|
||||
/*
|
||||
* ECDSA
|
||||
* (C) 2007 Falko Strenzke, FlexSecure GmbH
|
||||
* Manuel Hartl, FlexSecure GmbH
|
||||
* (C) 2008 Jack Lloyd
|
||||
*
|
||||
* Distributed under the terms of the Botan license
|
||||
*/
|
||||
|
||||
#ifndef BOTAN_ECC_PUBLIC_KEY_BASE_H__
|
||||
#define BOTAN_ECC_PUBLIC_KEY_BASE_H__
|
||||
|
||||
#include <botan/bigint.h>
|
||||
#include <botan/curve_gfp.h>
|
||||
#include <botan/pk_keys.h>
|
||||
#include <botan/ec_dompar.h>
|
||||
#include <botan/x509_key.h>
|
||||
#include <botan/pkcs8.h>
|
||||
|
||||
namespace Botan {
|
||||
|
||||
/**
|
||||
* This class represents abstract EC Public Keys. When encoding a key
|
||||
* via an encoder that can be accessed via the corresponding member
|
||||
* functions, the key will decide upon its internally stored encoding
|
||||
* information whether to encode itself with or without domain
|
||||
* parameters, or using the domain parameter oid. Furthermore, a public
|
||||
* key without domain parameters can be decoded. In that case, it
|
||||
* cannot be used for verification until its domain parameters are set
|
||||
* by calling the corresponding member function.
|
||||
*/
|
||||
class BOTAN_DLL EC_PublicKey : public virtual Public_Key
|
||||
{
|
||||
public:
|
||||
|
||||
/**
|
||||
* Tells whether this key knows his own domain parameters.
|
||||
* @result true if the domain parameters are set, false otherwise
|
||||
*/
|
||||
bool domain_parameters_set();
|
||||
|
||||
/**
|
||||
* Get the public point of this key.
|
||||
* @throw Invalid_State is thrown if the
|
||||
* domain parameters of this point are not set
|
||||
* @result the public point of this key
|
||||
*/
|
||||
const PointGFp& public_point() const;
|
||||
|
||||
/**
|
||||
* Get the domain parameters of this key.
|
||||
* @throw Invalid_State is thrown if the
|
||||
* domain parameters of this point are not set
|
||||
* @result the domain parameters of this key
|
||||
*/
|
||||
const EC_Domain_Params& domain_parameters() const;
|
||||
|
||||
/**
|
||||
* Set the domain parameter encoding to be used when encoding this key.
|
||||
* @param enc the encoding to use
|
||||
*/
|
||||
void set_parameter_encoding(EC_dompar_enc enc);
|
||||
|
||||
/**
|
||||
* Get the domain parameter encoding to be used when encoding this key.
|
||||
* @result the encoding to use
|
||||
*/
|
||||
inline int get_parameter_encoding() const
|
||||
{
|
||||
return m_param_enc;
|
||||
}
|
||||
|
||||
//ctors
|
||||
EC_PublicKey()
|
||||
: m_param_enc(ENC_EXPLICIT)
|
||||
{
|
||||
//assert(mp_dom_pars.get() == 0);
|
||||
//assert(mp_public_point.get() == 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an x509_encoder that can be used to encode this key.
|
||||
* @result an x509_encoder for this key
|
||||
*/
|
||||
X509_Encoder* x509_encoder() const;
|
||||
|
||||
/**
|
||||
* Get an x509_decoder that can be used to decode a stored key into
|
||||
* this key.
|
||||
* @result an x509_decoder for this key
|
||||
*/
|
||||
X509_Decoder* x509_decoder();
|
||||
|
||||
/**
|
||||
* Make sure that the public point and domain parameters of this key are set.
|
||||
* @throw Invalid_State if either of the two data members is not set
|
||||
*/
|
||||
virtual void affirm_init() const;
|
||||
|
||||
virtual ~EC_PublicKey() {}
|
||||
protected:
|
||||
virtual void X509_load_hook();
|
||||
|
||||
SecureVector<byte> m_enc_public_point; // stores the public point
|
||||
|
||||
std::auto_ptr<EC_Domain_Params> mp_dom_pars;
|
||||
std::auto_ptr<PointGFp> mp_public_point;
|
||||
EC_dompar_enc m_param_enc;
|
||||
};
|
||||
|
||||
/**
|
||||
* This abstract class represents general EC Private Keys
|
||||
*/
|
||||
class BOTAN_DLL EC_PrivateKey : public virtual EC_PublicKey, public virtual Private_Key
|
||||
{
|
||||
public:
|
||||
|
||||
/**
|
||||
* Get an PKCS#8 encoder that can be used to encoded this key.
|
||||
* @result an PKCS#8 encoder for this key
|
||||
*/
|
||||
PKCS8_Encoder* pkcs8_encoder() const;
|
||||
|
||||
/**
|
||||
* Get an PKCS#8 decoder that can be used to decoded a stored key into
|
||||
* this key.
|
||||
* @result an PKCS#8 decoder for this key
|
||||
*/
|
||||
PKCS8_Decoder* pkcs8_decoder(RandomNumberGenerator&);
|
||||
|
||||
/**
|
||||
* Get the private key value of this key object.
|
||||
* @result the private key value of this key object
|
||||
*/
|
||||
const BigInt& private_value() const;
|
||||
|
||||
/**
|
||||
* Make sure that the public key parts of this object are set
|
||||
* (calls EC_PublicKey::affirm_init()) as well as the private key
|
||||
* value.
|
||||
* @throw Invalid_State if the above conditions are not satisfied
|
||||
*/
|
||||
virtual void affirm_init() const;
|
||||
|
||||
virtual ~EC_PrivateKey() {}
|
||||
protected:
|
||||
virtual void PKCS8_load_hook(bool = false);
|
||||
void generate_private_key(RandomNumberGenerator&);
|
||||
BigInt m_private_value;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
145
src/libs/3rdparty/botan/build/botan/ecdsa.h
vendored
Normal file
145
src/libs/3rdparty/botan/build/botan/ecdsa.h
vendored
Normal file
@@ -0,0 +1,145 @@
|
||||
/*
|
||||
* ECDSA
|
||||
* (C) 2007 Falko Strenzke, FlexSecure GmbH
|
||||
* Manuel Hartl, FlexSecure GmbH
|
||||
* (C) 2008 Jack Lloyd
|
||||
*
|
||||
* Distributed under the terms of the Botan license
|
||||
*/
|
||||
|
||||
#ifndef BOTAN_ECDSA_KEY_H__
|
||||
#define BOTAN_ECDSA_KEY_H__
|
||||
|
||||
#include <botan/ecc_key.h>
|
||||
#include <botan/ecdsa_core.h>
|
||||
|
||||
namespace Botan {
|
||||
|
||||
/**
|
||||
* This class represents ECDSA Public Keys.
|
||||
*/
|
||||
class BOTAN_DLL ECDSA_PublicKey : public virtual EC_PublicKey,
|
||||
public PK_Verifying_wo_MR_Key
|
||||
{
|
||||
public:
|
||||
|
||||
/**
|
||||
* Get this keys algorithm name.
|
||||
* @result this keys algorithm name ("ECDSA")
|
||||
*/
|
||||
std::string algo_name() const { return "ECDSA"; }
|
||||
|
||||
/**
|
||||
* Get the maximum number of bits allowed to be fed to this key.
|
||||
* This is the bitlength of the order of the base point.
|
||||
|
||||
* @result the maximum number of input bits
|
||||
*/
|
||||
u32bit max_input_bits() const;
|
||||
|
||||
/**
|
||||
* Verify a message with this key.
|
||||
* @param message the byte array containing the message
|
||||
* @param mess_len the number of bytes in the message byte array
|
||||
* @param signature the byte array containing the signature
|
||||
* @param sig_len the number of bytes in the signature byte array
|
||||
*/
|
||||
bool verify(const byte message[], u32bit mess_len,
|
||||
const byte signature[], u32bit sig_len) const;
|
||||
|
||||
/**
|
||||
* Default constructor. Use this one if you want to later fill
|
||||
* this object with data from an encoded key.
|
||||
*/
|
||||
ECDSA_PublicKey() {}
|
||||
|
||||
/**
|
||||
* Construct a public key from a given public point.
|
||||
* @param dom_par the domain parameters associated with this key
|
||||
* @param public_point the public point defining this key
|
||||
*/
|
||||
ECDSA_PublicKey(const EC_Domain_Params& dom_par,
|
||||
const PointGFp& public_point); // sets core
|
||||
|
||||
ECDSA_PublicKey const& operator=(const ECDSA_PublicKey& rhs);
|
||||
|
||||
ECDSA_PublicKey(const ECDSA_PublicKey& other);
|
||||
|
||||
/**
|
||||
* Set the domain parameters of this key. This function has to be
|
||||
* used when a key encoded without domain parameters was decoded into
|
||||
* this key. Otherwise it will not be able to verify a signature.
|
||||
* @param dom_pars the domain_parameters associated with this key
|
||||
* @throw Invalid_Argument if the point was found not to be satisfying the
|
||||
* curve equation of the provided domain parameters
|
||||
* or if this key already has domain parameters set
|
||||
* and these are differing from those given as the parameter
|
||||
*/
|
||||
void set_domain_parameters(const EC_Domain_Params& dom_pars);
|
||||
|
||||
/**
|
||||
* Ensure that the public point and domain parameters of this key are set.
|
||||
* @throw Invalid_State if either of the two data members is not set
|
||||
*/
|
||||
virtual void affirm_init() const;
|
||||
|
||||
protected:
|
||||
void X509_load_hook();
|
||||
virtual void set_all_values(const ECDSA_PublicKey& other);
|
||||
|
||||
ECDSA_Core m_ecdsa_core;
|
||||
};
|
||||
|
||||
/**
|
||||
* This class represents ECDSA Private Keys
|
||||
*/
|
||||
class BOTAN_DLL ECDSA_PrivateKey : public ECDSA_PublicKey,
|
||||
public EC_PrivateKey,
|
||||
public PK_Signing_Key
|
||||
{
|
||||
public:
|
||||
//ctors
|
||||
|
||||
/**
|
||||
* Default constructor. Use this one if you want to later fill
|
||||
* this object with data from an encoded key.
|
||||
*/
|
||||
ECDSA_PrivateKey() {}
|
||||
|
||||
/**
|
||||
* Generate a new private key
|
||||
* @param the domain parameters to used for this key
|
||||
*/
|
||||
ECDSA_PrivateKey(RandomNumberGenerator& rng,
|
||||
const EC_Domain_Params& domain);
|
||||
|
||||
ECDSA_PrivateKey(const ECDSA_PrivateKey& other);
|
||||
ECDSA_PrivateKey const& operator=(const ECDSA_PrivateKey& rhs);
|
||||
|
||||
/**
|
||||
* Sign a message with this key.
|
||||
* @param message the byte array representing the message to be signed
|
||||
* @param mess_len the length of the message byte array
|
||||
* @result the signature
|
||||
*/
|
||||
|
||||
SecureVector<byte> sign(const byte message[], u32bit mess_len,
|
||||
RandomNumberGenerator& rng) const;
|
||||
|
||||
/**
|
||||
* Make sure that the public key parts of this object are set
|
||||
* (calls EC_PublicKey::affirm_init()) as well as the private key
|
||||
* value.
|
||||
* @throw Invalid_State if the above conditions are not satisfied
|
||||
*/
|
||||
virtual void affirm_init() const;
|
||||
|
||||
protected:
|
||||
virtual void set_all_values(const ECDSA_PrivateKey& other);
|
||||
private:
|
||||
void PKCS8_load_hook(bool = false);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
47
src/libs/3rdparty/botan/build/botan/ecdsa_core.h
vendored
Normal file
47
src/libs/3rdparty/botan/build/botan/ecdsa_core.h
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* ECDSA Core
|
||||
* (C) 1999-2007 Jack Lloyd
|
||||
* (C) 2007 FlexSecure GmbH
|
||||
*
|
||||
* Distributed under the terms of the Botan license
|
||||
*/
|
||||
|
||||
#ifndef BOTAN_ECDSA_CORE_H__
|
||||
#define BOTAN_ECDSA_CORE_H__
|
||||
|
||||
#include <botan/ecdsa_op.h>
|
||||
#include <botan/blinding.h>
|
||||
#include <botan/ec_dompar.h>
|
||||
|
||||
namespace Botan {
|
||||
|
||||
/*
|
||||
* ECDSA Core
|
||||
*/
|
||||
class BOTAN_DLL ECDSA_Core
|
||||
{
|
||||
public:
|
||||
bool verify(const byte signature[], u32bit sig_len,
|
||||
const byte message[], u32bit mess_len) const;
|
||||
|
||||
SecureVector<byte> sign(const byte message[], u32bit mess_len,
|
||||
RandomNumberGenerator& rng) const;
|
||||
|
||||
ECDSA_Core& operator=(const ECDSA_Core&);
|
||||
|
||||
ECDSA_Core() { op = 0; }
|
||||
|
||||
ECDSA_Core(const ECDSA_Core&);
|
||||
|
||||
ECDSA_Core(const EC_Domain_Params& dom_pars,
|
||||
const BigInt& priv_key,
|
||||
const PointGFp& pub_key);
|
||||
|
||||
~ECDSA_Core() { delete op; }
|
||||
private:
|
||||
ECDSA_Operation* op;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
64
src/libs/3rdparty/botan/build/botan/ecdsa_op.h
vendored
Normal file
64
src/libs/3rdparty/botan/build/botan/ecdsa_op.h
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
* ECDSA Operations
|
||||
* (C) 1999-2008 Jack Lloyd
|
||||
* (C) 2007 FlexSecure GmbH
|
||||
*
|
||||
* Distributed under the terms of the Botan license
|
||||
*/
|
||||
|
||||
#ifndef BOTAN_ECDSA_OPERATIONS_H__
|
||||
#define BOTAN_ECDSA_OPERATIONS_H__
|
||||
|
||||
#include <botan/ec_dompar.h>
|
||||
#include <botan/rng.h>
|
||||
|
||||
namespace Botan {
|
||||
|
||||
/*
|
||||
* ECDSA Operation
|
||||
*/
|
||||
class BOTAN_DLL ECDSA_Operation
|
||||
{
|
||||
public:
|
||||
virtual bool verify(const byte sig[], u32bit sig_len,
|
||||
const byte msg[], u32bit msg_len) const = 0;
|
||||
|
||||
virtual SecureVector<byte> sign(const byte message[],
|
||||
u32bit mess_len,
|
||||
RandomNumberGenerator&) const = 0;
|
||||
|
||||
virtual ECDSA_Operation* clone() const = 0;
|
||||
|
||||
virtual ~ECDSA_Operation() {}
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* Default ECDSA operation
|
||||
*/
|
||||
class BOTAN_DLL Default_ECDSA_Op : public ECDSA_Operation
|
||||
{
|
||||
public:
|
||||
bool verify(const byte signature[], u32bit sig_len,
|
||||
const byte message[], u32bit mess_len) const;
|
||||
|
||||
SecureVector<byte> sign(const byte message[], u32bit mess_len,
|
||||
RandomNumberGenerator& rng) const;
|
||||
|
||||
ECDSA_Operation* clone() const
|
||||
{
|
||||
return new Default_ECDSA_Op(*this);
|
||||
}
|
||||
|
||||
Default_ECDSA_Op(const EC_Domain_Params& dom_pars,
|
||||
const BigInt& priv_key,
|
||||
const PointGFp& pub_key);
|
||||
private:
|
||||
EC_Domain_Params m_dom_pars;
|
||||
PointGFp m_pub_key;
|
||||
BigInt m_priv_key;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
88
src/libs/3rdparty/botan/build/botan/ecdsa_sig.h
vendored
Normal file
88
src/libs/3rdparty/botan/build/botan/ecdsa_sig.h
vendored
Normal file
@@ -0,0 +1,88 @@
|
||||
/*
|
||||
* ECDSA
|
||||
* (C) 2007 Falko Strenzke, FlexSecure GmbH
|
||||
* (C) 2008 Jack Lloyd
|
||||
*
|
||||
* Distributed under the terms of the Botan license
|
||||
*/
|
||||
|
||||
#ifndef BOTAN_ECDSA_SIGNATURE_H__
|
||||
#define BOTAN_ECDSA_SIGNATURE_H__
|
||||
|
||||
#include <botan/bigint.h>
|
||||
#include <botan/der_enc.h>
|
||||
#include <botan/ber_dec.h>
|
||||
|
||||
namespace Botan {
|
||||
|
||||
class BOTAN_DLL ECDSA_Signature
|
||||
{
|
||||
public:
|
||||
friend class ECDSA_Signature_Decoder;
|
||||
|
||||
ECDSA_Signature() {}
|
||||
ECDSA_Signature(const BigInt& r, const BigInt& s);
|
||||
ECDSA_Signature(ECDSA_Signature const& other);
|
||||
ECDSA_Signature const& operator=(ECDSA_Signature const& other);
|
||||
|
||||
const BigInt& get_r() const { return m_r; }
|
||||
const BigInt& get_s() const { return m_s; }
|
||||
|
||||
/**
|
||||
* return the r||s
|
||||
*/
|
||||
SecureVector<byte> const get_concatenation() const;
|
||||
private:
|
||||
BigInt m_r;
|
||||
BigInt m_s;
|
||||
};
|
||||
|
||||
/* Equality of ECDSA_Signature */
|
||||
bool operator==(const ECDSA_Signature& lhs, const ECDSA_Signature& rhs);
|
||||
inline bool operator!=(const ECDSA_Signature& lhs, const ECDSA_Signature& rhs)
|
||||
{
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
class BOTAN_DLL ECDSA_Signature_Decoder
|
||||
{
|
||||
public:
|
||||
void signature_bits(const MemoryRegion<byte>& bits)
|
||||
{
|
||||
BER_Decoder(bits)
|
||||
.start_cons(SEQUENCE)
|
||||
.decode(m_signature->m_r)
|
||||
.decode(m_signature->m_s)
|
||||
.verify_end()
|
||||
.end_cons();
|
||||
}
|
||||
ECDSA_Signature_Decoder(ECDSA_Signature* signature) : m_signature(signature)
|
||||
{}
|
||||
private:
|
||||
ECDSA_Signature* m_signature;
|
||||
};
|
||||
|
||||
class BOTAN_DLL ECDSA_Signature_Encoder
|
||||
{
|
||||
public:
|
||||
MemoryVector<byte> signature_bits() const
|
||||
{
|
||||
return DER_Encoder()
|
||||
.start_cons(SEQUENCE)
|
||||
.encode(m_signature->get_r())
|
||||
.encode(m_signature->get_s())
|
||||
.end_cons()
|
||||
.get_contents();
|
||||
}
|
||||
ECDSA_Signature_Encoder(const ECDSA_Signature* signature) : m_signature(signature)
|
||||
{}
|
||||
private:
|
||||
const ECDSA_Signature* m_signature;
|
||||
};
|
||||
|
||||
ECDSA_Signature const decode_seq(MemoryRegion<byte> const& seq);
|
||||
ECDSA_Signature const decode_concatenation(MemoryRegion<byte> const& concatenation);
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
137
src/libs/3rdparty/botan/build/botan/eckaeg.h
vendored
Normal file
137
src/libs/3rdparty/botan/build/botan/eckaeg.h
vendored
Normal file
@@ -0,0 +1,137 @@
|
||||
/*
|
||||
* ECKAEG
|
||||
* (C) 2007 Falko Strenzke, FlexSecure GmbH
|
||||
* Manuel Hartl, FlexSecure GmbH
|
||||
* (C) 2008 Jack Lloyd
|
||||
*
|
||||
* Distributed under the terms of the Botan license
|
||||
*/
|
||||
|
||||
#ifndef BOTAN_ECKAEG_KEY_H__
|
||||
#define BOTAN_ECKAEG_KEY_H__
|
||||
|
||||
#include <botan/ecc_key.h>
|
||||
#include <botan/eckaeg_core.h>
|
||||
|
||||
namespace Botan {
|
||||
|
||||
/**
|
||||
* This class represents ECKAEG Public Keys.
|
||||
*/
|
||||
class BOTAN_DLL ECKAEG_PublicKey : public virtual EC_PublicKey
|
||||
{
|
||||
public:
|
||||
|
||||
/**
|
||||
* Default constructor. Use this one if you want to later fill
|
||||
* this object with data from an encoded key.
|
||||
*/
|
||||
ECKAEG_PublicKey() {}
|
||||
|
||||
/**
|
||||
* Construct a public key from a given public point.
|
||||
* @param dom_par the domain parameters associated with this key
|
||||
* @param public_point the public point defining this key
|
||||
*/
|
||||
ECKAEG_PublicKey(const EC_Domain_Params& dom_par,
|
||||
const PointGFp& public_point);
|
||||
|
||||
/**
|
||||
* Get this keys algorithm name.
|
||||
* @result this keys algorithm name
|
||||
*/
|
||||
std::string algo_name() const { return "ECKAEG"; }
|
||||
|
||||
/**
|
||||
* Get the maximum number of bits allowed to be fed to this key.
|
||||
* This is the bitlength of the order of the base point.
|
||||
|
||||
* @result the maximum number of input bits
|
||||
*/
|
||||
u32bit max_input_bits() const
|
||||
{
|
||||
if(!mp_dom_pars.get())
|
||||
throw Invalid_State("ECKAEG_PublicKey::max_input_bits(): domain parameters not set");
|
||||
|
||||
return mp_dom_pars->get_order().bits();
|
||||
}
|
||||
|
||||
ECKAEG_PublicKey(ECKAEG_PublicKey const& other);
|
||||
ECKAEG_PublicKey const& operator= (ECKAEG_PublicKey const& rhs);
|
||||
|
||||
/**
|
||||
* Make sure that the public point and domain parameters of this
|
||||
* key are set.
|
||||
* @throw Invalid_State if either of the two data members is not set
|
||||
*/
|
||||
virtual void affirm_init() const;
|
||||
|
||||
protected:
|
||||
void X509_load_hook();
|
||||
virtual void set_all_values(const ECKAEG_PublicKey& other);
|
||||
|
||||
ECKAEG_Core m_eckaeg_core;
|
||||
};
|
||||
|
||||
/**
|
||||
* This class represents ECKAEG Private Keys.
|
||||
*/
|
||||
class BOTAN_DLL ECKAEG_PrivateKey : public ECKAEG_PublicKey,
|
||||
public EC_PrivateKey,
|
||||
public PK_Key_Agreement_Key
|
||||
{
|
||||
public:
|
||||
|
||||
/**
|
||||
* Generate a new private key
|
||||
* @param the domain parameters to used for this key
|
||||
*/
|
||||
ECKAEG_PrivateKey(RandomNumberGenerator& rng,
|
||||
const EC_Domain_Params& dom_pars)
|
||||
{
|
||||
mp_dom_pars = std::auto_ptr<EC_Domain_Params>(new EC_Domain_Params(dom_pars));
|
||||
generate_private_key(rng);
|
||||
mp_public_point->check_invariants();
|
||||
m_eckaeg_core = ECKAEG_Core(*mp_dom_pars, m_private_value, *mp_public_point);
|
||||
}
|
||||
|
||||
/**
|
||||
* Default constructor. Use this one if you want to later fill this object with data
|
||||
* from an encoded key.
|
||||
*/
|
||||
ECKAEG_PrivateKey() {}
|
||||
ECKAEG_PrivateKey(ECKAEG_PrivateKey const& other);
|
||||
ECKAEG_PrivateKey const& operator=(ECKAEG_PrivateKey const& rhs);
|
||||
|
||||
MemoryVector<byte> public_value() const;
|
||||
|
||||
void PKCS8_load_hook(bool = false);
|
||||
|
||||
/**
|
||||
* Derive a shared key with the other partys public key.
|
||||
* @param key the other partys public key
|
||||
* @param key_len the other partys public key
|
||||
*/
|
||||
SecureVector<byte> derive_key(const byte key[], u32bit key_len) const;
|
||||
|
||||
/**
|
||||
* Derive a shared key with the other partys public key.
|
||||
* @param other the other partys public key
|
||||
*/
|
||||
SecureVector<byte> derive_key(const ECKAEG_PublicKey& other) const;
|
||||
|
||||
/**
|
||||
* Make sure that the public key parts of this object are set
|
||||
* (calls EC_PublicKey::affirm_init()) as well as the private key
|
||||
* value.
|
||||
* @throw Invalid_State if the above conditions are not satisfied
|
||||
*/
|
||||
virtual void affirm_init() const;
|
||||
|
||||
protected:
|
||||
virtual void set_all_values(const ECKAEG_PrivateKey& other);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
44
src/libs/3rdparty/botan/build/botan/eckaeg_core.h
vendored
Normal file
44
src/libs/3rdparty/botan/build/botan/eckaeg_core.h
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* ECKAEG Core
|
||||
* (C) 1999-2007 Jack Lloyd
|
||||
* (C) 2007 FlexSecure GmbH
|
||||
*
|
||||
* Distributed under the terms of the Botan license
|
||||
*/
|
||||
|
||||
#ifndef BOTAN_ECKAEG_CORE_H__
|
||||
#define BOTAN_ECKAEG_CORE_H__
|
||||
|
||||
#include <botan/eckaeg_op.h>
|
||||
#include <botan/blinding.h>
|
||||
#include <botan/ec_dompar.h>
|
||||
|
||||
namespace Botan {
|
||||
|
||||
/*
|
||||
* ECKAEG Core
|
||||
*/
|
||||
class BOTAN_DLL ECKAEG_Core
|
||||
{
|
||||
public:
|
||||
SecureVector<byte> agree(const PointGFp&) const;
|
||||
|
||||
ECKAEG_Core& operator=(const ECKAEG_Core&);
|
||||
|
||||
ECKAEG_Core() { op = 0; }
|
||||
|
||||
ECKAEG_Core(const ECKAEG_Core&);
|
||||
|
||||
ECKAEG_Core(const EC_Domain_Params& dom_pars,
|
||||
const BigInt& priv_key,
|
||||
PointGFp const& pub_key);
|
||||
|
||||
~ECKAEG_Core() { delete op; }
|
||||
private:
|
||||
ECKAEG_Operation* op;
|
||||
Blinder blinder;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
49
src/libs/3rdparty/botan/build/botan/eckaeg_op.h
vendored
Normal file
49
src/libs/3rdparty/botan/build/botan/eckaeg_op.h
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* ECKAEG Operations
|
||||
* (C) 1999-2008 Jack Lloyd
|
||||
* 2007 FlexSecure GmbH
|
||||
*
|
||||
* Distributed under the terms of the Botan license
|
||||
*/
|
||||
|
||||
#ifndef BOTAN_ECKAEG_OPERATIONS_H__
|
||||
#define BOTAN_ECKAEG_OPERATIONS_H__
|
||||
|
||||
#include <botan/ec_dompar.h>
|
||||
|
||||
namespace Botan {
|
||||
|
||||
/*
|
||||
* ECKAEG Operation
|
||||
*/
|
||||
class BOTAN_DLL ECKAEG_Operation
|
||||
{
|
||||
public:
|
||||
virtual SecureVector<byte> agree(const PointGFp&) const = 0;
|
||||
virtual ECKAEG_Operation* clone() const = 0;
|
||||
virtual ~ECKAEG_Operation() {}
|
||||
};
|
||||
|
||||
/*
|
||||
* Default ECKAEG operation
|
||||
*/
|
||||
class BOTAN_DLL Default_ECKAEG_Op : public ECKAEG_Operation
|
||||
{
|
||||
public:
|
||||
SecureVector<byte> agree(const PointGFp& i) const;
|
||||
|
||||
ECKAEG_Operation* clone() const { return new Default_ECKAEG_Op(*this); }
|
||||
|
||||
Default_ECKAEG_Op(const EC_Domain_Params& dom_pars,
|
||||
const BigInt& priv_key,
|
||||
const PointGFp& pub_key);
|
||||
private:
|
||||
EC_Domain_Params m_dom_pars;
|
||||
PointGFp m_pub_key;
|
||||
BigInt m_priv_key;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
53
src/libs/3rdparty/botan/build/botan/es_dev.h
vendored
Normal file
53
src/libs/3rdparty/botan/build/botan/es_dev.h
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* /dev/random EntropySource
|
||||
* (C) 1999-2009 Jack Lloyd
|
||||
*
|
||||
* Distributed under the terms of the Botan license
|
||||
*/
|
||||
|
||||
#ifndef BOTAN_ENTROPY_SRC_DEVICE_H__
|
||||
#define BOTAN_ENTROPY_SRC_DEVICE_H__
|
||||
|
||||
#include <botan/entropy_src.h>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
namespace Botan {
|
||||
|
||||
class BOTAN_DLL Device_EntropySource : public EntropySource
|
||||
{
|
||||
public:
|
||||
std::string name() const { return "RNG Device Reader"; }
|
||||
|
||||
void poll(Entropy_Accumulator& accum);
|
||||
|
||||
Device_EntropySource(const std::vector<std::string>& fsnames);
|
||||
~Device_EntropySource();
|
||||
private:
|
||||
|
||||
/**
|
||||
A class handling reading from a Unix character device
|
||||
*/
|
||||
class Device_Reader
|
||||
{
|
||||
public:
|
||||
typedef int fd_type;
|
||||
|
||||
// Does not own fd, a transient class
|
||||
Device_Reader(fd_type device_fd) : fd(device_fd) {}
|
||||
|
||||
void close();
|
||||
|
||||
u32bit get(byte out[], u32bit length, u32bit ms_wait_time);
|
||||
|
||||
static fd_type open(const std::string& pathname);
|
||||
private:
|
||||
fd_type fd;
|
||||
};
|
||||
|
||||
std::vector<Device_Reader> devices;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
49
src/libs/3rdparty/botan/build/botan/es_egd.h
vendored
Normal file
49
src/libs/3rdparty/botan/build/botan/es_egd.h
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
/**
|
||||
* EGD EntropySource
|
||||
* (C) 1999-2007 Jack Lloyd
|
||||
*
|
||||
* Distributed under the terms of the Botan license
|
||||
*/
|
||||
|
||||
#ifndef BOTAN_ENTROPY_SRC_EGD_H__
|
||||
#define BOTAN_ENTROPY_SRC_EGD_H__
|
||||
|
||||
#include <botan/entropy_src.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace Botan {
|
||||
|
||||
/**
|
||||
* EGD Entropy Source
|
||||
*/
|
||||
class BOTAN_DLL EGD_EntropySource : public EntropySource
|
||||
{
|
||||
public:
|
||||
std::string name() const { return "EGD/PRNGD"; }
|
||||
|
||||
void poll(Entropy_Accumulator& accum);
|
||||
|
||||
EGD_EntropySource(const std::vector<std::string>&);
|
||||
~EGD_EntropySource();
|
||||
private:
|
||||
class EGD_Socket
|
||||
{
|
||||
public:
|
||||
EGD_Socket(const std::string& path);
|
||||
|
||||
void close();
|
||||
u32bit read(byte outbuf[], u32bit length);
|
||||
private:
|
||||
static int open_socket(const std::string& path);
|
||||
|
||||
std::string socket_path;
|
||||
int m_fd; // cached fd
|
||||
};
|
||||
|
||||
std::vector<EGD_Socket> sockets;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
42
src/libs/3rdparty/botan/build/botan/es_ftw.h
vendored
Normal file
42
src/libs/3rdparty/botan/build/botan/es_ftw.h
vendored
Normal file
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* File Tree Walking EntropySource
|
||||
* (C) 1999-2008 Jack Lloyd
|
||||
*
|
||||
* Distributed under the terms of the Botan license
|
||||
*/
|
||||
|
||||
#ifndef BOTAN_ENTROPY_SRC_FTW_H__
|
||||
#define BOTAN_ENTROPY_SRC_FTW_H__
|
||||
|
||||
#include <botan/entropy_src.h>
|
||||
|
||||
namespace Botan {
|
||||
|
||||
/**
|
||||
* File Tree Walking Entropy Source
|
||||
*/
|
||||
class BOTAN_DLL FTW_EntropySource : public EntropySource
|
||||
{
|
||||
public:
|
||||
std::string name() const { return "Proc Walker"; }
|
||||
|
||||
void poll(Entropy_Accumulator& accum);
|
||||
|
||||
FTW_EntropySource(const std::string& root_dir);
|
||||
~FTW_EntropySource();
|
||||
|
||||
class File_Descriptor_Source
|
||||
{
|
||||
public:
|
||||
virtual int next_fd() = 0;
|
||||
virtual ~File_Descriptor_Source() {}
|
||||
};
|
||||
private:
|
||||
|
||||
std::string path;
|
||||
File_Descriptor_Source* dir;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
39
src/libs/3rdparty/botan/build/botan/es_unix.h
vendored
Normal file
39
src/libs/3rdparty/botan/build/botan/es_unix.h
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Unix EntropySource
|
||||
* (C) 1999-2009 Jack Lloyd
|
||||
*
|
||||
* Distributed under the terms of the Botan license
|
||||
*/
|
||||
|
||||
#ifndef BOTAN_ENTROPY_SRC_UNIX_H__
|
||||
#define BOTAN_ENTROPY_SRC_UNIX_H__
|
||||
|
||||
#include <botan/entropy_src.h>
|
||||
#include <botan/unix_cmd.h>
|
||||
#include <vector>
|
||||
|
||||
namespace Botan {
|
||||
|
||||
/**
|
||||
* Unix Entropy Source
|
||||
*/
|
||||
class BOTAN_DLL Unix_EntropySource : public EntropySource
|
||||
{
|
||||
public:
|
||||
std::string name() const { return "Unix Entropy Source"; }
|
||||
|
||||
void poll(Entropy_Accumulator& accum);
|
||||
|
||||
void add_sources(const Unix_Program[], u32bit);
|
||||
Unix_EntropySource(const std::vector<std::string>& path);
|
||||
private:
|
||||
static void add_default_sources(std::vector<Unix_Program>&);
|
||||
void fast_poll(Entropy_Accumulator& accum);
|
||||
|
||||
const std::vector<std::string> PATH;
|
||||
std::vector<Unix_Program> sources;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
23
src/libs/3rdparty/botan/build/botan/fd_unix.h
vendored
Normal file
23
src/libs/3rdparty/botan/build/botan/fd_unix.h
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Pipe I/O for Unix
|
||||
* (C) 1999-2007 Jack Lloyd
|
||||
*
|
||||
* Distributed under the terms of the Botan license
|
||||
*/
|
||||
|
||||
#ifndef BOTAN_PIPE_UNIXFD_H__
|
||||
#define BOTAN_PIPE_UNIXFD_H__
|
||||
|
||||
#include <botan/pipe.h>
|
||||
|
||||
namespace Botan {
|
||||
|
||||
/*
|
||||
* Unix I/O Operators for Pipe
|
||||
*/
|
||||
int operator<<(int, Pipe&);
|
||||
int operator>>(int, Pipe&);
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
85
src/libs/3rdparty/botan/build/botan/freestore.h
vendored
Normal file
85
src/libs/3rdparty/botan/build/botan/freestore.h
vendored
Normal file
@@ -0,0 +1,85 @@
|
||||
/**
|
||||
* (C) 2007 Christoph Ludwig
|
||||
* ludwig@fh-worms.de
|
||||
**/
|
||||
|
||||
#ifndef BOTAN_FREESTORE_H__
|
||||
#define BOTAN_FREESTORE_H__
|
||||
|
||||
#include <botan/build.h>
|
||||
|
||||
#if defined(BOTAN_USE_STD_TR1)
|
||||
#include <tr1/memory>
|
||||
#elif defined(BOTAN_USE_BOOST_TR1)
|
||||
#include <boost/tr1/memory.hpp>
|
||||
#else
|
||||
#error "Please choose a TR1 implementation in build.h"
|
||||
#endif
|
||||
|
||||
namespace Botan {
|
||||
|
||||
/**
|
||||
* This class is intended as an function call parameter type and
|
||||
* enables convenient automatic conversions between plain and smart
|
||||
* pointer types. It internally stores a SharedPointer which can be
|
||||
* accessed.
|
||||
*
|
||||
* Distributed under the terms of the Botan license
|
||||
*/
|
||||
template<typename T>
|
||||
class BOTAN_DLL SharedPtrConverter
|
||||
{
|
||||
public:
|
||||
typedef std::tr1::shared_ptr<T> SharedPtr;
|
||||
|
||||
/**
|
||||
* Construct a null pointer equivalent object.
|
||||
*/
|
||||
SharedPtrConverter() : ptr() {}
|
||||
|
||||
/**
|
||||
* Copy constructor.
|
||||
*/
|
||||
SharedPtrConverter(SharedPtrConverter const& other) :
|
||||
ptr(other.ptr) {}
|
||||
|
||||
/**
|
||||
* Construct a converter object from another pointer type.
|
||||
* @param p the pointer which shall be set as the internally stored
|
||||
* pointer value of this converter.
|
||||
*/
|
||||
template<typename Ptr>
|
||||
SharedPtrConverter(Ptr p)
|
||||
: ptr(p) {}
|
||||
|
||||
/**
|
||||
* Get the internally stored shared pointer.
|
||||
* @return the internally stored shared pointer
|
||||
*/
|
||||
SharedPtr const& get_ptr() const { return this->ptr; }
|
||||
|
||||
/**
|
||||
* Get the internally stored shared pointer.
|
||||
* @return the internally stored shared pointer
|
||||
*/
|
||||
SharedPtr get_ptr() { return this->ptr; }
|
||||
|
||||
/**
|
||||
* Get the internally stored shared pointer.
|
||||
* @return the internally stored shared pointer
|
||||
*/
|
||||
SharedPtr const& get_shared() const { return this->ptr; }
|
||||
|
||||
/**
|
||||
* Get the internally stored shared pointer.
|
||||
* @return the internally stored shared pointer
|
||||
*/
|
||||
SharedPtr get_shared() { return this->ptr; }
|
||||
|
||||
private:
|
||||
SharedPtr ptr;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
311
src/libs/3rdparty/botan/build/botan/gfp_element.h
vendored
Normal file
311
src/libs/3rdparty/botan/build/botan/gfp_element.h
vendored
Normal file
@@ -0,0 +1,311 @@
|
||||
/******
|
||||
* Arithmetic for prime fields GF(p) (header file)
|
||||
*
|
||||
* (C) 2007 Martin Doering
|
||||
* doering@cdc.informatik.tu-darmstadt.de
|
||||
* Christoph Ludwig
|
||||
* ludwig@fh-worms.de
|
||||
* Falko Strenzke
|
||||
* strenzke@flexsecure.de
|
||||
******/
|
||||
|
||||
#ifndef BOTAN_GFP_ELEMENT_H__
|
||||
#define BOTAN_GFP_ELEMENT_H__
|
||||
|
||||
#include <botan/bigint.h>
|
||||
#include <botan/gfp_modulus.h>
|
||||
#include <iosfwd>
|
||||
|
||||
#if defined(BOTAN_USE_STD_TR1)
|
||||
#include <tr1/memory>
|
||||
#elif defined(BOTAN_USE_BOOST_TR1)
|
||||
#include <boost/tr1/memory.hpp>
|
||||
#else
|
||||
#error "Please choose a TR1 implementation in build.h"
|
||||
#endif
|
||||
|
||||
namespace Botan {
|
||||
|
||||
struct Illegal_Transformation : public Exception
|
||||
{
|
||||
Illegal_Transformation(const std::string& err =
|
||||
"Requested transformation is not possible")
|
||||
: Exception(err) {}
|
||||
};
|
||||
|
||||
/**
|
||||
* This class represents one element in GF(p). Enables the convenient,
|
||||
* transparent use of the montgomery multiplication.
|
||||
*/
|
||||
class BOTAN_DLL GFpElement
|
||||
{
|
||||
private:
|
||||
std::tr1::shared_ptr<GFpModulus> mp_mod;
|
||||
mutable BigInt m_value; // ordinary residue or m-residue respectively
|
||||
mutable BigInt workspace;
|
||||
|
||||
// *****************************************
|
||||
// data members for montgomery multiplication
|
||||
mutable bool m_use_montgm;
|
||||
//mutable BigInt m_mres;
|
||||
// this bool tells use whether the m_mres carries
|
||||
// the actual value (in this case mValue doesn´t)
|
||||
mutable bool m_is_trf;
|
||||
|
||||
void ensure_montgm_precomp() const;
|
||||
void trf_to_mres() const;
|
||||
void trf_to_ordres() const;
|
||||
|
||||
public:
|
||||
|
||||
/** construct an element of GF(p) with the given value.
|
||||
* use_montg defaults to false and determines wether Montgomery
|
||||
* multiplications will be use when applying operators *, *=
|
||||
* @param p the prime number of the field
|
||||
* @param value the element value
|
||||
* @param use_montgm whether this object will use Montgomery multiplication
|
||||
*/
|
||||
explicit GFpElement (const BigInt& p, const BigInt& value, bool use_montgm = false);
|
||||
|
||||
|
||||
/** construct an element of GF(p) with the given value (defaults
|
||||
* to 0). use_montg defaults to false and determines wether
|
||||
* montgomery multiplications will be use when applying operators
|
||||
* '*' , '*='. Use this constructor for efficient use of
|
||||
* Montgomery multiplication in a context with a fixed a modulus.
|
||||
* Warning: do not use this function unless you know in detail
|
||||
* about the implications of using the shared GFpModulus objects!
|
||||
* @param mod shared pointer to the GFpModulus to be shared
|
||||
* @param value the element value
|
||||
* @param use_montgm whether this object will use Montgomery multiplication
|
||||
*/
|
||||
explicit GFpElement(std::tr1::shared_ptr<GFpModulus> const mod,
|
||||
const BigInt& value, bool use_mongm = false);
|
||||
|
||||
/**
|
||||
* Copy constructor
|
||||
* @param other The element to clone
|
||||
*/
|
||||
GFpElement(const GFpElement& other);
|
||||
|
||||
/**
|
||||
* Assignment operator.
|
||||
* makes *this a totally independent object
|
||||
* (gives *this independent modulus specific values).
|
||||
|
||||
* @param other The element to assign to our object
|
||||
*/
|
||||
const GFpElement& operator=(const GFpElement& other);
|
||||
|
||||
/**
|
||||
* Works like the assignment operator, but lets
|
||||
* *this share the modulus dependend value with other.
|
||||
* Warning: do not use this function unless you know in detail about
|
||||
* the implications of using
|
||||
* the shared GFpModulus objects!
|
||||
* @param other The element to assign to our object
|
||||
*/
|
||||
void share_assign(const GFpElement& other);
|
||||
|
||||
/**
|
||||
* Switch Montgomery multiplcation optimizations ON
|
||||
*/
|
||||
void turn_on_sp_red_mul() const;
|
||||
|
||||
/**
|
||||
* Switch Montgomery multiplcation optimizations OFF
|
||||
*/
|
||||
void turn_off_sp_red_mul() const;
|
||||
|
||||
/**
|
||||
* += Operator
|
||||
* @param rhs the GFpElement to add to the local value
|
||||
* @result *this
|
||||
*/
|
||||
GFpElement& operator+=(const GFpElement& rhs);
|
||||
|
||||
/**
|
||||
* -= Operator
|
||||
* @param rhs the GFpElement to subtract from the local value
|
||||
* @result *this
|
||||
*/
|
||||
GFpElement& operator-=(const GFpElement& rhs);
|
||||
|
||||
/**
|
||||
* *= Operator
|
||||
* @param rhs the GFpElement to multiply with the local value
|
||||
* @result *this
|
||||
*/
|
||||
GFpElement& operator*=(const GFpElement& rhs);
|
||||
/**
|
||||
* /= Operator
|
||||
* @param rhs the GFpElement to divide the local value by
|
||||
* @result *this
|
||||
*/
|
||||
GFpElement& operator/=(const GFpElement& rhs);
|
||||
|
||||
/**
|
||||
* *= Operator
|
||||
* @param rhs the value to multiply with the local value
|
||||
* @result *this
|
||||
*/
|
||||
GFpElement& operator*= (u32bit rhs);
|
||||
|
||||
/**
|
||||
* Negate internal value(*this *= -1 )
|
||||
* @return *this
|
||||
*/
|
||||
GFpElement& negate();
|
||||
|
||||
/**
|
||||
* Assigns the inverse of *this to *this, i.e.
|
||||
* *this = (*this)^(-1)
|
||||
* @result *this
|
||||
*/
|
||||
GFpElement& inverse_in_place();
|
||||
|
||||
/**
|
||||
* checks whether the value is zero (without provoking
|
||||
* a backtransformation to the ordinary-residue)
|
||||
* @result true, if the value is zero, false otherwise.
|
||||
*/
|
||||
bool is_zero();
|
||||
|
||||
/**
|
||||
* return prime number of GF(p)
|
||||
* @result a prime number
|
||||
*/
|
||||
const BigInt& get_p() const;
|
||||
|
||||
/**
|
||||
* Return the represented value in GF(p)
|
||||
* @result The value in GF(p)
|
||||
*/
|
||||
const BigInt& get_value() const;
|
||||
|
||||
/**
|
||||
* Returns the shared pointer to the GFpModulus of *this.
|
||||
* Warning: do not use this function unless you know in detail about
|
||||
* the implications of using
|
||||
* the shared GFpModulus objects!
|
||||
* @result the shared pointer to the GFpModulus of *this
|
||||
*/
|
||||
inline std::tr1::shared_ptr<GFpModulus> const get_ptr_mod() const
|
||||
{
|
||||
return mp_mod;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the shared pointer to the GFpModulus of *this.
|
||||
* Warning: do not use this function unless you know in detail about
|
||||
* the implications of using
|
||||
* the shared GFpModulus objects!
|
||||
* @param mod a shared pointer to a GFpModulus that will be held in *this
|
||||
*/
|
||||
void set_shrd_mod(std::tr1::shared_ptr<GFpModulus> const mod);
|
||||
|
||||
/**
|
||||
* Tells whether this GFpElement is currently transformed to it´ m-residue,
|
||||
* i.e. in the form x_bar = x * r mod m.
|
||||
* @result true if it is currently transformed to it´s m-residue.
|
||||
*/
|
||||
bool is_trf_to_mres() const;
|
||||
|
||||
/**
|
||||
* Transforms this to x_bar = x * r mod m
|
||||
* @result return the value x_bar.
|
||||
*/
|
||||
const BigInt& get_mres() const;
|
||||
|
||||
/**
|
||||
* Check, if montgomery multiplication is used.
|
||||
* @result true, if montgomery multiplication is used, false otherwise
|
||||
*/
|
||||
bool is_use_montgm() const
|
||||
{
|
||||
return m_use_montgm;
|
||||
}
|
||||
|
||||
/**
|
||||
* Transforms the arguments in such way that either both
|
||||
* are in m-residue representation (returns true) or both are
|
||||
* in ordinary residue representation (returns false).
|
||||
* m-residue is prefered in case of ambiguity.
|
||||
* does not toggle m_use_montgm of the arguments.
|
||||
* Don´t be confused about the constness of the arguments:
|
||||
* the transformation between normal residue and m-residue is
|
||||
* considered as leaving the object const.
|
||||
* @param lhs the first operand to be aligned
|
||||
* @param rhs the second operand to be aligned
|
||||
* @result true if both are transformed to their m-residue,
|
||||
* false it both are transformed to their normal residue.
|
||||
*/
|
||||
static bool align_operands_res(const GFpElement& lhs, const GFpElement& rhs);
|
||||
|
||||
//friend declarations for non-member functions
|
||||
|
||||
/**
|
||||
* write a GFpElement to an output stream.
|
||||
* @param output the output stream to write to
|
||||
* @param elem the object to write
|
||||
* @result the output stream
|
||||
*/
|
||||
friend std::ostream& operator<<(std::ostream& output, const GFpElement& elem);
|
||||
|
||||
friend class Point_Coords_GFp;
|
||||
|
||||
/**
|
||||
* swaps the states of *this and other, does not throw!
|
||||
* @param other The value to swap with
|
||||
*/
|
||||
void swap(GFpElement& other);
|
||||
|
||||
};
|
||||
|
||||
// relational operators
|
||||
bool operator==(const GFpElement& lhs, const GFpElement& rhs);
|
||||
inline bool operator!=(const GFpElement& lhs, const GFpElement& rhs )
|
||||
{
|
||||
return !operator==(lhs, rhs);
|
||||
}
|
||||
|
||||
// arithmetic operators
|
||||
GFpElement operator+(const GFpElement& lhs, const GFpElement& rhs);
|
||||
GFpElement operator-(const GFpElement& lhs, const GFpElement& rhs);
|
||||
GFpElement operator-(const GFpElement& lhs);
|
||||
|
||||
GFpElement operator*(const GFpElement& lhs, const GFpElement& rhs);
|
||||
GFpElement operator/(const GFpElement& lhs, const GFpElement& rhs);
|
||||
GFpElement operator* (const GFpElement& lhs, u32bit rhs);
|
||||
GFpElement operator* (u32bit rhs, const GFpElement& lhs);
|
||||
|
||||
// io operators
|
||||
std::ostream& operator<<(std::ostream& output, const GFpElement& elem);
|
||||
|
||||
// return (*this)^(-1)
|
||||
GFpElement inverse(const GFpElement& elem);
|
||||
|
||||
// encoding and decoding
|
||||
SecureVector<byte> FE2OSP(const GFpElement& elem);
|
||||
GFpElement OS2FEP(MemoryRegion<byte> const& os, BigInt p);
|
||||
|
||||
inline void swap(GFpElement& x, GFpElement& y)
|
||||
{
|
||||
x.swap(y);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
namespace std {
|
||||
|
||||
template<> inline
|
||||
void swap<Botan::GFpElement>(Botan::GFpElement& x,
|
||||
Botan::GFpElement& y)
|
||||
{
|
||||
x.swap(y);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
127
src/libs/3rdparty/botan/build/botan/gfp_modulus.h
vendored
Normal file
127
src/libs/3rdparty/botan/build/botan/gfp_modulus.h
vendored
Normal file
@@ -0,0 +1,127 @@
|
||||
/******
|
||||
* Modulus and related data for a specific
|
||||
* implementation of GF(p) (header file)
|
||||
*
|
||||
* (C) 2008 Martin Döring
|
||||
* doering@cdc.informatik.tu-darmstadt.de
|
||||
* Christoph Ludwig
|
||||
* ludwig@fh-worms.de
|
||||
* Falko Strenzke
|
||||
* strenzke@flexsecure.de
|
||||
******/
|
||||
|
||||
#ifndef BOTAN_GFP_MODULUS_H__
|
||||
#define BOTAN_GFP_MODULUS_H__
|
||||
|
||||
#include <botan/bigint.h>
|
||||
|
||||
namespace Botan
|
||||
{
|
||||
|
||||
class BOTAN_DLL GFpElement;
|
||||
/**
|
||||
* This class represents a GFpElement modulus including the modulus related
|
||||
* values necessary for the montgomery multiplication.
|
||||
*
|
||||
* Distributed under the terms of the Botan license
|
||||
*/
|
||||
class BOTAN_DLL GFpModulus
|
||||
{
|
||||
friend class GFpElement;
|
||||
private:
|
||||
BigInt m_p; // the modulus itself
|
||||
mutable BigInt m_p_dash;
|
||||
mutable BigInt m_r;
|
||||
mutable BigInt m_r_inv;
|
||||
public:
|
||||
|
||||
/**
|
||||
* Construct a GF(P)-Modulus from a BigInt
|
||||
*/
|
||||
GFpModulus(BigInt p)
|
||||
: m_p(p),
|
||||
m_p_dash(),
|
||||
m_r(),
|
||||
m_r_inv()
|
||||
{}
|
||||
|
||||
/**
|
||||
* Tells whether the precomputations necessary for the use of the
|
||||
* montgomery multiplication have yet been established.
|
||||
* @result true if the precomputated value are already available.
|
||||
*/
|
||||
inline bool has_precomputations() const
|
||||
{
|
||||
return(!m_p_dash.is_zero() && !m_r.is_zero() && !m_r_inv.is_zero());
|
||||
}
|
||||
|
||||
/**
|
||||
* Swaps this with another GFpModulus, does not throw.
|
||||
* @param other the GFpModulus to swap *this with.
|
||||
*/
|
||||
inline void swap(GFpModulus& other)
|
||||
{
|
||||
m_p.swap(other.m_p);
|
||||
m_p_dash.swap(other.m_p_dash);
|
||||
m_r.swap(other.m_r);
|
||||
m_r_inv.swap(other.m_r_inv);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tells whether the modulus of *this is equal to the argument.
|
||||
* @param mod the modulus to compare this with
|
||||
* @result true if the modulus of *this and the argument are equal.
|
||||
*/
|
||||
inline bool p_equal_to(const BigInt& mod) const
|
||||
{
|
||||
return (m_p == mod);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the modulus of this GFpModulus.
|
||||
* @result the modulus of *this.
|
||||
*/
|
||||
inline const BigInt& get_p() const
|
||||
{
|
||||
return m_p;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns the montgomery multiplication related value r.
|
||||
* Warning: will be zero if precomputations have not yet been
|
||||
* performed!
|
||||
* @result r
|
||||
*/
|
||||
inline const BigInt& get_r() const
|
||||
{
|
||||
return m_r;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns the montgomery multiplication related value r^{-1}.
|
||||
* Warning: will be zero if precomputations have not yet been
|
||||
* performed!
|
||||
* @result r^{-1}
|
||||
*/
|
||||
inline const BigInt& get_r_inv() const
|
||||
{
|
||||
return m_r_inv;
|
||||
}
|
||||
|
||||
/**
|
||||
* returns the montgomery multiplication related value p'.
|
||||
* Warning: will be zero if precomputations have not yet been
|
||||
* performed!
|
||||
* @result p'
|
||||
*/
|
||||
inline const BigInt& get_p_dash() const
|
||||
{
|
||||
return m_p_dash;
|
||||
}
|
||||
// default cp-ctor, op= are fine
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
30
src/libs/3rdparty/botan/build/botan/mmap_mem.h
vendored
Normal file
30
src/libs/3rdparty/botan/build/botan/mmap_mem.h
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
/*
|
||||
* Memory Mapping Allocator
|
||||
* (C) 1999-2007 Jack Lloyd
|
||||
*
|
||||
* Distributed under the terms of the Botan license
|
||||
*/
|
||||
|
||||
#ifndef BOTAN_MMAP_ALLOCATOR_H__
|
||||
#define BOTAN_MMAP_ALLOCATOR_H__
|
||||
|
||||
#include <botan/mem_pool.h>
|
||||
|
||||
namespace Botan {
|
||||
|
||||
/*
|
||||
* Memory Mapping Allocator
|
||||
*/
|
||||
class BOTAN_DLL MemoryMapping_Allocator : public Pooling_Allocator
|
||||
{
|
||||
public:
|
||||
MemoryMapping_Allocator(Mutex* m) : Pooling_Allocator(m) {}
|
||||
std::string type() const { return "mmap"; }
|
||||
private:
|
||||
void* alloc_block(u32bit);
|
||||
void dealloc_block(void*, u32bit);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
26
src/libs/3rdparty/botan/build/botan/mux_pthr.h
vendored
Normal file
26
src/libs/3rdparty/botan/build/botan/mux_pthr.h
vendored
Normal file
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Pthread Mutex
|
||||
* (C) 1999-2007 Jack Lloyd
|
||||
*
|
||||
* Distributed under the terms of the Botan license
|
||||
*/
|
||||
|
||||
#ifndef BOTAN_MUTEX_PTHREAD_H__
|
||||
#define BOTAN_MUTEX_PTHREAD_H__
|
||||
|
||||
#include <botan/mutex.h>
|
||||
|
||||
namespace Botan {
|
||||
|
||||
/*
|
||||
* Pthread Mutex Factory
|
||||
*/
|
||||
class BOTAN_DLL Pthread_Mutex_Factory : public Mutex_Factory
|
||||
{
|
||||
public:
|
||||
Mutex* make();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
315
src/libs/3rdparty/botan/build/botan/point_gfp.h
vendored
Normal file
315
src/libs/3rdparty/botan/build/botan/point_gfp.h
vendored
Normal file
@@ -0,0 +1,315 @@
|
||||
/*
|
||||
* Arithmetic over GF(p)
|
||||
*
|
||||
* (C) 2007 Martin Doering
|
||||
* Christoph Ludwig
|
||||
* Falko Strenzke
|
||||
* (C) 2008 Jack Lloyd
|
||||
*
|
||||
* Distributed under the terms of the Botan license
|
||||
*/
|
||||
|
||||
#ifndef BOTAN_POINT_GFP_H__
|
||||
#define BOTAN_POINT_GFP_H__
|
||||
|
||||
#include <botan/curve_gfp.h>
|
||||
#include <botan/gfp_element.h>
|
||||
#include <botan/bigint.h>
|
||||
#include <botan/exceptn.h>
|
||||
#include <vector>
|
||||
|
||||
namespace Botan {
|
||||
|
||||
struct Illegal_Point : public Exception
|
||||
{
|
||||
Illegal_Point(const std::string& err = "") : Exception(err) {}
|
||||
};
|
||||
|
||||
/**
|
||||
* This class represents one point on a curve of GF(p).
|
||||
*/
|
||||
class BOTAN_DLL PointGFp
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* uncompressed encoding byte value
|
||||
*/
|
||||
static const int UNCOMPRESSED = 0;
|
||||
|
||||
/**
|
||||
* compressed encoding byte value
|
||||
*/
|
||||
static const int COMPRESSED = 1;
|
||||
|
||||
/**
|
||||
* hybrid encoding byte value
|
||||
*/
|
||||
static const int HYBRID = 2;
|
||||
|
||||
/**
|
||||
* Construct the point O
|
||||
* @param curve The base curve
|
||||
*/
|
||||
explicit PointGFp(const CurveGFp& curve);
|
||||
|
||||
/**
|
||||
* Construct a point given its affine coordinates
|
||||
* @param curve the base curve
|
||||
* @param x affine x coordinate
|
||||
* @param y affine y coordinate
|
||||
*/
|
||||
explicit PointGFp(const CurveGFp& curve, GFpElement const& x,
|
||||
GFpElement const& y);
|
||||
|
||||
/**
|
||||
* Construct a point given its jacobian projective coordinates
|
||||
* @param curve the base curve
|
||||
* @param x jacobian projective x coordinate
|
||||
* @param y jacobian projective y coordinate
|
||||
* @param z jacobian projective y coordinate
|
||||
*/
|
||||
explicit PointGFp(const CurveGFp& curve, GFpElement const& x,
|
||||
GFpElement const& y, GFpElement const& z);
|
||||
|
||||
/**
|
||||
* copy constructor
|
||||
* @param other the value to clone
|
||||
*/
|
||||
PointGFp(const PointGFp& other);
|
||||
|
||||
/**
|
||||
* assignment operator
|
||||
* @param other The point to use as source for the assignment
|
||||
*/
|
||||
const PointGFp& operator=(const PointGFp& other);
|
||||
|
||||
/**
|
||||
* assign another point which is on the same curve as *this
|
||||
* @param other The point to use as source for the assignment
|
||||
*/
|
||||
const PointGFp& assign_within_same_curve(const PointGFp& other);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* += Operator
|
||||
* @param rhs the PointGFp to add to the local value
|
||||
* @result resulting PointGFp
|
||||
*/
|
||||
PointGFp& operator+=(const PointGFp& rhs);
|
||||
|
||||
/**
|
||||
* -= Operator
|
||||
* @param rhs the PointGFp to subtract from the local value
|
||||
* @result resulting PointGFp
|
||||
*/
|
||||
PointGFp& operator-=(const PointGFp& rhs);
|
||||
|
||||
/**
|
||||
* *= Operator
|
||||
* This function turns on the the special reduction multiplication
|
||||
* itself for fast computation, turns it off again when finished.
|
||||
* @param scalar the PointGFp to multiply with *this
|
||||
* @result resulting PointGFp
|
||||
*/
|
||||
PointGFp& operator*=(const BigInt& scalar);
|
||||
|
||||
/**
|
||||
* the equivalent to operator*= with countermeasures against
|
||||
* sidechannel attacks, using the randomized exponent
|
||||
* and add-and-double-always
|
||||
* countermeasures (suitable for ECDSA and ECKAEG)
|
||||
* @param scalar the scalar to multiply the point with
|
||||
* @param point_order a multiple of the order of the point
|
||||
*(= n * k in the general case; k is the cofactor)
|
||||
* @param max_secr the maximal size of the scalar
|
||||
* (will usually be n-1 )
|
||||
* @result resulting PointGFp
|
||||
*/
|
||||
PointGFp& mult_this_secure(const BigInt& scalar,
|
||||
const BigInt& point_order,
|
||||
const BigInt& max_secr
|
||||
);
|
||||
|
||||
/**
|
||||
* Negate internal value(*this *= -1 )
|
||||
* @return *this
|
||||
*/
|
||||
PointGFp& negate();
|
||||
|
||||
/**
|
||||
* Multiply the point by two(*this *= 2 )
|
||||
* @return *this
|
||||
*/
|
||||
PointGFp& mult2_in_place();
|
||||
|
||||
/**
|
||||
* Set z coordinate to one.
|
||||
* @return *this
|
||||
*/
|
||||
const PointGFp& set_z_to_one() const;
|
||||
|
||||
/**
|
||||
* Turn on the special reduction multiplication (i.e. the
|
||||
* Montgomery multiplication in the current implementation) for
|
||||
* the coordinates. This enables fast execution of mult2_in_place()
|
||||
* and operator+=().
|
||||
*/
|
||||
void turn_on_sp_red_mul() const;
|
||||
|
||||
/**
|
||||
* Return a point
|
||||
* where the coordinates are transformed
|
||||
* so that z equals one,
|
||||
* thus x and y have just the affine values.
|
||||
* @result *this
|
||||
*/
|
||||
PointGFp const get_z_to_one() const;
|
||||
|
||||
/**
|
||||
* Return base curve of this point
|
||||
* @result the curve over GF(p) of this point
|
||||
*/
|
||||
CurveGFp const get_curve() const;
|
||||
|
||||
/**
|
||||
* get affine x coordinate
|
||||
* @result affine x coordinate
|
||||
*/
|
||||
GFpElement const get_affine_x() const;
|
||||
|
||||
/**
|
||||
* get affine y coordinate
|
||||
* @result affine y coordinate
|
||||
*/
|
||||
GFpElement const get_affine_y() const;
|
||||
|
||||
/**
|
||||
* get the jacobian projective x coordinate
|
||||
* @result jacobian projective x coordinate
|
||||
*/
|
||||
GFpElement const get_jac_proj_x() const;
|
||||
|
||||
/**
|
||||
* get the jacobian projective y coordinate
|
||||
* @result jacobian projective y coordinate
|
||||
*/
|
||||
GFpElement const get_jac_proj_y() const;
|
||||
|
||||
/**
|
||||
* get the jacobian projective z coordinate
|
||||
* @result jacobian projective z coordinate
|
||||
*/
|
||||
GFpElement const get_jac_proj_z() const;
|
||||
|
||||
/**
|
||||
* Is this the point at infinity?
|
||||
* @result true, if this point is at infinity, false otherwise.
|
||||
*/
|
||||
bool is_zero() const;
|
||||
|
||||
/**
|
||||
* Checks whether the point is to be found on the underlying curve.
|
||||
* Throws an Invalid_Point exception in case of detecting that the point
|
||||
* does not satisfy the curve equation.
|
||||
* To be used to ensure against fault attacks.
|
||||
*/
|
||||
void check_invariants() const;
|
||||
|
||||
|
||||
/**
|
||||
* swaps the states of *this and other, does not throw!
|
||||
* @param other the object to swap values with
|
||||
*/
|
||||
void swap(PointGFp& other);
|
||||
|
||||
/**
|
||||
* Sets the shared pointer to the GFpModulus that will be
|
||||
* held in *this, specifically the various members of *this.
|
||||
* Warning: do not use this function unless you know in detail about
|
||||
* the implications of using
|
||||
* the shared GFpModulus objects!
|
||||
* Do NOT spread a shared pointer to GFpModulus over different
|
||||
* threads!
|
||||
* @param mod a shared pointer to a GFpModulus that will
|
||||
* be held in the members *this
|
||||
*/
|
||||
void set_shrd_mod(std::tr1::shared_ptr<GFpModulus> p_mod);
|
||||
|
||||
static GFpElement decompress(bool yMod2, GFpElement const& x, const CurveGFp& curve);
|
||||
|
||||
private:
|
||||
static const u32bit GFPEL_WKSP_SIZE = 9;
|
||||
void ensure_worksp() const;
|
||||
|
||||
inline std::tr1::shared_ptr<PointGFp> mult_loop(int l, const BigInt& m,
|
||||
std::tr1::shared_ptr<PointGFp> H,
|
||||
std::tr1::shared_ptr<PointGFp> tmp,
|
||||
const PointGFp& P);
|
||||
|
||||
CurveGFp mC;
|
||||
mutable GFpElement mX; // NOTE: these values must be mutable (affine<->proj)
|
||||
mutable GFpElement mY;
|
||||
mutable GFpElement mZ;
|
||||
mutable GFpElement mZpow2; // mZ^2
|
||||
mutable GFpElement mZpow3; // mZ^3
|
||||
mutable GFpElement mAZpow4; // mA*mZ^4
|
||||
mutable bool mZpow2_set;
|
||||
mutable bool mZpow3_set;
|
||||
mutable bool mAZpow4_set;
|
||||
mutable std::tr1::shared_ptr<std::vector<GFpElement> > mp_worksp_gfp_el;
|
||||
|
||||
};
|
||||
|
||||
// relational operators
|
||||
bool operator==(const PointGFp& lhs, const PointGFp& rhs);
|
||||
inline bool operator!=(const PointGFp& lhs, const PointGFp& rhs )
|
||||
{
|
||||
return !operator==(lhs, rhs);
|
||||
}
|
||||
|
||||
// arithmetic operators
|
||||
PointGFp operator+(const PointGFp& lhs, const PointGFp& rhs);
|
||||
PointGFp operator-(const PointGFp& lhs, const PointGFp& rhs);
|
||||
PointGFp operator-(const PointGFp& lhs);
|
||||
|
||||
PointGFp operator*(const BigInt& scalar, const PointGFp& point);
|
||||
PointGFp operator*(const PointGFp& point, const BigInt& scalar);
|
||||
PointGFp mult_point_secure(const PointGFp& point,
|
||||
const BigInt& scalar,
|
||||
const BigInt& point_order,
|
||||
const BigInt& max_secret);
|
||||
|
||||
PointGFp const mult2(const PointGFp& point);
|
||||
|
||||
PointGFp const create_random_point(RandomNumberGenerator& rng,
|
||||
const CurveGFp& curve);
|
||||
|
||||
// encoding and decoding
|
||||
SecureVector<byte> EC2OSP(const PointGFp& point, byte format);
|
||||
PointGFp OS2ECP(MemoryRegion<byte> const& os, const CurveGFp& curve);
|
||||
|
||||
SecureVector<byte> encode_uncompressed(const PointGFp& point); // maybe make private
|
||||
SecureVector<byte> encode_hybrid(const PointGFp& point); // maybe make private
|
||||
SecureVector<byte> encode_compressed(const PointGFp& point); // maybe make private
|
||||
|
||||
// swaps the states of point1 and point2, does not throw!
|
||||
// cf. Meyers, Item 25
|
||||
inline
|
||||
void swap(PointGFp& point1, PointGFp& point2 )
|
||||
{
|
||||
point1.swap(point2);
|
||||
}
|
||||
|
||||
} // namespace Botan
|
||||
|
||||
namespace std {
|
||||
|
||||
// swaps the states of point1 and point2, does not throw!
|
||||
// cf. Meyers, Item 25
|
||||
template<> inline void
|
||||
swap<Botan::PointGFp>(Botan::PointGFp& x, Botan::PointGFp& y) { x.swap(y); }
|
||||
|
||||
} // namespace std
|
||||
|
||||
#endif
|
||||
93
src/libs/3rdparty/botan/build/botan/signed_obj.h
vendored
Normal file
93
src/libs/3rdparty/botan/build/botan/signed_obj.h
vendored
Normal file
@@ -0,0 +1,93 @@
|
||||
/*
|
||||
* EAC SIGNED Object
|
||||
* (C) 2007 FlexSecure GmbH
|
||||
* 2008 Jack Lloyd
|
||||
*
|
||||
* Distributed under the terms of the Botan license
|
||||
*/
|
||||
|
||||
#ifndef BOTAN_EAC_SIGNED_OBJECT_H__
|
||||
#define BOTAN_EAC_SIGNED_OBJECT_H__
|
||||
|
||||
#include <botan/asn1_obj.h>
|
||||
#include <botan/pubkey_enums.h>
|
||||
#include <botan/freestore.h>
|
||||
#include <botan/pipe.h>
|
||||
#include <vector>
|
||||
|
||||
namespace Botan {
|
||||
|
||||
/**
|
||||
* This class represents abstract signed EAC object
|
||||
*/
|
||||
class BOTAN_DLL EAC_Signed_Object
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Get the TBS (to-be-signed) data in this object.
|
||||
* @return the DER encoded TBS data of this object
|
||||
*/
|
||||
virtual SecureVector<byte> tbs_data() const = 0;
|
||||
|
||||
/**
|
||||
* Get the signature of this object as a concatenation, i.e. if the
|
||||
* signature consists of multiple parts (like in the case of ECDSA)
|
||||
* these will be concatenated.
|
||||
* @return the signature as a concatenation of its parts
|
||||
*/
|
||||
|
||||
/*
|
||||
NOTE: this is here only because abstract signature objects have
|
||||
not yet been introduced
|
||||
*/
|
||||
virtual SecureVector<byte> get_concat_sig() const = 0;
|
||||
|
||||
/**
|
||||
* Get the signature algorithm identifier used to sign this object.
|
||||
* @result the signature algorithm identifier
|
||||
*/
|
||||
AlgorithmIdentifier signature_algorithm() const;
|
||||
|
||||
/**
|
||||
* Check the signature of this object.
|
||||
* @param key the public key associated with this signed object
|
||||
* @return true if the signature was created by the private key
|
||||
* associated with this public key
|
||||
*/
|
||||
virtual bool check_signature(class Public_Key&) const = 0;
|
||||
|
||||
/**
|
||||
* Write this object DER encoded into a specified pipe.
|
||||
* @param pipe the pipe to write the encoded object to
|
||||
* @param enc the encoding type to use
|
||||
*/
|
||||
virtual void encode(Pipe&, X509_Encoding = PEM) const = 0;
|
||||
|
||||
/**
|
||||
* BER encode this object.
|
||||
* @return the result containing the BER representation of this object.
|
||||
*/
|
||||
SecureVector<byte> BER_encode() const;
|
||||
|
||||
/**
|
||||
* PEM encode this object.
|
||||
* @return the result containing the PEM representation of this object.
|
||||
*/
|
||||
std::string PEM_encode() const;
|
||||
|
||||
virtual ~EAC_Signed_Object() {}
|
||||
protected:
|
||||
void do_decode();
|
||||
EAC_Signed_Object() {}
|
||||
|
||||
AlgorithmIdentifier sig_algo;
|
||||
SecureVector<byte> tbs_bits;
|
||||
std::string PEM_label_pref;
|
||||
std::vector<std::string> PEM_labels_allowed;
|
||||
private:
|
||||
virtual void force_decode() = 0;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
27
src/libs/3rdparty/botan/build/botan/tm_posix.h
vendored
Normal file
27
src/libs/3rdparty/botan/build/botan/tm_posix.h
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* POSIX Timer
|
||||
* (C) 1999-2007 Jack Lloyd
|
||||
*
|
||||
* Distributed under the terms of the Botan license
|
||||
*/
|
||||
|
||||
#ifndef BOTAN_TIMER_POSIX_H__
|
||||
#define BOTAN_TIMER_POSIX_H__
|
||||
|
||||
#include <botan/timer.h>
|
||||
|
||||
namespace Botan {
|
||||
|
||||
/*
|
||||
* POSIX Timer
|
||||
*/
|
||||
class BOTAN_DLL POSIX_Timer : public Timer
|
||||
{
|
||||
public:
|
||||
std::string name() const { return "POSIX clock_gettime"; }
|
||||
u64bit clock() const;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
27
src/libs/3rdparty/botan/build/botan/tm_unix.h
vendored
Normal file
27
src/libs/3rdparty/botan/build/botan/tm_unix.h
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Unix Timer
|
||||
* (C) 1999-2007 Jack Lloyd
|
||||
*
|
||||
* Distributed under the terms of the Botan license
|
||||
*/
|
||||
|
||||
#ifndef BOTAN_TIMER_UNIX_H__
|
||||
#define BOTAN_TIMER_UNIX_H__
|
||||
|
||||
#include <botan/timer.h>
|
||||
|
||||
namespace Botan {
|
||||
|
||||
/*
|
||||
* Unix Timer
|
||||
*/
|
||||
class BOTAN_DLL Unix_Timer : public Timer
|
||||
{
|
||||
public:
|
||||
std::string name() const { return "Unix gettimeofday"; }
|
||||
u64bit clock() const;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
59
src/libs/3rdparty/botan/build/botan/unix_cmd.h
vendored
Normal file
59
src/libs/3rdparty/botan/build/botan/unix_cmd.h
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
/**
|
||||
* Unix Command Execution
|
||||
* (C) 1999-2007 Jack Lloyd
|
||||
*
|
||||
* Distributed under the terms of the Botan license
|
||||
*/
|
||||
|
||||
#ifndef BOTAN_UNIX_CMD_H__
|
||||
#define BOTAN_UNIX_CMD_H__
|
||||
|
||||
#include <botan/types.h>
|
||||
#include <botan/data_src.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace Botan {
|
||||
|
||||
/**
|
||||
* Unix Program Info
|
||||
*/
|
||||
struct Unix_Program
|
||||
{
|
||||
Unix_Program(const char* n, u32bit p)
|
||||
{ name_and_args = n; priority = p; working = true; }
|
||||
|
||||
std::string name_and_args;
|
||||
u32bit priority;
|
||||
bool working;
|
||||
};
|
||||
|
||||
/**
|
||||
* Command Output DataSource
|
||||
*/
|
||||
class BOTAN_DLL DataSource_Command : public DataSource
|
||||
{
|
||||
public:
|
||||
u32bit read(byte[], u32bit);
|
||||
u32bit peek(byte[], u32bit, u32bit) const;
|
||||
bool end_of_data() const;
|
||||
std::string id() const;
|
||||
|
||||
int fd() const;
|
||||
|
||||
DataSource_Command(const std::string&,
|
||||
const std::vector<std::string>& paths);
|
||||
~DataSource_Command();
|
||||
private:
|
||||
void create_pipe(const std::vector<std::string>&);
|
||||
void shutdown_pipe();
|
||||
|
||||
const u32bit MAX_BLOCK_USECS, KILL_WAIT;
|
||||
|
||||
std::vector<std::string> arg_list;
|
||||
struct pipe_wrapper* pipe;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
112
src/libs/3rdparty/botan/src/src.pro
vendored
112
src/libs/3rdparty/botan/src/src.pro
vendored
@@ -17,6 +17,11 @@ win32 {
|
||||
DEFINES += BOTAN_DLL=__declspec(dllexport)
|
||||
}
|
||||
|
||||
unix {
|
||||
QMAKE_CFLAGS += -fPIC -ansi -fpermissive -finline-functions -Wno-long-long
|
||||
QMAKE_CXXFLAGS += -fPIC -ansi -fpermissive -finline-functions -Wno-long-long
|
||||
}
|
||||
|
||||
# Input
|
||||
HEADERS += algo_factory/algo_cache.h \
|
||||
algo_factory/algo_factory.h \
|
||||
@@ -80,9 +85,7 @@ HEADERS += algo_factory/algo_cache.h \
|
||||
cryptobox/cryptobox.h \
|
||||
engine/def_engine/def_eng.h \
|
||||
engine/engine.h \
|
||||
entropy/cryptoapi_rng/es_capi.h \
|
||||
entropy/entropy_src.h \
|
||||
entropy/win32_stats/es_win32.h \
|
||||
filters/basefilt.h \
|
||||
filters/buf_filt.h \
|
||||
filters/data_snk.h \
|
||||
@@ -154,7 +157,6 @@ HEADERS += algo_factory/algo_cache.h \
|
||||
modes/xts/xts.h \
|
||||
mutex/mutex.h \
|
||||
mutex/noop_mutex/mux_noop.h \
|
||||
mutex/win32_crit_section/mux_win32.h \
|
||||
pbe/get_pbe.h \
|
||||
pbe/pbes1/pbes1.h \
|
||||
pbe/pbes2/pbes2.h \
|
||||
@@ -215,7 +217,6 @@ HEADERS += algo_factory/algo_cache.h \
|
||||
sym_algo/sym_algo.h \
|
||||
sym_algo/symkey.h \
|
||||
timer/timer.h \
|
||||
timer/win32_query_perf_ctr/tm_win32.h \
|
||||
utils/bit_ops.h \
|
||||
utils/bswap.h \
|
||||
utils/buf_comp/buf_comp.h \
|
||||
@@ -233,6 +234,51 @@ HEADERS += algo_factory/algo_cache.h \
|
||||
utils/version.h \
|
||||
utils/xor_buf.h
|
||||
|
||||
win32 {
|
||||
HEADERS += entropy/cryptoapi_rng/es_capi.h \
|
||||
entropy/win32_stats/es_win32.h \
|
||||
mutex/win32_crit_section/mux_win32.h \
|
||||
timer/win32_query_perf_ctr/tm_win32.h
|
||||
}
|
||||
|
||||
unix {
|
||||
HEADERS += botan/curve_gfp.h \
|
||||
build.kh/botan/cvc_ado.h \
|
||||
build.kh/botan/cvc_ca.h \
|
||||
build.kh/botan/cvc_cert.h \
|
||||
build.kh/botan/cvc_gen_cert.h \
|
||||
build.kh/botan/cvc_key.h \
|
||||
build.kh/botan/cvc_req.h \
|
||||
build.kh/botan/cvc_self.h \
|
||||
build.kh/botan/eac_asn_obj.h \
|
||||
build.kh/botan/eac_obj.h \
|
||||
build.kh/botan/ecc_key.h \
|
||||
build.kh/botan/ec_dompar.h \
|
||||
build.kh/botan/ecdsa_core.h \
|
||||
build.kh/botan/ecdsa.h \
|
||||
build.kh/botan/ecdsa_op.h \
|
||||
build.kh/botan/ecdsa_sig.h \
|
||||
build.kh/botan/eckaeg_core.h \
|
||||
build.kh/botan/eckaeg.h \
|
||||
build.kh/botan/eckaeg_op.h \
|
||||
build.kh/botan/es_dev.h \
|
||||
build.kh/botan/es_egd.h \
|
||||
build.kh/botan/es_ftw.h \
|
||||
build.kh/botan/es_unix.h \
|
||||
build.kh/botan/fd_unix.h \
|
||||
build.kh/botan/freestore.h \
|
||||
build.kh/botan/gfp_element.h \
|
||||
build.kh/botan/gfp_modulus.h \
|
||||
build.kh/botan/mmap_mem.h \
|
||||
build.kh/botan/mux_pthr.h \
|
||||
build.kh/botan/point_gfp.h \
|
||||
build.kh/botan/signed_obj.h \
|
||||
build.kh/botan/tm_posix.h \
|
||||
build.kh/botan/tm_unix.h \
|
||||
build.kh/botan/unix_cmd.h
|
||||
}
|
||||
|
||||
|
||||
SOURCES += algo_factory/algo_factory.cpp \
|
||||
algo_factory/prov_weight.cpp \
|
||||
alloc/mem_pool/mem_pool.cpp \
|
||||
@@ -317,8 +363,6 @@ SOURCES += algo_factory/algo_factory.cpp \
|
||||
engine/def_engine/lookup_hash.cpp \
|
||||
engine/def_engine/lookup_mac.cpp \
|
||||
engine/def_engine/lookup_stream.cpp \
|
||||
entropy/cryptoapi_rng/es_capi.cpp \
|
||||
entropy/win32_stats/es_win32.cpp \
|
||||
filters/algo_filt.cpp \
|
||||
filters/basefilt.cpp \
|
||||
filters/buf_filt.cpp \
|
||||
@@ -408,7 +452,6 @@ SOURCES += algo_factory/algo_factory.cpp \
|
||||
modes/ofb/ofb.cpp \
|
||||
modes/xts/xts.cpp \
|
||||
mutex/noop_mutex/mux_noop.cpp \
|
||||
mutex/win32_crit_section/mux_win32.cpp \
|
||||
pbe/get_pbe.cpp \
|
||||
pbe/pbes1/pbes1.cpp \
|
||||
pbe/pbes2/pbes2.cpp \
|
||||
@@ -467,7 +510,6 @@ SOURCES += algo_factory/algo_factory.cpp \
|
||||
stream/wid_wake/wid_wake.cpp \
|
||||
sym_algo/symkey.cpp \
|
||||
timer/timer.cpp \
|
||||
timer/win32_query_perf_ctr/tm_win32.cpp \
|
||||
utils/charset.cpp \
|
||||
utils/datastor/datastor.cpp \
|
||||
utils/exceptn.cpp \
|
||||
@@ -476,3 +518,57 @@ SOURCES += algo_factory/algo_factory.cpp \
|
||||
utils/ui.cpp \
|
||||
utils/util.cpp \
|
||||
utils/version.cpp
|
||||
|
||||
win32 {
|
||||
SOURCES += entropy/cryptoapi_rng/es_capi.cpp \
|
||||
entropy/win32_stats/es_win32.cpp \
|
||||
mutex/win32_crit_section/mux_win32.cpp \
|
||||
timer/win32_query_perf_ctr/tm_win32.cpp
|
||||
}
|
||||
|
||||
unix {
|
||||
SOURCES += alloc/alloc_mmap/mmap_mem.cpp \
|
||||
cert/cvc/asn1_eac_str.cpp \
|
||||
cert/cvc/asn1_eac_tm.cpp \
|
||||
cert/cvc/cvc_ado.cpp \
|
||||
cert/cvc/cvc_ca.cpp \
|
||||
cert/cvc/cvc_cert.cpp \
|
||||
cert/cvc/cvc_req.cpp \
|
||||
cert/cvc/cvc_self.cpp \
|
||||
cert/cvc/ecdsa_sig.cpp \
|
||||
cert/cvc/signed_obj.cpp \
|
||||
entropy/dev_random/es_dev.cpp \
|
||||
entropy/egd/es_egd.cpp \
|
||||
entropy/proc_walk/es_ftw.cpp \
|
||||
entropy/unix_procs/es_unix.cpp \
|
||||
entropy/unix_procs/unix_cmd.cpp \
|
||||
entropy/unix_procs/unix_src.cpp \
|
||||
filters/fd_unix/fd_unix.cpp \
|
||||
math/gfpmath/curve_gfp.cpp \
|
||||
math/gfpmath/gfp_element.cpp \
|
||||
math/gfpmath/point_gfp.cpp \
|
||||
mutex/pthreads/mux_pthr.cpp \
|
||||
pubkey/ec_dompar/ec_dompar.cpp \
|
||||
pubkey/ecc_key/ecc_key.cpp \
|
||||
pubkey/ecdsa/ecdsa.cpp \
|
||||
pubkey/ecdsa/ecdsa_core.cpp \
|
||||
pubkey/ecdsa/ecdsa_op.cpp \
|
||||
pubkey/eckaeg/eckaeg.cpp \
|
||||
pubkey/eckaeg/eckaeg_core.cpp \
|
||||
pubkey/eckaeg/eckaeg_op.cpp \
|
||||
timer/gettimeofday/tm_unix.cpp
|
||||
}
|
||||
|
||||
linux*-g++* {
|
||||
SOURCES += \
|
||||
# block/serpent_ia32/serp_ia32.cpp \
|
||||
# block/serpent_ia32/serp_ia32_imp.S \
|
||||
# engine/ia32_eng/eng_ia32.cpp \
|
||||
# hash/md4_ia32/md4_ia32.cpp \
|
||||
# hash/md4_ia32/md4_ia32_imp.S \
|
||||
# hash/md5_ia32/md5_ia32.cpp \
|
||||
# hash/md5_ia32/md5_ia32_imp.S \
|
||||
# hash/sha1_ia32/sha1_ia32.cpp \
|
||||
# hash/sha1_ia32/sha1_ia32_imp.S \
|
||||
timer/posix_rt/tm_posix.cpp
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user