diff options
author | lloyd <[email protected]> | 2010-04-09 14:03:13 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2010-04-09 14:03:13 +0000 |
commit | 143b5cb297a36b94c9d0e56e2d2145a7c55efde5 (patch) | |
tree | 000b11f87806678649e68e753aaad8ed6ef45803 /doc | |
parent | a1fc16d73b6e8fbb041c5163687bfd37c5705da4 (diff) | |
parent | d7e2e9316a5540e93595b5386f67594135de736d (diff) |
propagate from branch 'net.randombit.botan' (head 75d272c759511a9a99a371ddc74bd17b2c1453b6)
to branch 'net.randombit.botan.c++0x' (head 2ce9ba37cb9287a3d875921240d6682100625b9f)
Diffstat (limited to 'doc')
-rw-r--r-- | doc/examples/factor.cpp | 2 | ||||
-rw-r--r-- | doc/examples/new_engine.cpp (renamed from doc/examples/xor_ciph.cpp) | 58 | ||||
-rw-r--r-- | doc/log.txt | 11 |
3 files changed, 42 insertions, 29 deletions
diff --git a/doc/examples/factor.cpp b/doc/examples/factor.cpp index b0105426b..c4d37c92b 100644 --- a/doc/examples/factor.cpp +++ b/doc/examples/factor.cpp @@ -101,7 +101,7 @@ std::vector<BigInt> factorize(const BigInt& n_in, while(n != 1) { - if(is_prime(n, rng)) + if(check_prime(n, rng)) { factors.push_back(n); break; diff --git a/doc/examples/xor_ciph.cpp b/doc/examples/new_engine.cpp index 3174e103e..2f412a6b9 100644 --- a/doc/examples/xor_ciph.cpp +++ b/doc/examples/new_engine.cpp @@ -1,15 +1,13 @@ /* +* Adding an application specific engine * (C) 2004,2008 Jack Lloyd * * Distributed under the terms of the Botan license */ -/* - Adding a simple XOR cipher to the internal tables -*/ - #include <botan/stream_cipher.h> -#include <botan/init.h> +#include <botan/engine.h> + using namespace Botan; class XOR_Cipher : public StreamCipher @@ -25,43 +23,49 @@ class XOR_Cipher : public StreamCipher XOR_Cipher() : StreamCipher(1, 32) { mask_pos = 0; } private: - void cipher(const byte[], byte[], u32bit); - void key_schedule(const byte[], u32bit); + void cipher(const byte in[], byte out[], u32bit length) + { + for(u32bit j = 0; j != length; j++) + { + out[j] = in[j] ^ mask[mask_pos]; + mask_pos = (mask_pos + 1) % mask.size(); + } + } + + void key_schedule(const byte key[], u32bit length) + { + mask.set(key, length); + } SecureVector<byte> mask; u32bit mask_pos; }; -void XOR_Cipher::cipher(const byte in[], byte out[], u32bit length) +class Application_Engine : public Engine { - for(u32bit j = 0; j != length; j++) - { - out[j] = in[j] ^ mask[mask_pos]; - mask_pos = (mask_pos + 1) % mask.size(); - } - } - -void XOR_Cipher::key_schedule(const byte key[], u32bit length) - { - mask.set(key, length); - } + public: + std::string provider_name() const { return "application"; } + + StreamCipher* find_stream_cipher(const SCAN_Name& request, + Algorithm_Factory&) const + { + if(request.algo_name() == "XOR") + return new XOR_Cipher; + return 0; + } + }; -#include <fstream> +#include <botan/botan.h> #include <iostream> #include <string> -#include <vector> -#include <cstring> - -#include <botan/lookup.h> -#include <botan/filters.h> -#include <botan/libstate.h> int main() { Botan::LibraryInitializer init; - global_state().algorithm_factory().add_stream_cipher(new XOR_Cipher, "app"); + global_state().algorithm_factory().add_engine( + new Application_Engine); // a hex key value SymmetricKey key("010203040506070809101112AAFF"); diff --git a/doc/log.txt b/doc/log.txt index 770bfaf5b..89e95aa14 100644 --- a/doc/log.txt +++ b/doc/log.txt @@ -1,10 +1,19 @@ -* 1.9.5-dev, ????-??-?? +* 1.9.6-dev, ????-??-?? + - TLS: Add support for TLS v1.1 + - TLS: Support server name indicator extension + - TLS: Fix server handshake + - TLS: Fix server using DSA certificates + +* 1.9.5, 2010-03-29 - Numerous ECC optimizations - Fix GOST 34.10-2001 X.509 key loading - Allow PK_Signer's fault protection checks to be toggled off - Avoid using pool-based locking allocator if we can't mlock - Remove all runtime options + - New BER_Decoder::{decode_and_check, decode_octet_string_bigint} + - Remove SecureBuffer in favor of SecureVector length parameter + - HMAC_RNG: Perform a poll along with user-supplied entropy - Fix crash in MemoryRegion if Allocator::get failed - Fix small compilation problem on FreeBSD |