Skip to content

Commit ea8a068

Browse files
committed
removing deprecated calls
1 parent f0b1a86 commit ea8a068

File tree

2 files changed

+48
-54
lines changed

2 files changed

+48
-54
lines changed

libOTe/Tools/Tools.cpp

+48-52
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,8 @@ using std::array;
2222
namespace osuCrypto {
2323

2424

25-
//bool gUseBgicksPprf(true);
26-
27-
//using namespace std;
28-
29-
// Utility function to do modular exponentiation.
30-
// It returns (x^y) % p
25+
// Utility function to do modular exponentiation.
26+
// It returns (x^y) % p
3127
u64 power(u64 x, u64 y, u64 p)
3228
{
3329
u64 res = 1; // Initialize result
@@ -105,14 +101,14 @@ namespace osuCrypto {
105101

106102
bool isPrime(u64 n)
107103
{
108-
PRNG prng(ZeroBlock);
104+
PRNG prng(oc::sysRandomSeed());
109105
return isPrime(n, prng);
110106
}
111107

112108

113109
u64 nextPrime(u64 n)
114110
{
115-
PRNG prng(ZeroBlock);
111+
PRNG prng(oc::sysRandomSeed());
116112

117113
while (isPrime(n, prng) == false)
118114
++n;
@@ -335,8 +331,8 @@ namespace osuCrypto {
335331
outU16View[16 * x + 7 - j][y] = in[0].movemask_epi8();
336332
outU16View[16 * x + 15 - j][y] = in[1].movemask_epi8();
337333

338-
in[0] = (in[0] << 1);
339-
in[1] = (in[1] << 1);
334+
in[0] = in[0].slli_epi64(1);
335+
in[1] = in[1].slli_epi64(1);
340336
}
341337
}
342338

@@ -494,14 +490,14 @@ namespace osuCrypto {
494490
out7 -= out.stride();
495491

496492
// shift the 128 values so that the top bit is now the next one.
497-
t.blks[0] = (t.blks[0] << 1);
498-
t.blks[1] = (t.blks[1] << 1);
499-
t.blks[2] = (t.blks[2] << 1);
500-
t.blks[3] = (t.blks[3] << 1);
501-
t.blks[4] = (t.blks[4] << 1);
502-
t.blks[5] = (t.blks[5] << 1);
503-
t.blks[6] = (t.blks[6] << 1);
504-
t.blks[7] = (t.blks[7] << 1);
493+
t.blks[0] = t.blks[0].slli_epi64(1);
494+
t.blks[1] = t.blks[1].slli_epi64(1);
495+
t.blks[2] = t.blks[2].slli_epi64(1);
496+
t.blks[3] = t.blks[3].slli_epi64(1);
497+
t.blks[4] = t.blks[4].slli_epi64(1);
498+
t.blks[5] = t.blks[5].slli_epi64(1);
499+
t.blks[6] = t.blks[6].slli_epi64(1);
500+
t.blks[7] = t.blks[7].slli_epi64(1);
505501
}
506502
}
507503
}
@@ -550,15 +546,15 @@ namespace osuCrypto {
550546
auto out0 = outStart + (chunkSize * subBlockHight + hh) * 8 * out.stride() + w * 2;
551547

552548
out0 -= out.stride() * skip;
553-
t.blks[0] = (t.blks[0] << int(skip));
549+
t.blks[0] = t.blks[0].slli_epi64(skip);
554550

555551
for (int j = 0; j < rem; j++)
556552
{
557553
*(u16*)out0 = t.blks[0].movemask_epi8();
558554

559555
out0 -= out.stride();
560556

561-
t.blks[0] = (t.blks[0] << 1);
557+
t.blks[0] = t.blks[0].slli_epi64(1);
562558
}
563559
}
564560
}
@@ -623,14 +619,14 @@ namespace osuCrypto {
623619
out6 -= out.stride();
624620
out7 -= out.stride();
625621

626-
t.blks[0] = (t.blks[0] << 1);
627-
t.blks[1] = (t.blks[1] << 1);
628-
t.blks[2] = (t.blks[2] << 1);
629-
t.blks[3] = (t.blks[3] << 1);
630-
t.blks[4] = (t.blks[4] << 1);
631-
t.blks[5] = (t.blks[5] << 1);
632-
t.blks[6] = (t.blks[6] << 1);
633-
t.blks[7] = (t.blks[7] << 1);
622+
t.blks[0] = t.blks[0].slli_epi64(1);
623+
t.blks[1] = t.blks[1].slli_epi64(1);
624+
t.blks[2] = t.blks[2].slli_epi64(1);
625+
t.blks[3] = t.blks[3].slli_epi64(1);
626+
t.blks[4] = t.blks[4].slli_epi64(1);
627+
t.blks[5] = t.blks[5].slli_epi64(1);
628+
t.blks[6] = t.blks[6].slli_epi64(1);
629+
t.blks[7] = t.blks[7].slli_epi64(1);
634630
}
635631
}
636632
else
@@ -655,14 +651,14 @@ namespace osuCrypto {
655651
out6 -= out.stride();
656652
out7 -= out.stride();
657653

658-
t.blks[0] = (t.blks[0] << 1);
659-
t.blks[1] = (t.blks[1] << 1);
660-
t.blks[2] = (t.blks[2] << 1);
661-
t.blks[3] = (t.blks[3] << 1);
662-
t.blks[4] = (t.blks[4] << 1);
663-
t.blks[5] = (t.blks[5] << 1);
664-
t.blks[6] = (t.blks[6] << 1);
665-
t.blks[7] = (t.blks[7] << 1);
654+
t.blks[0] = t.blks[0].slli_epi64(1);
655+
t.blks[1] = t.blks[1].slli_epi64(1);
656+
t.blks[2] = t.blks[2].slli_epi64(1);
657+
t.blks[3] = t.blks[3].slli_epi64(1);
658+
t.blks[4] = t.blks[4].slli_epi64(1);
659+
t.blks[5] = t.blks[5].slli_epi64(1);
660+
t.blks[6] = t.blks[6].slli_epi64(1);
661+
t.blks[7] = t.blks[7].slli_epi64(1);
666662
}
667663
}
668664
}
@@ -936,14 +932,14 @@ namespace osuCrypto {
936932
auto x16_7 = x * 16 + 7;
937933
auto x16_15 = x * 16 + 15;
938934

939-
block b0 = (in[0] << 0);
940-
block b1 = (in[0] << 1);
941-
block b2 = (in[0] << 2);
942-
block b3 = (in[0] << 3);
943-
block b4 = (in[0] << 4);
944-
block b5 = (in[0] << 5);
945-
block b6 = (in[0] << 6);
946-
block b7 = (in[0] << 7);
935+
block b0 = in[0].slli_epi64(0);
936+
block b1 = in[0].slli_epi64(1);
937+
block b2 = in[0].slli_epi64(2);
938+
block b3 = in[0].slli_epi64(3);
939+
block b4 = in[0].slli_epi64(4);
940+
block b5 = in[0].slli_epi64(5);
941+
block b6 = in[0].slli_epi64(6);
942+
block b7 = in[0].slli_epi64(7);
947943

948944
outU16View[x16_7 - 0][i8y] = b0.movemask_epi8();
949945
outU16View[x16_7 - 1][i8y] = b1.movemask_epi8();
@@ -954,14 +950,14 @@ namespace osuCrypto {
954950
outU16View[x16_7 - 6][i8y] = b6.movemask_epi8();
955951
outU16View[x16_7 - 7][i8y] = b7.movemask_epi8();
956952

957-
b0 = (in[1] << 0);
958-
b1 = (in[1] << 1);
959-
b2 = (in[1] << 2);
960-
b3 = (in[1] << 3);
961-
b4 = (in[1] << 4);
962-
b5 = (in[1] << 5);
963-
b6 = (in[1] << 6);
964-
b7 = (in[1] << 7);
953+
b0 = in[1].slli_epi64(0);
954+
b1 = in[1].slli_epi64(1);
955+
b2 = in[1].slli_epi64(2);
956+
b3 = in[1].slli_epi64(3);
957+
b4 = in[1].slli_epi64(4);
958+
b5 = in[1].slli_epi64(5);
959+
b6 = in[1].slli_epi64(6);
960+
b7 = in[1].slli_epi64(7);
965961

966962
outU16View[x16_15 - 0][i8y] = b0.movemask_epi8();
967963
outU16View[x16_15 - 1][i8y] = b1.movemask_epi8();

libOTe/Triple/Foleage/fft/FoleageFft.h

-2
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@
55
#include "cryptoTools/Common/Defines.h"
66
#include "cryptoTools/Common/MatrixView.h"
77
#include "libOTe/Triple/Foleage/FoleageUtils.h"
8-
#include <immintrin.h>
98

10-
//#include "libOTe/Tools/Foleage/utils.h"
119
namespace osuCrypto {
1210

1311
//typedef __int128 int128_t;

0 commit comments

Comments
 (0)