aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/lib/asn1/info.txt1
-rw-r--r--src/lib/ffi/info.txt1
-rw-r--r--src/lib/filters/info.txt2
-rw-r--r--src/lib/misc/pem/info.txt2
-rw-r--r--src/lib/misc/pem/pem.cpp41
-rw-r--r--src/lib/pubkey/x509_key.h2
-rw-r--r--src/lib/utils/data_src.cpp (renamed from src/lib/filters/data_src.cpp)0
-rw-r--r--src/lib/utils/data_src.h (renamed from src/lib/filters/data_src.h)0
-rw-r--r--src/lib/utils/info.txt1
-rw-r--r--src/tests/test_modes.cpp20
-rw-r--r--src/tests/test_pubkey.cpp11
-rw-r--r--src/tests/unit_x509.cpp23
12 files changed, 46 insertions, 58 deletions
diff --git a/src/lib/asn1/info.txt b/src/lib/asn1/info.txt
index c6c3db537..a067168e4 100644
--- a/src/lib/asn1/info.txt
+++ b/src/lib/asn1/info.txt
@@ -3,7 +3,6 @@ define ASN1 20131128
load_on auto
<requires>
-filters
bigint
oid_lookup
</requires>
diff --git a/src/lib/ffi/info.txt b/src/lib/ffi/info.txt
index 8d6c5237e..4018e4064 100644
--- a/src/lib/ffi/info.txt
+++ b/src/lib/ffi/info.txt
@@ -2,7 +2,6 @@ define FFI 20151001
<requires>
aead
-filters
kdf
pbkdf
pubkey
diff --git a/src/lib/filters/info.txt b/src/lib/filters/info.txt
index da6827833..fbecd9c87 100644
--- a/src/lib/filters/info.txt
+++ b/src/lib/filters/info.txt
@@ -6,7 +6,6 @@ basefilt.cpp
buf_filt.cpp
comp_filter.cpp
data_snk.cpp
-data_src.cpp
filter.cpp
key_filt.cpp
out_buf.cpp
@@ -23,7 +22,6 @@ basefilt.h
buf_filt.h
data_snk.h
comp_filter.h
-data_src.h
filter.h
filters.h
key_filt.h
diff --git a/src/lib/misc/pem/info.txt b/src/lib/misc/pem/info.txt
index c614b5ca7..9340a7cef 100644
--- a/src/lib/misc/pem/info.txt
+++ b/src/lib/misc/pem/info.txt
@@ -1,5 +1,5 @@
define PEM_CODEC 20131128
<requires>
-codec_filt
+base64
</requires>
diff --git a/src/lib/misc/pem/pem.cpp b/src/lib/misc/pem/pem.cpp
index f33016c70..1279b665e 100644
--- a/src/lib/misc/pem/pem.cpp
+++ b/src/lib/misc/pem/pem.cpp
@@ -6,25 +6,45 @@
*/
#include <botan/pem.h>
-#include <botan/filters.h>
+#include <botan/base64.h>
#include <botan/parsing.h>
namespace Botan {
namespace PEM_Code {
+namespace {
+
+std::string linewrap(size_t width, const std::string& in)
+ {
+ std::string out;
+ for(size_t i = 0; i != in.size(); ++i)
+ {
+ if(i > 0 && i % width == 0)
+ {
+ out.push_back('\n');
+ }
+ out.push_back(in[i]);
+ }
+ if(out.size() > 0 && out[out.size()-1] != '\n')
+ {
+ out.push_back('\n');
+ }
+
+ return out;
+ }
+
+}
+
/*
* PEM encode BER/DER-encoded objects
*/
-std::string encode(const byte der[], size_t length, const std::string& label,
- size_t width)
+std::string encode(const byte der[], size_t length, const std::string& label, size_t width)
{
const std::string PEM_HEADER = "-----BEGIN " + label + "-----\n";
const std::string PEM_TRAILER = "-----END " + label + "-----\n";
- Pipe pipe(new Base64_Encoder(true, width));
- pipe.process_msg(der, length);
- return (PEM_HEADER + pipe.read_all_as_string() + PEM_TRAILER);
+ return (PEM_HEADER + linewrap(width, base64_encode(der, length)) + PEM_TRAILER);
}
/*
@@ -79,8 +99,7 @@ secure_vector<byte> decode(DataSource& source, std::string& label)
label += static_cast<char>(b);
}
- Pipe base64(new Base64_Decoder);
- base64.start_msg();
+ std::vector<char> b64;
const std::string PEM_TRAILER = "-----END " + label + "-----";
position = 0;
@@ -95,10 +114,10 @@ secure_vector<byte> decode(DataSource& source, std::string& label)
throw Decoding_Error("PEM: Malformed PEM trailer");
if(position == 0)
- base64.write(b);
+ b64.push_back(b);
}
- base64.end_msg();
- return base64.read_all();
+
+ return base64_decode(b64.data(), b64.size());
}
secure_vector<byte> decode_check_label(const std::string& pem,
diff --git a/src/lib/pubkey/x509_key.h b/src/lib/pubkey/x509_key.h
index 1bfa248ff..cbb0412d2 100644
--- a/src/lib/pubkey/x509_key.h
+++ b/src/lib/pubkey/x509_key.h
@@ -10,7 +10,7 @@
#include <botan/pk_keys.h>
#include <botan/alg_id.h>
-#include <botan/pipe.h>
+#include <botan/data_src.h>
#include <string>
namespace Botan {
diff --git a/src/lib/filters/data_src.cpp b/src/lib/utils/data_src.cpp
index 4e0725943..4e0725943 100644
--- a/src/lib/filters/data_src.cpp
+++ b/src/lib/utils/data_src.cpp
diff --git a/src/lib/filters/data_src.h b/src/lib/utils/data_src.h
index 2b6998448..2b6998448 100644
--- a/src/lib/filters/data_src.h
+++ b/src/lib/utils/data_src.h
diff --git a/src/lib/utils/info.txt b/src/lib/utils/info.txt
index 7d3216b1c..79026d7a9 100644
--- a/src/lib/utils/info.txt
+++ b/src/lib/utils/info.txt
@@ -9,6 +9,7 @@ calendar.h
charset.h
cpuid.h
database.h
+data_src.h
exceptn.h
loadstor.h
mem_ops.h
diff --git a/src/tests/test_modes.cpp b/src/tests/test_modes.cpp
index 81a15445e..f443ddabf 100644
--- a/src/tests/test_modes.cpp
+++ b/src/tests/test_modes.cpp
@@ -8,11 +8,8 @@
#if defined(BOTAN_HAS_MODES)
-#if defined(BOTAN_HAS_FILTERS)
-
#include <botan/hex.h>
#include <botan/cipher_mode.h>
-#include <botan/filters.h>
#include <iostream>
#include <fstream>
#include <memory>
@@ -27,21 +24,16 @@ secure_vector<byte> run_mode(const std::string& algo,
const secure_vector<byte>& nonce,
const secure_vector<byte>& key)
{
-#if 0
std::unique_ptr<Cipher_Mode> cipher(get_cipher_mode(algo, dir));
+ if(!cipher)
+ throw std::runtime_error("No cipher " + algo + " enabled in build");
cipher->set_key(key);
cipher->start(nonce);
secure_vector<byte> ct = pt;
cipher->finish(ct);
-#else
- Pipe pipe(get_cipher(algo, SymmetricKey(key), InitializationVector(nonce), dir));
-
- pipe.process_msg(pt);
-
- return pipe.read_all();
-#endif
+ return ct;
}
size_t mode_test(const std::string& algo,
@@ -102,12 +94,6 @@ size_t test_modes()
#else
-UNTESTED_WARNING(modes);
-
-#endif // BOTAN_HAS_FILTERS
-
-#else
-
SKIP_TEST(modes);
#endif // BOTAN_HAS_MODES
diff --git a/src/tests/test_pubkey.cpp b/src/tests/test_pubkey.cpp
index f5528af12..09f3843bb 100644
--- a/src/tests/test_pubkey.cpp
+++ b/src/tests/test_pubkey.cpp
@@ -22,6 +22,7 @@
#include <botan/x509_key.h>
#include <botan/pkcs8.h>
#include <botan/pubkey.h>
+#include <botan/hex.h>
#if defined(BOTAN_HAS_RSA)
#include <botan/rsa.h>
@@ -64,8 +65,8 @@
#include <botan/kdf.h>
#endif
-#include <botan/filters.h>
#include <botan/numthry.h>
+
using namespace Botan;
namespace {
@@ -73,12 +74,8 @@ namespace {
void dump_data(const std::vector<byte>& out,
const std::vector<byte>& expected)
{
- Pipe pipe(new Hex_Encoder);
-
- pipe.process_msg(out);
- pipe.process_msg(expected);
- std::cout << "Got: " << pipe.read_all_as_string(0) << std::endl;
- std::cout << "Exp: " << pipe.read_all_as_string(1) << std::endl;
+ std::cout << "Got: " << hex_encode(out) << std::endl;
+ std::cout << "Exp: " << hex_encode(expected) << std::endl;
}
size_t validate_save_and_load(const Private_Key* priv_key,
diff --git a/src/tests/unit_x509.cpp b/src/tests/unit_x509.cpp
index f77be1992..2040e4bbf 100644
--- a/src/tests/unit_x509.cpp
+++ b/src/tests/unit_x509.cpp
@@ -11,7 +11,6 @@
#if defined(BOTAN_HAS_RSA) && defined(BOTAN_HAS_DSA)
#include <botan/calendar.h>
-#include <botan/filters.h>
#include <botan/pkcs8.h>
#include <botan/pkcs10.h>
#include <botan/x509self.h>
@@ -45,22 +44,12 @@ X509_Time from_date(const int y, const int m, const int d)
u64bit key_id(const Public_Key* key)
{
- Pipe pipe(new Hash_Filter("SHA-1", 8));
- pipe.start_msg();
- pipe.write(key->algo_name());
- pipe.write(key->algorithm_identifier().parameters);
- pipe.write(key->x509_subject_public_key());
- pipe.end_msg();
-
- secure_vector<byte> output = pipe.read_all();
-
- if(output.size() != 8)
- throw Internal_Error("Public_Key::key_id: Incorrect output size");
-
- u64bit id = 0;
- for(u32bit j = 0; j != 8; ++j)
- id = (id << 8) | output[j];
- return id;
+ std::unique_ptr<HashFunction> hash(HashFunction::create("SHA-1"));
+ hash->update(key->algo_name());
+ hash->update(key->algorithm_identifier().parameters);
+ hash->update(key->x509_subject_public_key());
+ secure_vector<byte> output = hash->final();
+ return load_be<u64bit>(output.data());
}