aboutsummaryrefslogtreecommitdiffstats
path: root/src/cert
diff options
context:
space:
mode:
authorlloyd <[email protected]>2010-03-02 17:54:32 +0000
committerlloyd <[email protected]>2010-03-02 17:54:32 +0000
commitf85024b6c52bf276e92854afff7813ae5740de71 (patch)
tree65834e2ffa8b85d5f9848587a59054ee449fe038 /src/cert
parent136ac920e656d7b2de8c9758fa252993e6f44f25 (diff)
Remove some needless usages of auto_ptr in CVC
Diffstat (limited to 'src/cert')
-rw-r--r--src/cert/cvc/cvc_ado.cpp4
-rw-r--r--src/cert/cvc/cvc_ado.h2
-rw-r--r--src/cert/cvc/cvc_ca.cpp2
-rw-r--r--src/cert/cvc/cvc_ca.h2
-rw-r--r--src/cert/cvc/cvc_gen_cert.h11
-rw-r--r--src/cert/cvc/cvc_self.cpp23
-rw-r--r--src/cert/cvc/eac_obj.h11
7 files changed, 33 insertions, 22 deletions
diff --git a/src/cert/cvc/cvc_ado.cpp b/src/cert/cvc/cvc_ado.cpp
index fcce0ff82..fd5b80f13 100644
--- a/src/cert/cvc/cvc_ado.cpp
+++ b/src/cert/cvc/cvc_ado.cpp
@@ -46,12 +46,12 @@ void EAC1_1_ADO::force_decode()
}
MemoryVector<byte> EAC1_1_ADO::make_signed(
- std::auto_ptr<PK_Signer> signer,
+ PK_Signer& signer,
const MemoryRegion<byte>& tbs_bits,
RandomNumberGenerator& rng)
{
SecureVector<byte> concat_sig =
- EAC1_1_obj<EAC1_1_ADO>::make_signature(signer.get(), tbs_bits, rng);
+ EAC1_1_obj<EAC1_1_ADO>::make_signature(signer, tbs_bits, rng);
return DER_Encoder()
.start_cons(ASN1_Tag(7), APPLICATION)
diff --git a/src/cert/cvc/cvc_ado.h b/src/cert/cvc/cvc_ado.h
index 80e6a82b7..100888d29 100644
--- a/src/cert/cvc/cvc_ado.h
+++ b/src/cert/cvc/cvc_ado.h
@@ -46,7 +46,7 @@ class BOTAN_DLL EAC1_1_ADO : public EAC1_1_obj<EAC1_1_ADO>
* @param tbs_bits the TBS data to sign
*/
static MemoryVector<byte> make_signed(
- std::auto_ptr<PK_Signer> signer,
+ PK_Signer& signer,
const MemoryRegion<byte>& tbs_bits,
RandomNumberGenerator& rng);
diff --git a/src/cert/cvc/cvc_ca.cpp b/src/cert/cvc/cvc_ca.cpp
index 814df216b..af40fcd05 100644
--- a/src/cert/cvc/cvc_ca.cpp
+++ b/src/cert/cvc/cvc_ca.cpp
@@ -4,7 +4,7 @@
#include <botan/oids.h>
namespace Botan {
-EAC1_1_CVC EAC1_1_CVC_CA::make_cert(std::auto_ptr<PK_Signer> signer,
+EAC1_1_CVC EAC1_1_CVC_CA::make_cert(PK_Signer& signer,
MemoryRegion<byte> const& public_key,
ASN1_Car const& car,
ASN1_Chr const& chr,
diff --git a/src/cert/cvc/cvc_ca.h b/src/cert/cvc/cvc_ca.h
index 3ec307bb3..87699808f 100644
--- a/src/cert/cvc/cvc_ca.h
+++ b/src/cert/cvc/cvc_ca.h
@@ -36,7 +36,7 @@ class BOTAN_DLL EAC1_1_CVC_CA
* @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,
+ static EAC1_1_CVC make_cert(PK_Signer& signer,
MemoryRegion<byte> const& public_key,
ASN1_Car const& car,
ASN1_Chr const& chr,
diff --git a/src/cert/cvc/cvc_gen_cert.h b/src/cert/cvc/cvc_gen_cert.h
index 096f7898c..0a79d96d2 100644
--- a/src/cert/cvc/cvc_gen_cert.h
+++ b/src/cert/cvc/cvc_gen_cert.h
@@ -75,9 +75,10 @@ class BOTAN_DLL EAC1_1_gen_CVC : public EAC1_1_obj<Derived> // CRTP continuation
* @result the DER encoded signed generalized CVC object
*/
static MemoryVector<byte> make_signed(
- std::auto_ptr<PK_Signer> signer,
+ PK_Signer& signer,
const MemoryRegion<byte>& tbs_bits,
RandomNumberGenerator& rng);
+
virtual ~EAC1_1_gen_CVC<Derived>()
{}
@@ -102,12 +103,14 @@ 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,
+template<typename Derived>
+MemoryVector<byte> EAC1_1_gen_CVC<Derived>::make_signed(
+ 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);
+ SecureVector<byte> concat_sig =
+ EAC1_1_obj<Derived>::make_signature(signer, tbs_bits, rng);
return DER_Encoder()
.start_cons(ASN1_Tag(33), APPLICATION)
diff --git a/src/cert/cvc/cvc_self.cpp b/src/cert/cvc/cvc_self.cpp
index 5eda6a96a..c5ac43b99 100644
--- a/src/cert/cvc/cvc_self.cpp
+++ b/src/cert/cvc/cvc_self.cpp
@@ -86,7 +86,8 @@ EAC1_1_CVC create_self_signed_cert(Private_Key const& key,
sig_algo.oid = OIDS::lookup(priv_key->algo_name() + "/" + padding_and_hash);
sig_algo = AlgorithmIdentifier(sig_algo.oid, AlgorithmIdentifier::USE_NULL_PARAM);
- std::auto_ptr<Botan::PK_Signer> signer(get_pk_signer(*priv_key, padding_and_hash));
+ std::auto_ptr<Botan::PK_Signer> signer(
+ get_pk_signer(*priv_key, padding_and_hash));
#if 0 // FIXME
std::auto_ptr<EAC1_1_CVC_Encoder> enc(priv_key->cvc_eac1_1_encoder());
@@ -95,8 +96,11 @@ EAC1_1_CVC create_self_signed_cert(Private_Key const& key,
MemoryVector<byte> enc_public_key;
#endif
- return EAC1_1_CVC_CA::make_cert(signer, enc_public_key, opt.car, chr, opt.holder_auth_templ, opt.ced, opt.cex, rng);
-
+ return EAC1_1_CVC_CA::make_cert(*signer,
+ enc_public_key,
+ opt.car, chr,
+ opt.holder_auth_templ,
+ opt.ced, opt.cex, rng);
}
EAC1_1_Req create_cvc_req(Private_Key const& key,
@@ -132,7 +136,10 @@ EAC1_1_Req create_cvc_req(Private_Key const& key,
.encode(chr)
.get_contents();
- MemoryVector<byte> signed_cert = EAC1_1_gen_CVC<EAC1_1_Req>::make_signed(signer, EAC1_1_gen_CVC<EAC1_1_Req>::build_cert_body(tbs), rng);
+ MemoryVector<byte> signed_cert =
+ EAC1_1_gen_CVC<EAC1_1_Req>::make_signed(*signer,
+ EAC1_1_gen_CVC<EAC1_1_Req>::build_cert_body(tbs),
+ rng);
DataSource_Memory source(signed_cert);
return EAC1_1_Req(source);
@@ -153,7 +160,7 @@ EAC1_1_ADO create_ado_req(Private_Key const& key,
std::auto_ptr<Botan::PK_Signer> signer(get_pk_signer(*priv_key, padding_and_hash));
SecureVector<byte> tbs_bits = req.BER_encode();
tbs_bits.append(DER_Encoder().encode(car).get_contents());
- MemoryVector<byte> signed_cert = EAC1_1_ADO::make_signed(signer, tbs_bits, rng);
+ MemoryVector<byte> signed_cert = EAC1_1_ADO::make_signed(*signer, tbs_bits, rng);
DataSource_Memory source(signed_cert);
return EAC1_1_ADO(source);
@@ -216,7 +223,7 @@ EAC1_1_CVC link_cvca(EAC1_1_CVC const& signer,
std::string padding_and_hash = padding_and_hash_from_oid(sig_algo.oid);
std::auto_ptr<Botan::PK_Signer> pk_signer(get_pk_signer(*priv_key, padding_and_hash));
std::auto_ptr<Public_Key> pk = signee.subject_public_key();
- ECDSA_PublicKey* subj_pk = dynamic_cast<ECDSA_PublicKey*>(pk.get());
+ ECDSA_PublicKey* subj_pk = dynamic_cast<ECDSA_PublicKey*>(pk.get());
subj_pk->set_parameter_encoding(EC_DOMPAR_ENC_EXPLICIT);
#if 0 // FIXME
@@ -226,7 +233,7 @@ EAC1_1_CVC link_cvca(EAC1_1_CVC const& signer,
MemoryVector<byte> enc_public_key;
#endif
- return EAC1_1_CVC_CA::make_cert(pk_signer, enc_public_key,
+ return EAC1_1_CVC_CA::make_cert(*pk_signer, enc_public_key,
signer.get_car(),
signee.get_chr(),
signer.get_chat_value(),
@@ -302,7 +309,7 @@ EAC1_1_CVC sign_request(EAC1_1_CVC const& signer_cert,
throw Invalid_Argument("sign_request(): encountered illegal value for CHAT");
// (IS cannot sign certificates)
}
- return EAC1_1_CVC_CA::make_cert(pk_signer, enc_public_key,
+ return EAC1_1_CVC_CA::make_cert(*pk_signer, enc_public_key,
ASN1_Car(signer_cert.get_chr().iso_8859()),
chr,
chat_val,
diff --git a/src/cert/cvc/eac_obj.h b/src/cert/cvc/eac_obj.h
index e4eb895c1..f41d0af2b 100644
--- a/src/cert/cvc/eac_obj.h
+++ b/src/cert/cvc/eac_obj.h
@@ -51,9 +51,10 @@ class BOTAN_DLL EAC1_1_obj : public EAC_Signed_Object
protected:
void init(DataSource& in);
- static SecureVector<byte> make_signature(PK_Signer* signer,
- const MemoryRegion<byte>& tbs_bits,
- RandomNumberGenerator& rng);
+ static SecureVector<byte>
+ make_signature(PK_Signer& signer,
+ const MemoryRegion<byte>& tbs_bits,
+ RandomNumberGenerator& rng);
virtual ~EAC1_1_obj<Derived>(){}
@@ -65,12 +66,12 @@ template<typename Derived> SecureVector<byte> EAC1_1_obj<Derived>::get_concat_si
}
template<typename Derived> SecureVector<byte>
-EAC1_1_obj<Derived>::make_signature(PK_Signer* signer,
+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);
+ SecureVector<byte> seq_sig = signer.sign_message(tbs_bits, rng);
ECDSA_Signature sig(decode_seq(seq_sig));
SecureVector<byte> concat_sig(sig.get_concatenation());