mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
fix format issue for source files
This commit is contained in:
parent
5f919d02ab
commit
6f7ff2dcd4
@ -67,22 +67,22 @@ deckeccak(512)
|
|||||||
|
|
||||||
/*** Constants. ***/
|
/*** Constants. ***/
|
||||||
static const uint8_t rho[24] = \
|
static const uint8_t rho[24] = \
|
||||||
{ 1, 3, 6, 10, 15, 21,
|
{ 1, 3, 6, 10, 15, 21,
|
||||||
28, 36, 45, 55, 2, 14,
|
28, 36, 45, 55, 2, 14,
|
||||||
27, 41, 56, 8, 25, 43,
|
27, 41, 56, 8, 25, 43,
|
||||||
62, 18, 39, 61, 20, 44};
|
62, 18, 39, 61, 20, 44};
|
||||||
static const uint8_t pi[24] = \
|
static const uint8_t pi[24] = \
|
||||||
{10, 7, 11, 17, 18, 3,
|
{10, 7, 11, 17, 18, 3,
|
||||||
5, 16, 8, 21, 24, 4,
|
5, 16, 8, 21, 24, 4,
|
||||||
15, 23, 19, 13, 12, 2,
|
15, 23, 19, 13, 12, 2,
|
||||||
20, 14, 22, 9, 6, 1};
|
20, 14, 22, 9, 6, 1};
|
||||||
static const uint64_t RC[24] = \
|
static const uint64_t RC[24] = \
|
||||||
{1ULL, 0x8082ULL, 0x800000000000808aULL, 0x8000000080008000ULL,
|
{1ULL, 0x8082ULL, 0x800000000000808aULL, 0x8000000080008000ULL,
|
||||||
0x808bULL, 0x80000001ULL, 0x8000000080008081ULL, 0x8000000000008009ULL,
|
0x808bULL, 0x80000001ULL, 0x8000000080008081ULL, 0x8000000000008009ULL,
|
||||||
0x8aULL, 0x88ULL, 0x80008009ULL, 0x8000000aULL,
|
0x8aULL, 0x88ULL, 0x80008009ULL, 0x8000000aULL,
|
||||||
0x8000808bULL, 0x800000000000008bULL, 0x8000000000008089ULL, 0x8000000000008003ULL,
|
0x8000808bULL, 0x800000000000008bULL, 0x8000000000008089ULL, 0x8000000000008003ULL,
|
||||||
0x8000000000008002ULL, 0x8000000000000080ULL, 0x800aULL, 0x800000008000000aULL,
|
0x8000000000008002ULL, 0x8000000000000080ULL, 0x800aULL, 0x800000008000000aULL,
|
||||||
0x8000000080008081ULL, 0x8000000000008080ULL, 0x80000001ULL, 0x8000000080008008ULL};
|
0x8000000080008081ULL, 0x8000000000008080ULL, 0x80000001ULL, 0x8000000080008008ULL};
|
||||||
|
|
||||||
/*** Helper macros to unroll the permutation. ***/
|
/*** Helper macros to unroll the permutation. ***/
|
||||||
#define rol(x, s) (((x) << s) | ((x) >> (64 - s)))
|
#define rol(x, s) (((x) << s) | ((x) >> (64 - s)))
|
||||||
@ -95,36 +95,37 @@ static const uint64_t RC[24] = \
|
|||||||
|
|
||||||
/*** Keccak-f[1600] ***/
|
/*** Keccak-f[1600] ***/
|
||||||
static inline void keccakf(void* state) {
|
static inline void keccakf(void* state) {
|
||||||
uint64_t* a = (uint64_t*)state;
|
uint64_t* a = (uint64_t*)state;
|
||||||
uint64_t b[5] = {0};
|
uint64_t b[5] = {0};
|
||||||
|
|
||||||
for (int i = 0; i < 24; i++) {
|
for (int i = 0; i < 24; i++)
|
||||||
uint8_t x, y;
|
{
|
||||||
// Theta
|
uint8_t x, y;
|
||||||
FOR5(x, 1,
|
// Theta
|
||||||
b[x] = 0;
|
FOR5(x, 1,
|
||||||
FOR5(y, 5,
|
b[x] = 0;
|
||||||
b[x] ^= a[x + y]; ))
|
FOR5(y, 5,
|
||||||
FOR5(x, 1,
|
b[x] ^= a[x + y]; ))
|
||||||
FOR5(y, 5,
|
FOR5(x, 1,
|
||||||
a[y + x] ^= b[(x + 4) % 5] ^ rol(b[(x + 1) % 5], 1); ))
|
FOR5(y, 5,
|
||||||
// Rho and pi
|
a[y + x] ^= b[(x + 4) % 5] ^ rol(b[(x + 1) % 5], 1); ))
|
||||||
uint64_t t = a[1];
|
// Rho and pi
|
||||||
x = 0;
|
uint64_t t = a[1];
|
||||||
REPEAT24(b[0] = a[pi[x]];
|
x = 0;
|
||||||
a[pi[x]] = rol(t, rho[x]);
|
REPEAT24(b[0] = a[pi[x]];
|
||||||
t = b[0];
|
a[pi[x]] = rol(t, rho[x]);
|
||||||
x++; )
|
t = b[0];
|
||||||
// Chi
|
x++; )
|
||||||
FOR5(y,
|
// Chi
|
||||||
5,
|
FOR5(y,
|
||||||
FOR5(x, 1,
|
5,
|
||||||
b[x] = a[y + x];)
|
FOR5(x, 1,
|
||||||
FOR5(x, 1,
|
b[x] = a[y + x];)
|
||||||
a[y + x] = b[x] ^ ((~b[(x + 1) % 5]) & b[(x + 2) % 5]); ))
|
FOR5(x, 1,
|
||||||
// Iota
|
a[y + x] = b[x] ^ ((~b[(x + 1) % 5]) & b[(x + 2) % 5]); ))
|
||||||
a[0] ^= RC[i];
|
// Iota
|
||||||
}
|
a[0] ^= RC[i];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/******** The FIPS202-defined functions. ********/
|
/******** The FIPS202-defined functions. ********/
|
||||||
@ -166,24 +167,25 @@ mkapply_sd(setout, dst[i] = src[i]) // setout
|
|||||||
static inline int hash(uint8_t* out, size_t outlen,
|
static inline int hash(uint8_t* out, size_t outlen,
|
||||||
const uint8_t* in, size_t inlen,
|
const uint8_t* in, size_t inlen,
|
||||||
size_t rate, uint8_t delim) {
|
size_t rate, uint8_t delim) {
|
||||||
if ((out == NULL) || ((in == NULL) && inlen != 0) || (rate >= Plen)) {
|
if ((out == NULL) || ((in == NULL) && inlen != 0) || (rate >= Plen))
|
||||||
return -1;
|
{
|
||||||
}
|
return -1;
|
||||||
uint8_t a[Plen] = {0};
|
}
|
||||||
// Absorb input.
|
uint8_t a[Plen] = {0};
|
||||||
foldP(in, inlen, xorin);
|
// Absorb input.
|
||||||
// Xor in the DS and pad frame.
|
foldP(in, inlen, xorin);
|
||||||
a[inlen] ^= delim;
|
// Xor in the DS and pad frame.
|
||||||
a[rate - 1] ^= 0x80;
|
a[inlen] ^= delim;
|
||||||
// Xor in the last block.
|
a[rate - 1] ^= 0x80;
|
||||||
xorin(a, in, inlen);
|
// Xor in the last block.
|
||||||
// Apply P
|
xorin(a, in, inlen);
|
||||||
P(a);
|
// Apply P
|
||||||
// Squeeze output.
|
P(a);
|
||||||
foldP(out, outlen, setout);
|
// Squeeze output.
|
||||||
setout(a, out, outlen);
|
foldP(out, outlen, setout);
|
||||||
memset(a, 0, 200);
|
setout(a, out, outlen);
|
||||||
return 0;
|
memset(a, 0, 200);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*** Helper macros to define SHA3 and SHAKE instances. ***/
|
/*** Helper macros to define SHA3 and SHAKE instances. ***/
|
||||||
|
@ -736,7 +736,8 @@ bool CommandLineInterface::processInput()
|
|||||||
if (m_args.count(g_argAllowPaths))
|
if (m_args.count(g_argAllowPaths))
|
||||||
{
|
{
|
||||||
vector<string> paths;
|
vector<string> paths;
|
||||||
for (string const& path: boost::split(paths, m_args[g_argAllowPaths].as<string>(), boost::is_any_of(","))) {
|
for (string const& path: boost::split(paths, m_args[g_argAllowPaths].as<string>(), boost::is_any_of(",")))
|
||||||
|
{
|
||||||
auto filesystem_path = boost::filesystem::path(path);
|
auto filesystem_path = boost::filesystem::path(path);
|
||||||
// If the given path had a trailing slash, the Boost filesystem
|
// If the given path had a trailing slash, the Boost filesystem
|
||||||
// path will have it's last component set to '.'. This breaks
|
// path will have it's last component set to '.'. This breaks
|
||||||
|
Loading…
Reference in New Issue
Block a user