diff options
author | Matthias Gierlings <[email protected]> | 2016-06-19 18:06:12 +0200 |
---|---|---|
committer | Matthias Gierlings <[email protected]> | 2016-06-19 19:30:14 +0200 |
commit | 129324f68f59bea91b3b8901875eeb278acb34b1 (patch) | |
tree | 21b3a55e67ee2c2437e3078cfe6e7484dda42cdb | |
parent | d73460df43b2d4d14b62a98e9bc66dfea02ab63d (diff) |
Reverted proposed constructor changes to X509_CA.
- Removed Certificate_Properties class used to wrap X509_CA parameters.
- Whitespace cleanup.
-rw-r--r-- | src/lib/cert/x509/x509_ca.cpp | 20 | ||||
-rw-r--r-- | src/lib/cert/x509/x509_ca.h | 26 | ||||
-rw-r--r-- | src/lib/cert/x509/x509self.cpp | 12 | ||||
-rw-r--r-- | src/lib/tls/tls_ciphersuite.h | 38 | ||||
-rw-r--r-- | src/lib/tls/tls_client.h | 2 | ||||
-rw-r--r-- | src/lib/tls/tls_record.cpp | 2 |
6 files changed, 45 insertions, 55 deletions
diff --git a/src/lib/cert/x509/x509_ca.cpp b/src/lib/cert/x509/x509_ca.cpp index 02f77c8f6..147fdd6ad 100644 --- a/src/lib/cert/x509/x509_ca.cpp +++ b/src/lib/cert/x509/x509_ca.cpp @@ -1,7 +1,6 @@ /* * X.509 Certificate Authority * (C) 1999-2010 Jack Lloyd -* 2016 Matthias Gierlings * * Botan is released under the Simplified BSD License (see license.txt) */ @@ -79,10 +78,8 @@ X509_Certificate X509_CA::sign_request(const PKCS10_Request& req, return make_cert(m_signer, rng, m_ca_sig_algo, req.raw_public_key(), - Certificate_Properties(not_before, - not_after, - m_cert.subject_dn(), - req.subject_dn()), + not_before, not_after, + m_cert.subject_dn(), req.subject_dn(), extensions); } @@ -93,7 +90,10 @@ X509_Certificate X509_CA::make_cert(PK_Signer* signer, RandomNumberGenerator& rng, const AlgorithmIdentifier& sig_algo, const std::vector<byte>& pub_key, - const Certificate_Properties properties, + const X509_Time& not_before, + const X509_Time& not_after, + const X509_DN& issuer_dn, + const X509_DN& subject_dn, const Extensions& extensions) { const size_t X509_CERT_VERSION = 3; @@ -112,14 +112,14 @@ X509_Certificate X509_CA::make_cert(PK_Signer* signer, .encode(serial_no) .encode(sig_algo) - .encode(properties.get_issuer_dn()) + .encode(issuer_dn) .start_cons(SEQUENCE) - .encode(properties.get_not_before()) - .encode(properties.get_not_after()) + .encode(not_before) + .encode(not_after) .end_cons() - .encode(properties.get_subject_dn()) + .encode(subject_dn) .raw_bytes(pub_key) .start_explicit(3) diff --git a/src/lib/cert/x509/x509_ca.h b/src/lib/cert/x509/x509_ca.h index 17e534cfd..ba3724f5e 100644 --- a/src/lib/cert/x509/x509_ca.h +++ b/src/lib/cert/x509/x509_ca.h @@ -1,7 +1,6 @@ /* * X.509 Certificate Authority * (C) 1999-2008 Jack Lloyd -* 2016 Matthias Gierlings * * Botan is released under the Simplified BSD License (see license.txt) */ @@ -23,26 +22,6 @@ namespace Botan { class BOTAN_DLL X509_CA { public: - class Certificate_Properties - { - public: - Certificate_Properties(X509_Time not_before, X509_Time not_after, - X509_DN issuer_dn, X509_DN subject_dn) - : m_not_before(not_before), m_not_after(not_after), - m_issuer_dn(issuer_dn), m_subject_dn(subject_dn) {} - - const X509_Time& get_not_before() const { return m_not_before; } - const X509_Time& get_not_after() const { return m_not_after; } - const X509_DN& get_issuer_dn() const { return m_issuer_dn; } - const X509_DN& get_subject_dn() const { return m_subject_dn; } - - private: - X509_Time m_not_before; - X509_Time m_not_after; - X509_DN m_issuer_dn; - X509_DN m_subject_dn; - }; - /** * Sign a PKCS#10 Request. * @param req the request to sign @@ -102,7 +81,10 @@ class BOTAN_DLL X509_CA RandomNumberGenerator& rng, const AlgorithmIdentifier& sig_algo, const std::vector<byte>& pub_key, - const Certificate_Properties properties, + const X509_Time& not_before, + const X509_Time& not_after, + const X509_DN& issuer_dn, + const X509_DN& subject_dn, const Extensions& extensions); /** diff --git a/src/lib/cert/x509/x509self.cpp b/src/lib/cert/x509/x509self.cpp index 636b9fbb6..8b9aeda09 100644 --- a/src/lib/cert/x509/x509self.cpp +++ b/src/lib/cert/x509/x509self.cpp @@ -1,7 +1,6 @@ /* * PKCS #10/Self Signed Cert Creation * (C) 1999-2008 Jack Lloyd -* 2016 Matthias Gierlings * * Botan is released under the Simplified BSD License (see license.txt) */ @@ -76,14 +75,9 @@ X509_Certificate create_self_signed_cert(const X509_Cert_Options& opts, extensions.add( new Cert_Extension::Extended_Key_Usage(opts.ex_constraints)); - return X509_CA::make_cert(signer.get(), - rng, - sig_algo, - pub_key, - X509_CA::Certificate_Properties(opts.start, - opts.end, - subject_dn, - subject_dn), + return X509_CA::make_cert(signer.get(), rng, sig_algo, pub_key, + opts.start, opts.end, + subject_dn, subject_dn, extensions); } diff --git a/src/lib/tls/tls_ciphersuite.h b/src/lib/tls/tls_ciphersuite.h index cf9e1587b..1f646cc7e 100644 --- a/src/lib/tls/tls_ciphersuite.h +++ b/src/lib/tls/tls_ciphersuite.h @@ -1,7 +1,6 @@ /* * TLS Cipher Suites * (C) 2004-2011,2012 Jack Lloyd -* 2016 Matthias Gierlings * * Botan is released under the Simplified BSD License (see license.txt) */ @@ -117,17 +116,32 @@ class BOTAN_DLL Ciphersuite private: - Ciphersuite(u16bit ciphersuite_code, - const char* iana_id, - const char* sig_algo, - const char* kex_algo, - const char* cipher_algo, - size_t cipher_keylen, - size_t nonce_bytes_from_handshake, - size_t nonce_bytes_from_record, - const char* mac_algo, - size_t mac_keylen, - const char* prf_algo = ""); + + Ciphersuite(u16bit ciphersuite_code, + const char* iana_id, + const char* sig_algo, + const char* kex_algo, + const char* cipher_algo, + size_t cipher_keylen, + size_t nonce_bytes_from_handshake, + size_t nonce_bytes_from_record, + const char* mac_algo, + size_t mac_keylen, + const char* prf_algo) : + m_ciphersuite_code(ciphersuite_code), + m_iana_id(iana_id), + m_sig_algo(sig_algo), + m_kex_algo(kex_algo), + m_prf_algo(prf_algo), + m_cipher_algo(cipher_algo), + m_mac_algo(mac_algo), + m_cipher_keylen(cipher_keylen), + m_nonce_bytes_from_handshake(nonce_bytes_from_handshake), + m_nonce_bytes_from_record(nonce_bytes_from_record), + m_mac_keylen(mac_keylen) + { + } + u16bit m_ciphersuite_code = 0; /* diff --git a/src/lib/tls/tls_client.h b/src/lib/tls/tls_client.h index 6bdff8c53..8a45c5444 100644 --- a/src/lib/tls/tls_client.h +++ b/src/lib/tls/tls_client.h @@ -80,7 +80,7 @@ class BOTAN_DLL Client final : public Channel } const std::vector<std::string>& get_next_protocols() - { + { return m_next_protocols; } diff --git a/src/lib/tls/tls_record.cpp b/src/lib/tls/tls_record.cpp index 5fda1fbb4..e028c43a0 100644 --- a/src/lib/tls/tls_record.cpp +++ b/src/lib/tls/tls_record.cpp @@ -567,7 +567,7 @@ size_t read_dtls_record(secure_vector<byte>& readbuf, BOTAN_ASSERT(rec.get_protocol_version()->is_datagram_protocol(), "Expected DTLS"); const size_t record_size = make_u16bit(readbuf[DTLS_HEADER_SIZE-2], - readbuf[DTLS_HEADER_SIZE-1]); + readbuf[DTLS_HEADER_SIZE-1]); if(record_size > MAX_CIPHERTEXT_SIZE) throw TLS_Exception(Alert::RECORD_OVERFLOW, |