Make GF2_32 class member of RawIDA
parent
0b1162aa34
commit
13f7bd7ffb
15
ida.cpp
15
ida.cpp
|
|
@ -6,14 +6,9 @@
|
||||||
#include "ida.h"
|
#include "ida.h"
|
||||||
#include "stdcpp.h"
|
#include "stdcpp.h"
|
||||||
#include "algebra.h"
|
#include "algebra.h"
|
||||||
#include "gf2_32.h"
|
|
||||||
#include "polynomi.h"
|
#include "polynomi.h"
|
||||||
#include "polynomi.cpp"
|
#include "polynomi.cpp"
|
||||||
|
|
||||||
ANONYMOUS_NAMESPACE_BEGIN
|
|
||||||
const CryptoPP::GF2_32 field;
|
|
||||||
NAMESPACE_END
|
|
||||||
|
|
||||||
NAMESPACE_BEGIN(CryptoPP)
|
NAMESPACE_BEGIN(CryptoPP)
|
||||||
|
|
||||||
#if (defined(_MSC_VER) && (_MSC_VER < 1400)) && !defined(__MWERKS__)
|
#if (defined(_MSC_VER) && (_MSC_VER < 1400)) && !defined(__MWERKS__)
|
||||||
|
|
@ -145,7 +140,7 @@ void RawIDA::ComputeV(unsigned int i)
|
||||||
if (m_outputToInput[i] == size_t(m_threshold) && i * size_t(m_threshold) <= 1000*1000)
|
if (m_outputToInput[i] == size_t(m_threshold) && i * size_t(m_threshold) <= 1000*1000)
|
||||||
{
|
{
|
||||||
m_v[i].resize(m_threshold);
|
m_v[i].resize(m_threshold);
|
||||||
PrepareBulkPolynomialInterpolationAt(field, m_v[i].begin(), m_outputChannelIds[i], &(m_inputChannelIds[0]), m_w.begin(), m_threshold);
|
PrepareBulkPolynomialInterpolationAt(m_gf32, m_v[i].begin(), m_outputChannelIds[i], &(m_inputChannelIds[0]), m_w.begin(), m_threshold);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -161,7 +156,7 @@ void RawIDA::AddOutputChannel(word32 channelId)
|
||||||
void RawIDA::PrepareInterpolation()
|
void RawIDA::PrepareInterpolation()
|
||||||
{
|
{
|
||||||
CRYPTOPP_ASSERT(m_inputChannelIds.size() == size_t(m_threshold));
|
CRYPTOPP_ASSERT(m_inputChannelIds.size() == size_t(m_threshold));
|
||||||
PrepareBulkPolynomialInterpolation(field, m_w.begin(), &(m_inputChannelIds[0]), (unsigned int)(m_threshold));
|
PrepareBulkPolynomialInterpolation(m_gf32, m_w.begin(), &(m_inputChannelIds[0]), (unsigned int)(m_threshold));
|
||||||
for (unsigned int i=0; i<m_outputChannelIds.size(); i++)
|
for (unsigned int i=0; i<m_outputChannelIds.size(); i++)
|
||||||
ComputeV(i);
|
ComputeV(i);
|
||||||
}
|
}
|
||||||
|
|
@ -190,12 +185,12 @@ void RawIDA::ProcessInputQueues()
|
||||||
if (m_outputToInput[i] != size_t(m_threshold))
|
if (m_outputToInput[i] != size_t(m_threshold))
|
||||||
m_outputQueues[i].PutWord32(m_y[m_outputToInput[i]]);
|
m_outputQueues[i].PutWord32(m_y[m_outputToInput[i]]);
|
||||||
else if (m_v[i].size() == size_t(m_threshold))
|
else if (m_v[i].size() == size_t(m_threshold))
|
||||||
m_outputQueues[i].PutWord32(BulkPolynomialInterpolateAt(field, m_y.begin(), m_v[i].begin(), m_threshold));
|
m_outputQueues[i].PutWord32(BulkPolynomialInterpolateAt(m_gf32, m_y.begin(), m_v[i].begin(), m_threshold));
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_u.resize(m_threshold);
|
m_u.resize(m_threshold);
|
||||||
PrepareBulkPolynomialInterpolationAt(field, m_u.begin(), m_outputChannelIds[i], &(m_inputChannelIds[0]), m_w.begin(), m_threshold);
|
PrepareBulkPolynomialInterpolationAt(m_gf32, m_u.begin(), m_outputChannelIds[i], &(m_inputChannelIds[0]), m_w.begin(), m_threshold);
|
||||||
m_outputQueues[i].PutWord32(BulkPolynomialInterpolateAt(field, m_y.begin(), m_u.begin(), m_threshold));
|
m_outputQueues[i].PutWord32(BulkPolynomialInterpolateAt(m_gf32, m_y.begin(), m_u.begin(), m_threshold));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
6
ida.h
6
ida.h
|
|
@ -11,6 +11,7 @@
|
||||||
#include "filters.h"
|
#include "filters.h"
|
||||||
#include "channels.h"
|
#include "channels.h"
|
||||||
#include "secblock.h"
|
#include "secblock.h"
|
||||||
|
#include "gf2_32.h"
|
||||||
#include "stdcpp.h"
|
#include "stdcpp.h"
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
|
|
||||||
|
|
@ -56,10 +57,11 @@ protected:
|
||||||
std::vector<word32> m_inputChannelIds, m_outputChannelIds, m_outputToInput;
|
std::vector<word32> m_inputChannelIds, m_outputChannelIds, m_outputToInput;
|
||||||
std::vector<std::string> m_outputChannelIdStrings;
|
std::vector<std::string> m_outputChannelIdStrings;
|
||||||
std::vector<ByteQueue> m_outputQueues;
|
std::vector<ByteQueue> m_outputQueues;
|
||||||
int m_threshold;
|
|
||||||
unsigned int m_channelsReady, m_channelsFinished;
|
|
||||||
std::vector<SecBlock<word32> > m_v;
|
std::vector<SecBlock<word32> > m_v;
|
||||||
SecBlock<word32> m_u, m_w, m_y;
|
SecBlock<word32> m_u, m_w, m_y;
|
||||||
|
const GF2_32 m_gf32;
|
||||||
|
unsigned int m_channelsReady, m_channelsFinished;
|
||||||
|
int m_threshold;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// \brief Shamir's Secret Sharing Algorithm
|
/// \brief Shamir's Secret Sharing Algorithm
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue