Browse Source

fixed android build

pull/1190/head
orignal 7 years ago
parent
commit
4cedaa9e80
  1. 65
      libi2pd/Poly1305.cpp

65
libi2pd/Poly1305.cpp

@ -1,6 +1,4 @@
#include "Poly1305.h" #include "Poly1305.h"
#include "CPU.h"
#include <immintrin.h>
/** /**
This code is licensed under the MCGSI Public License This code is licensed under the MCGSI Public License
Copyright 2018 Jeff Becker Copyright 2018 Jeff Becker
@ -12,48 +10,6 @@ namespace i2p
{ {
namespace crypto namespace crypto
{ {
#if 0
#ifdef __AVX2__
struct Poly1305_AVX2
{
Poly1305_AVX2(const uint32_t *& k)
{
__asm__
(
"VMOVNTDQA %[key0], %%ymm0 \n"
"VMOVNTDQA 32%[key0], %%ymm1 \n"
:
:
[key0]"m"(k)
);
};
~Poly1305_AVX2()
{
// clear out registers
__asm__
(
"VZEROALL\n"
);
}
void Update(const uint8_t * buf, size_t sz)
{
}
void Finish(uint32_t *& out)
{
}
size_t leftover;
};
#endif
#endif
namespace poly1305 namespace poly1305
{ {
@ -281,23 +237,10 @@ namespace crypto
void Poly1305HMAC(uint32_t * out, const uint32_t * key, const uint8_t * buf, std::size_t sz) void Poly1305HMAC(uint32_t * out, const uint32_t * key, const uint8_t * buf, std::size_t sz)
{ {
#if 0 const uint8_t * k = (const uint8_t *) key;
#ifdef __AVX2__ Poly1305 p(k);
if(i2p::cpu::avx2) p.Update(buf, sz);
{ p.Finish(out);
Poly1305_AVX2 p(key);
p.Update(buf, sz);
p.Finish(out);
}
else
#endif
#endif
{
const uint8_t * k = (const uint8_t *) key;
Poly1305 p(k);
p.Update(buf, sz);
p.Finish(out);
}
} }
} }
} }

Loading…
Cancel
Save