aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlloyd <[email protected]>2010-11-02 18:52:38 +0000
committerlloyd <[email protected]>2010-11-02 18:52:38 +0000
commit6f07da35714ed19149be572952eb5bc5584f7fc4 (patch)
tree5eeec50aa84a73a15b45b63ad7b7cff2bd0d3657
parent66ff3ef44894c159c1c51cd282b550ea3826a007 (diff)
Add a BOTAN_DEPRECATED macro which can provide compile-time
deprecation warnings (at least for GCC and VC++). Use in some places.
-rw-r--r--src/algo_factory/algo_factory.h5
-rw-r--r--src/build-data/buildh.in13
-rw-r--r--src/cert/x509cert/x509_obj.h1
-rw-r--r--src/libstate/look_pk.h7
-rw-r--r--src/pubkey/pkcs8.h2
-rw-r--r--src/pubkey/x509_key.h1
6 files changed, 25 insertions, 4 deletions
diff --git a/src/algo_factory/algo_factory.h b/src/algo_factory/algo_factory.h
index 1c865b470..10549d5d3 100644
--- a/src/algo_factory/algo_factory.h
+++ b/src/algo_factory/algo_factory.h
@@ -162,7 +162,7 @@ class BOTAN_DLL Algorithm_Factory
/**
* An iterator for the engines in this factory
- * @deprecated
+ * @deprecated Avoid in new code
*/
class BOTAN_DLL Engine_Iterator
{
@@ -175,7 +175,8 @@ class BOTAN_DLL Algorithm_Factory
/**
* @param a an algorithm factory
*/
- Engine_Iterator(const Algorithm_Factory& a) : af(a) { n = 0; }
+ Engine_Iterator(const Algorithm_Factory& a) :
+ af(a) { n = 0; }
private:
const Algorithm_Factory& af;
size_t n;
diff --git a/src/build-data/buildh.in b/src/build-data/buildh.in
index 03f8b8f2e..53c66e133 100644
--- a/src/build-data/buildh.in
+++ b/src/build-data/buildh.in
@@ -57,12 +57,23 @@
%{target_compiler_defines}
-#if defined(BOTAN_BUILD_COMPILER_IS_MSVC)
+#if defined(_MSC_VER)
// 4250: inherits via dominance (diamond inheritence issue)
// 4251: needs DLL interface (STL DLL exports)
#pragma warning(disable: 4250 4251)
#endif
+/*
+* Compile-time deprecatation warnings
+*/
+#if defined(__GNUG__)
+ #define BOTAN_DEPRECATED(msg) __attribute__ ((deprecated, warning(why)))
+#elif defined(_MSC_VER)
+ #define BOTAN_DEPRECATED(msg) __declspec(deprecated(why))
+#else
+ #define BOTAN_DEPRECATED(msg)
+#endif
+
/* Module definitions */
%{module_defines}
diff --git a/src/cert/x509cert/x509_obj.h b/src/cert/x509cert/x509_obj.h
index 6579565f9..570b00f51 100644
--- a/src/cert/x509cert/x509_obj.h
+++ b/src/cert/x509cert/x509_obj.h
@@ -88,6 +88,7 @@ class BOTAN_DLL X509_Object
* @param out the pipe to write to
* @param encoding the encoding to use
*/
+ BOTAN_DEPRECATED("Use BER_encode or PEM_encode")
void encode(Pipe& out, X509_Encoding encoding = PEM) const;
virtual ~X509_Object() {}
diff --git a/src/libstate/look_pk.h b/src/libstate/look_pk.h
index c980e5f8d..bbd0e7dba 100644
--- a/src/libstate/look_pk.h
+++ b/src/libstate/look_pk.h
@@ -21,6 +21,7 @@ namespace Botan {
* @param eme determines the algorithm and encoding
* @return public key encryptor object
*/
+BOTAN_DEPRECATED("Instantiate object directly")
inline PK_Encryptor* get_pk_encryptor(const Public_Key& key,
const std::string& eme)
{
@@ -35,6 +36,7 @@ inline PK_Encryptor* get_pk_encryptor(const Public_Key& key,
* @param eme determines the algorithm and encoding
* @return public key decryptor object
*/
+BOTAN_DEPRECATED("Instantiate object directly")
inline PK_Decryptor* get_pk_decryptor(const Private_Key& key,
const std::string& eme)
{
@@ -50,6 +52,7 @@ inline PK_Decryptor* get_pk_decryptor(const Private_Key& key,
* @param sig_format the signature format to be used
* @return public key signer object
*/
+BOTAN_DEPRECATED("Instantiate object directly")
inline PK_Signer* get_pk_signer(const Private_Key& key,
const std::string& emsa,
Signature_Format sig_format = IEEE_1363)
@@ -66,6 +69,7 @@ inline PK_Signer* get_pk_signer(const Private_Key& key,
* @param sig_format the signature format to be used
* @return public key verifier object
*/
+BOTAN_DEPRECATED("Instantiate object directly")
inline PK_Verifier* get_pk_verifier(const Public_Key& key,
const std::string& emsa,
Signature_Format sig_format = IEEE_1363)
@@ -81,8 +85,9 @@ inline PK_Verifier* get_pk_verifier(const Public_Key& key,
* @param kdf the kdf algorithm to use
* @return key agreement algorithm
*/
+BOTAN_DEPRECATED("Instantiate object directly")
inline PK_Key_Agreement* get_pk_kas(const PK_Key_Agreement_Key& key,
- const std::string& kdf)
+ const std::string& kdf)
{
return new PK_Key_Agreement(key, kdf);
}
diff --git a/src/pubkey/pkcs8.h b/src/pubkey/pkcs8.h
index 376429d5b..00607b329 100644
--- a/src/pubkey/pkcs8.h
+++ b/src/pubkey/pkcs8.h
@@ -81,6 +81,7 @@ BOTAN_DLL std::string PEM_encode(const Private_Key& key,
* @param pipe the pipe to feed the encoded key into
* @param encoding the encoding type to use
*/
+BOTAN_DEPRECATED("Use PEM_encode or BER_encode")
inline void encode(const Private_Key& key,
Pipe& pipe,
X509_Encoding encoding = PEM)
@@ -104,6 +105,7 @@ inline void encode(const Private_Key& key,
default will be chosen.
* @param encoding the encoding type to use
*/
+BOTAN_DEPRECATED("Use PEM_encode or BER_encode")
inline void encrypt_key(const Private_Key& key,
Pipe& pipe,
RandomNumberGenerator& rng,
diff --git a/src/pubkey/x509_key.h b/src/pubkey/x509_key.h
index 7dd2a9db8..3fdee8cde 100644
--- a/src/pubkey/x509_key.h
+++ b/src/pubkey/x509_key.h
@@ -83,6 +83,7 @@ BOTAN_DLL Key_Constraints find_constraints(const Public_Key& pub_key,
* @param pipe the pipe to feed the encoded key into
* @param encoding the encoding type to use
*/
+BOTAN_DEPRECATED("Use PEM_encode or BER_encode")
inline void encode(const Public_Key& key,
Pipe& pipe,
X509_Encoding encoding = PEM)