diff options
author | lloyd <[email protected]> | 2013-11-20 12:18:02 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2013-11-20 12:18:02 +0000 |
commit | bd1f3b15fd803f13d6a04d008b4ec4304cc3f23f (patch) | |
tree | 33b3d88204eddb48c7b611aee17ce5272cde967e /src | |
parent | 3293afe9c3a1cd26c81070e6c477554db4100da1 (diff) | |
parent | 818511d02b91830bce5e4bb5b3dbb0b1713da6b4 (diff) |
merge of '68c716734951de7d2d263d5ed5162e963d6c32be'
and '714a603d145c840eec1464ea31d0d07c2bf640fa'
Diffstat (limited to 'src')
-rw-r--r-- | src/build-data/makefile/python.in | 4 | ||||
-rw-r--r-- | src/wrap/python/filter.cpp | 14 | ||||
-rw-r--r-- | src/wrap/python/python_botan.h | 5 | ||||
-rw-r--r-- | src/wrap/python/rsa.cpp | 7 | ||||
-rw-r--r-- | src/wrap/python/x509.cpp | 39 |
5 files changed, 14 insertions, 55 deletions
diff --git a/src/build-data/makefile/python.in b/src/build-data/makefile/python.in index 74620fe06..17d1015d2 100644 --- a/src/build-data/makefile/python.in +++ b/src/build-data/makefile/python.in @@ -1,7 +1,7 @@ CXX = %{cc} -CFLAGS = -Os +CFLAGS = -Os %{lang_flags} LDFLAGS = -WARN_FLAGS = %{warn_flags} +WARN_FLAGS = -Wall -Wextra SERIES = %{version_major}.%{version_minor} diff --git a/src/wrap/python/filter.cpp b/src/wrap/python/filter.cpp index eef8b202c..e329ed708 100644 --- a/src/wrap/python/filter.cpp +++ b/src/wrap/python/filter.cpp @@ -107,19 +107,19 @@ Filter* make_filter4(const std::string& name, name); } -void append_filter(Pipe& pipe, std::unique_ptr<Filter> filter) +void append_filter(Pipe& pipe, std::auto_ptr<Filter> filter) { pipe.append(filter.get()); filter.release(); } -void prepend_filter(Pipe& pipe, std::unique_ptr<Filter> filter) +void prepend_filter(Pipe& pipe, std::auto_ptr<Filter> filter) { pipe.prepend(filter.get()); filter.release(); } -void do_send(std::unique_ptr<FilterWrapper> filter, const std::string& data) +void do_send(std::auto_ptr<FilterWrapper> filter, const std::string& data) { filter->send_str(data); } @@ -128,7 +128,7 @@ BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(rallas_ovls, read_all_as_string, 0, 1) void export_filters() { - class_<Filter, std::unique_ptr<Filter>, boost::noncopyable> + class_<Filter, std::auto_ptr<Filter>, boost::noncopyable> ("__Internal_FilterObj", no_init); def("make_filter", make_filter1, @@ -142,7 +142,7 @@ void export_filters() // This might not work - Pipe will delete the filter, but Python // might have allocated the space with malloc() or who-knows-what -> bad - class_<FilterWrapper, std::unique_ptr<FilterWrapper>, + class_<FilterWrapper, std::auto_ptr<FilterWrapper>, bases<Filter>, boost::noncopyable> ("FilterObj") .def("write", pure_virtual(&Py_Filter::write_str)) @@ -150,8 +150,8 @@ void export_filters() .def("start_msg", &Filter::start_msg, &FilterWrapper::default_start_msg) .def("end_msg", &Filter::end_msg, &FilterWrapper::default_end_msg); - implicitly_convertible<std::unique_ptr<FilterWrapper>, - std::unique_ptr<Filter> >(); + implicitly_convertible<std::auto_ptr<FilterWrapper>, + std::auto_ptr<Filter> >(); void (Pipe::*pipe_write_str)(const std::string&) = &Pipe::write; void (Pipe::*pipe_process_str)(const std::string&) = &Pipe::process_msg; diff --git a/src/wrap/python/python_botan.h b/src/wrap/python/python_botan.h index 03bdd9156..501f4b9eb 100644 --- a/src/wrap/python/python_botan.h +++ b/src/wrap/python/python_botan.h @@ -34,9 +34,10 @@ inline std::string make_string(const byte input[], u32bit length) return std::string((const char*)input, length); } -inline std::string make_string(const secure_vector<byte>& in) +template<typename Alloc> +inline std::string make_string(const std::vector<byte, Alloc>& in) { - return make_string(in.begin(), in.size()); + return make_string(&in[0], in.size()); } inline void string2binary(const std::string& from, byte to[], u32bit expected) diff --git a/src/wrap/python/rsa.cpp b/src/wrap/python/rsa.cpp index 3ff1edb07..770082945 100644 --- a/src/wrap/python/rsa.cpp +++ b/src/wrap/python/rsa.cpp @@ -6,7 +6,6 @@ */ #include <botan/rsa.h> -#include <botan/look_pk.h> #include <botan/pubkey.h> #include <botan/x509_key.h> using namespace Botan; @@ -41,9 +40,7 @@ class Py_RSA_PrivateKey std::string to_ber() const { secure_vector<byte> bits = PKCS8::BER_encode(*rsa_key); - - return std::string(reinterpret_cast<const char*>(&bits[0]), - bits.size()); + return std::string(reinterpret_cast<const char*>(&bits[0]), bits.size()); } std::string get_N() const { return bigint2str(get_bigint_N()); } @@ -140,7 +137,7 @@ class Py_RSA_PublicKey std::string to_ber() const { - secure_vector<byte> bits = X509::BER_encode(*rsa_key); + std::vector<byte> bits = X509::BER_encode(*rsa_key); return std::string(reinterpret_cast<const char*>(&bits[0]), bits.size()); diff --git a/src/wrap/python/x509.cpp b/src/wrap/python/x509.cpp index 0a29ad83a..57beb7e4a 100644 --- a/src/wrap/python/x509.cpp +++ b/src/wrap/python/x509.cpp @@ -10,7 +10,6 @@ #include <botan/filters.h> #include <botan/x509cert.h> #include <botan/x509_crl.h> -#include <botan/x509stor.h> using namespace Botan; #include <boost/python.hpp> @@ -86,42 +85,4 @@ void export_x509() python::class_<X509_CRL> ("X509_CRL", python::init<std::string>()) .add_property("as_pem", &X509_Object::PEM_encode); - - python::enum_<X509_Code>("verify_result") - .value("verified", VERIFIED) - .value("unknown_x509_error", UNKNOWN_X509_ERROR) - .value("cannot_establish_trust", CANNOT_ESTABLISH_TRUST) - .value("cert_chain_too_long", CERT_CHAIN_TOO_LONG) - .value("signature_error", SIGNATURE_ERROR) - .value("policy_error", POLICY_ERROR) - .value("invalid_usage", INVALID_USAGE) - .value("cert_format_error", CERT_FORMAT_ERROR) - .value("cert_issuer_not_found", CERT_ISSUER_NOT_FOUND) - .value("cert_not_yet_valid", CERT_NOT_YET_VALID) - .value("cert_has_expired", CERT_HAS_EXPIRED) - .value("cert_is_revoked", CERT_IS_REVOKED) - .value("crl_format_error", CRL_FORMAT_ERROR) - .value("crl_issuer_not_found", CRL_ISSUER_NOT_FOUND) - .value("crl_not_yet_valid", CRL_NOT_YET_VALID) - .value("crl_has_expired", CRL_HAS_EXPIRED) - .value("ca_cert_cannot_sign", CA_CERT_CANNOT_SIGN) - .value("ca_cert_not_for_cert_issuer", CA_CERT_NOT_FOR_CERT_ISSUER) - .value("ca_cert_not_for_crl_issuer", CA_CERT_NOT_FOR_CRL_ISSUER); - - python::enum_<X509_Store::Cert_Usage>("cert_usage") - .value("any", X509_Store::ANY) - .value("tls_server", X509_Store::TLS_SERVER) - .value("tls_client", X509_Store::TLS_CLIENT) - .value("code_signing", X509_Store::CODE_SIGNING) - .value("email_protection", X509_Store::EMAIL_PROTECTION) - .value("time_stamping", X509_Store::TIME_STAMPING) - .value("crl_signing", X509_Store::CRL_SIGNING); - - { - python::scope in_class = - python::class_<X509_Store>("X509_Store") - .def("add_cert", &X509_Store::add_cert, add_cert_ols()) - .def("validate", &X509_Store::validate_cert, validate_cert_ols()) - .def("add_crl", &X509_Store::add_crl); - } } |