aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorlloyd <[email protected]>2006-06-23 10:34:49 +0000
committerlloyd <[email protected]>2006-06-23 10:34:49 +0000
commit571fea5ac667b88a66604ecdba05d8324f5e9de7 (patch)
treefc7f8191e779ad3dc6fb2e4ac4e6c9f2acfed7c3 /src
parent714fe898764407cdb9ebcea30cbc69bf1a4bada8 (diff)
Inline a number of small objects that are only used in a local context
(ie, a single function). This will, unfortunately, break GCC 2.95.x support. Most of the operating systems that had shipped with 2.95.x, like OpenBSD and QNX, have since upgraded. Anyone needing 2.95.x support will have to continue using 1.4.x
Diffstat (limited to 'src')
-rw-r--r--src/mutex.cpp59
-rw-r--r--src/x509_ext.cpp4
-rw-r--r--src/x509find.cpp94
3 files changed, 70 insertions, 87 deletions
diff --git a/src/mutex.cpp b/src/mutex.cpp
index 1b6c7b2d6..f96849409 100644
--- a/src/mutex.cpp
+++ b/src/mutex.cpp
@@ -7,43 +7,6 @@
namespace Botan {
-namespace {
-
-/*************************************************
-* Default Mutex *
-*************************************************/
-class Default_Mutex : public Mutex
- {
- public:
- void lock();
- void unlock();
- Default_Mutex() { locked = false; }
- private:
- bool locked;
- };
-
-/*************************************************
-* Lock the mutex *
-*************************************************/
-void Default_Mutex::lock()
- {
- if(locked)
- throw Internal_Error("Default_Mutex::lock: Mutex is already locked");
- locked = true;
- }
-
-/*************************************************
-* Unlock the mutex *
-*************************************************/
-void Default_Mutex::unlock()
- {
- if(!locked)
- throw Internal_Error("Default_Mutex::unlock: Mutex is already unlocked");
- locked = false;
- }
-
-}
-
/*************************************************
* Mutex_Holder Constructor *
*************************************************/
@@ -67,6 +30,28 @@ Mutex_Holder::~Mutex_Holder()
*************************************************/
Mutex* Mutex_Factory::make()
{
+ class Default_Mutex : public Mutex
+ {
+ public:
+ void lock()
+ {
+ if(locked)
+ throw Internal_Error("Default_Mutex::lock: Mutex is already locked");
+ locked = true;
+ }
+
+ void unlock()
+ {
+ if(!locked)
+ throw Internal_Error("Default_Mutex::unlock: Mutex is already unlocked");
+ locked = false;
+ }
+
+ Default_Mutex() { locked = false; }
+ private:
+ bool locked;
+ };
+
return new Default_Mutex;
}
diff --git a/src/x509_ext.cpp b/src/x509_ext.cpp
index 17d3c7ed0..c6a7d5b43 100644
--- a/src/x509_ext.cpp
+++ b/src/x509_ext.cpp
@@ -418,6 +418,9 @@ void Extended_Key_Usage::contents_to(Data_Store& subject, Data_Store&) const
namespace {
+/*************************************************
+* A policy specifier *
+*************************************************/
class Policy_Information : public ASN1_Object
{
public:
@@ -429,6 +432,7 @@ class Policy_Information : public ASN1_Object
.encode(oid)
.end_cons();
}
+
void decode_from(BER_Decoder& codec)
{
codec.start_cons(SEQUENCE)
diff --git a/src/x509find.cpp b/src/x509find.cpp
index fe614758d..792da386d 100644
--- a/src/x509find.cpp
+++ b/src/x509find.cpp
@@ -68,56 +68,6 @@ class DN_Check : public X509_Store::Search_Func
const std::string looking_for;
};
-/*************************************************
-* Search based on the key id *
-*************************************************/
-class KeyID_Match : public X509_Store::Search_Func
- {
- public:
- bool match(const X509_Certificate& cert) const
- {
- std::auto_ptr<X509_PublicKey> key(cert.subject_public_key());
- return (key->key_id() == key_id);
- }
- KeyID_Match(u64bit id) : key_id(id) {}
- private:
- u64bit key_id;
- };
-
-/*************************************************
-* Search based on the issuer and serial number *
-*************************************************/
-class IandS_Match : public X509_Store::Search_Func
- {
- public:
- bool match(const X509_Certificate& cert) const
- {
- if(cert.serial_number() != serial)
- return false;
- return (cert.issuer_dn() == issuer);
- }
- IandS_Match(const X509_DN& i, const MemoryRegion<byte>& s) :
- issuer(i), serial(s) {}
- private:
- X509_DN issuer;
- MemoryVector<byte> serial;
- };
-
-/*************************************************
-* Search based on the subject key id *
-*************************************************/
-class SKID_Match : public X509_Store::Search_Func
- {
- public:
- bool match(const X509_Certificate& cert) const
- {
- return (cert.subject_key_id() == skid);
- }
- SKID_Match(const MemoryRegion<byte>& s) : skid(s) {}
- private:
- MemoryVector<byte> skid;
- };
-
}
/*************************************************
@@ -155,6 +105,20 @@ std::vector<X509_Certificate> by_dns(const X509_Store& store,
*************************************************/
std::vector<X509_Certificate> by_keyid(const X509_Store& store, u64bit key_id)
{
+
+ class KeyID_Match : public X509_Store::Search_Func
+ {
+ public:
+ bool match(const X509_Certificate& cert) const
+ {
+ std::auto_ptr<X509_PublicKey> key(cert.subject_public_key());
+ return (key->key_id() == key_id);
+ }
+ KeyID_Match(u64bit id) : key_id(id) {}
+ private:
+ u64bit key_id;
+ };
+
KeyID_Match search_params(key_id);
return store.get_certs(search_params);
}
@@ -166,6 +130,23 @@ std::vector<X509_Certificate> by_iands(const X509_Store& store,
const X509_DN& issuer,
const MemoryRegion<byte>& serial)
{
+
+ class IandS_Match : public X509_Store::Search_Func
+ {
+ public:
+ bool match(const X509_Certificate& cert) const
+ {
+ if(cert.serial_number() != serial)
+ return false;
+ return (cert.issuer_dn() == issuer);
+ }
+ IandS_Match(const X509_DN& i, const MemoryRegion<byte>& s) :
+ issuer(i), serial(s) {}
+ private:
+ X509_DN issuer;
+ MemoryVector<byte> serial;
+ };
+
IandS_Match search_params(issuer, serial);
return store.get_certs(search_params);
}
@@ -176,6 +157,19 @@ std::vector<X509_Certificate> by_iands(const X509_Store& store,
std::vector<X509_Certificate> by_SKID(const X509_Store& store,
const MemoryRegion<byte>& skid)
{
+
+ class SKID_Match : public X509_Store::Search_Func
+ {
+ public:
+ bool match(const X509_Certificate& cert) const
+ {
+ return (cert.subject_key_id() == skid);
+ }
+ SKID_Match(const MemoryRegion<byte>& s) : skid(s) {}
+ private:
+ MemoryVector<byte> skid;
+ };
+
SKID_Match search_params(skid);
return store.get_certs(search_params);
}