summaryrefslogtreecommitdiff
path: root/extra/yassl/taocrypt/include
diff options
context:
space:
mode:
authormonty@mysql.com/narttu.mysql.fi <>2006-12-15 00:51:37 +0200
committermonty@mysql.com/narttu.mysql.fi <>2006-12-15 00:51:37 +0200
commit88dd873de0d5dc6e8f262268f925596a60b58704 (patch)
tree142bd488523fec48817d9fb2194f1a608eec00fc /extra/yassl/taocrypt/include
parent601e6f4b2a78921304bc1d779991c615ee229f89 (diff)
downloadmariadb-git-88dd873de0d5dc6e8f262268f925596a60b58704.tar.gz
Fixed compiler warnings detected by option -Wshadow and -Wunused:
- Removed not used variables and functions - Added #ifdef around code that is not used - Renamed variables and functions to avoid conflicts - Removed some not used arguments Fixed some class/struct warnings in ndb Added define IS_LONGDATA() to simplify code in libmysql.c I did run gcov on the changes and added 'purecov' comments on almost all lines that was not just variable name changes
Diffstat (limited to 'extra/yassl/taocrypt/include')
-rw-r--r--extra/yassl/taocrypt/include/algebra.hpp3
-rw-r--r--extra/yassl/taocrypt/include/des.hpp1
-rw-r--r--extra/yassl/taocrypt/include/hash.hpp1
-rw-r--r--extra/yassl/taocrypt/include/hmac.hpp4
-rw-r--r--extra/yassl/taocrypt/include/modarith.hpp4
-rw-r--r--extra/yassl/taocrypt/include/modes.hpp4
-rw-r--r--extra/yassl/taocrypt/include/rsa.hpp34
7 files changed, 30 insertions, 21 deletions
diff --git a/extra/yassl/taocrypt/include/algebra.hpp b/extra/yassl/taocrypt/include/algebra.hpp
index 535ce2599c4..d03123851f2 100644
--- a/extra/yassl/taocrypt/include/algebra.hpp
+++ b/extra/yassl/taocrypt/include/algebra.hpp
@@ -47,6 +47,7 @@ class TAOCRYPT_NO_VTABLE AbstractGroup : public virtual_base
public:
typedef Integer Element;
+ AbstractGroup() {}
virtual ~AbstractGroup() {}
virtual bool Equal(const Element &a, const Element &b) const =0;
@@ -100,6 +101,7 @@ private:
class MultiplicativeGroupT : public AbstractGroup
{
public:
+ MultiplicativeGroupT() {}
const AbstractRing& GetRing() const
{return *m_pRing;}
@@ -151,6 +153,7 @@ class TAOCRYPT_NO_VTABLE AbstractEuclideanDomain
: public AbstractRing
{
public:
+ AbstractEuclideanDomain() {}
typedef Integer Element;
virtual void DivisionAlgorithm(Element &r, Element &q, const Element &a,
diff --git a/extra/yassl/taocrypt/include/des.hpp b/extra/yassl/taocrypt/include/des.hpp
index 48bb1e9119d..35bbe3f30bf 100644
--- a/extra/yassl/taocrypt/include/des.hpp
+++ b/extra/yassl/taocrypt/include/des.hpp
@@ -42,6 +42,7 @@ enum { DES_BLOCK_SIZE = 8, DES_KEY_SIZE = 32 };
class BasicDES {
public:
+ BasicDES() {}
void SetKey(const byte*, word32, CipherDir dir);
void RawProcessBlock(word32&, word32&) const;
protected:
diff --git a/extra/yassl/taocrypt/include/hash.hpp b/extra/yassl/taocrypt/include/hash.hpp
index e3030088e0e..6885e0f35b5 100644
--- a/extra/yassl/taocrypt/include/hash.hpp
+++ b/extra/yassl/taocrypt/include/hash.hpp
@@ -38,6 +38,7 @@ namespace TaoCrypt {
// HASH
class HASH : public virtual_base {
public:
+ HASH() {}
virtual ~HASH() {}
virtual void Update(const byte*, word32) = 0;
diff --git a/extra/yassl/taocrypt/include/hmac.hpp b/extra/yassl/taocrypt/include/hmac.hpp
index b710c3aa499..7ea4cabbd47 100644
--- a/extra/yassl/taocrypt/include/hmac.hpp
+++ b/extra/yassl/taocrypt/include/hmac.hpp
@@ -116,11 +116,11 @@ void HMAC<T>::KeyInnerHash()
// Update
template <class T>
-void HMAC<T>::Update(const byte* msg, word32 length)
+void HMAC<T>::Update(const byte* msg_arg, word32 length)
{
if (!innerHashKeyed_)
KeyInnerHash();
- mac_.Update(msg, length);
+ mac_.Update(msg_arg, length);
}
diff --git a/extra/yassl/taocrypt/include/modarith.hpp b/extra/yassl/taocrypt/include/modarith.hpp
index 47b91560657..425ab22dba0 100644
--- a/extra/yassl/taocrypt/include/modarith.hpp
+++ b/extra/yassl/taocrypt/include/modarith.hpp
@@ -44,8 +44,8 @@ public:
typedef int RandomizationParameter;
typedef Integer Element;
- ModularArithmetic(const Integer &modulus = Integer::One())
- : modulus(modulus), result((word)0, modulus.reg_.size()) {}
+ ModularArithmetic(const Integer &modulus_arg = Integer::One())
+ : modulus(modulus_arg), result((word)0, modulus_arg.reg_.size()) {}
ModularArithmetic(const ModularArithmetic &ma)
: AbstractRing(),
diff --git a/extra/yassl/taocrypt/include/modes.hpp b/extra/yassl/taocrypt/include/modes.hpp
index 65b7318661e..c46ecb3b4ca 100644
--- a/extra/yassl/taocrypt/include/modes.hpp
+++ b/extra/yassl/taocrypt/include/modes.hpp
@@ -48,8 +48,8 @@ public:
{ cipher_.Process(c, p, sz); }
void SetKey(const byte* k, word32 sz)
{ cipher_.SetKey(k, sz, DIR); }
- void SetKey(const byte* k, word32 sz, const byte* iv)
- { cipher_.SetKey(k, sz, DIR); cipher_.SetIV(iv); }
+ void SetKey(const byte* k, word32 sz, const byte* iv_arg)
+ { cipher_.SetKey(k, sz, DIR); cipher_.SetIV(iv_arg); }
private:
T cipher_;
diff --git a/extra/yassl/taocrypt/include/rsa.hpp b/extra/yassl/taocrypt/include/rsa.hpp
index 1b531b9d0c0..b11142fc85d 100644
--- a/extra/yassl/taocrypt/include/rsa.hpp
+++ b/extra/yassl/taocrypt/include/rsa.hpp
@@ -138,6 +138,7 @@ private:
// block type 2 padding
class RSA_BlockType2 {
public:
+ RSA_BlockType2() {}
void Pad(const byte*, word32, byte*, word32,
RandomNumberGenerator&) const;
word32 UnPad(const byte*, word32, byte*) const;
@@ -147,6 +148,7 @@ public:
// block type 1 padding
class RSA_BlockType1 {
public:
+ RSA_BlockType1() {}
void Pad(const byte*, word32, byte*, word32,
RandomNumberGenerator&) const;
word32 UnPad(const byte*, word32, byte*) const;
@@ -181,25 +183,27 @@ public:
// Public Encrypt
template<class Pad>
-void RSA_Encryptor<Pad>::Encrypt(const byte* plain, word32 sz, byte* cipher,
- RandomNumberGenerator& rng)
+void RSA_Encryptor<Pad>::Encrypt(const byte* plain_arg, word32 sz,
+ byte* cipher_arg,
+ RandomNumberGenerator& rng_arg)
{
PK_Lengths lengths(key_.GetModulus());
assert(sz <= lengths.FixedMaxPlaintextLength());
ByteBlock paddedBlock(lengths.PaddedBlockByteLength());
- padding_.Pad(plain, sz, paddedBlock.get_buffer(),
- lengths.PaddedBlockBitLength(), rng);
+ padding_.Pad(plain_arg, sz, paddedBlock.get_buffer(),
+ lengths.PaddedBlockBitLength(), rng_arg);
key_.ApplyFunction(Integer(paddedBlock.get_buffer(), paddedBlock.size())).
- Encode(cipher, lengths.FixedCiphertextLength());
+ Encode(cipher_arg, lengths.FixedCiphertextLength());
}
// Private Decrypt
template<class Pad>
-word32 RSA_Decryptor<Pad>::Decrypt(const byte* cipher, word32 sz, byte* plain,
- RandomNumberGenerator& rng)
+word32 RSA_Decryptor<Pad>::Decrypt(const byte* cipher_arg, word32 sz,
+ byte* plain_arg,
+ RandomNumberGenerator& rng_arg)
{
PK_Lengths lengths(key_.GetModulus());
assert(sz == lengths.FixedCiphertextLength());
@@ -208,29 +212,29 @@ word32 RSA_Decryptor<Pad>::Decrypt(const byte* cipher, word32 sz, byte* plain,
return 0;
ByteBlock paddedBlock(lengths.PaddedBlockByteLength());
- Integer x = key_.CalculateInverse(rng, Integer(cipher,
+ Integer x = key_.CalculateInverse(rng_arg, Integer(cipher_arg,
lengths.FixedCiphertextLength()).Ref());
if (x.ByteCount() > paddedBlock.size())
x = Integer::Zero(); // don't return false, prevents timing attack
x.Encode(paddedBlock.get_buffer(), paddedBlock.size());
return padding_.UnPad(paddedBlock.get_buffer(),
- lengths.PaddedBlockBitLength(), plain);
+ lengths.PaddedBlockBitLength(), plain_arg);
}
// Private SSL type (block 1) Encrypt
template<class Pad>
void RSA_Decryptor<Pad>::SSL_Sign(const byte* message, word32 sz, byte* sig,
- RandomNumberGenerator& rng)
+ RandomNumberGenerator& rng_arg)
{
RSA_PublicKey inverse;
inverse.Initialize(key_.GetModulus(), key_.GetPrivateExponent());
RSA_Encryptor<RSA_BlockType1> enc(inverse); // SSL Type
- enc.Encrypt(message, sz, sig, rng);
+ enc.Encrypt(message, sz, sig, rng_arg);
}
-word32 SSL_Decrypt(const RSA_PublicKey& key, const byte* sig, byte* plain);
+word32 SSL_Decrypt(const RSA_PublicKey& key, const byte* sig, byte* plain_arg);
// Public SSL type (block 1) Decrypt
@@ -238,10 +242,10 @@ template<class Pad>
bool RSA_Encryptor<Pad>::SSL_Verify(const byte* message, word32 sz,
const byte* sig)
{
- ByteBlock plain(PK_Lengths(key_.GetModulus()).FixedMaxPlaintextLength());
- SSL_Decrypt(key_, sig, plain.get_buffer());
+ ByteBlock local_plain(PK_Lengths(key_.GetModulus()).FixedMaxPlaintextLength());
+ SSL_Decrypt(key_, sig, local_plain.get_buffer());
- if ( (memcmp(plain.get_buffer(), message, sz)) == 0)
+ if ( (memcmp(local_plain.get_buffer(), message, sz)) == 0)
return true;
return false;
}