2020-08-29 01:18:54 +01:00
|
|
|
#include "crypto_encode_653x4621.h"
|
|
|
|
|
|
|
|
/* auto-generated; do not edit */
|
|
|
|
|
|
|
|
#define int16 int16_t
|
|
|
|
#define uint16 uint16_t
|
|
|
|
#define uint32 uint32_t
|
|
|
|
|
|
|
|
void PQCLEAN_SNTRUP653_CLEAN_crypto_encode_653x4621(unsigned char *out, const void *v) {
|
|
|
|
const int16 *R0 = v;
|
|
|
|
/* XXX: caller could overlap R with input */
|
|
|
|
uint16 R[327];
|
|
|
|
long i;
|
|
|
|
uint16 r0, r1;
|
|
|
|
uint32 r2;
|
|
|
|
|
|
|
|
for (i = 0; i < 326; ++i) {
|
2020-09-01 20:16:45 +01:00
|
|
|
r0 = (uint16) ((R0[2 * i] + 2310) & 16383);
|
|
|
|
r1 = (uint16) ((R0[2 * i + 1] + 2310) & 16383);
|
2020-08-29 01:18:54 +01:00
|
|
|
r2 = r0 + r1 * (uint32)4621;
|
2020-09-01 12:55:46 +01:00
|
|
|
*out++ = (unsigned char) r2;
|
2020-08-29 01:18:54 +01:00
|
|
|
r2 >>= 8;
|
2020-09-01 12:55:46 +01:00
|
|
|
*out++ = (unsigned char) r2;
|
2020-08-29 01:18:54 +01:00
|
|
|
r2 >>= 8;
|
2020-09-01 12:55:46 +01:00
|
|
|
R[i] = (uint16) r2;
|
2020-08-29 01:18:54 +01:00
|
|
|
}
|
2020-09-01 20:16:45 +01:00
|
|
|
R[326] = (uint16) ((R0[652] + 2310) & 16383);
|
2020-08-29 01:18:54 +01:00
|
|
|
|
|
|
|
for (i = 0; i < 163; ++i) {
|
|
|
|
r0 = R[2 * i];
|
|
|
|
r1 = R[2 * i + 1];
|
|
|
|
r2 = r0 + r1 * (uint32)326;
|
2020-09-01 12:55:46 +01:00
|
|
|
*out++ = (unsigned char) r2;
|
2020-08-29 01:18:54 +01:00
|
|
|
r2 >>= 8;
|
2020-09-01 12:55:46 +01:00
|
|
|
R[i] = (uint16) r2;
|
2020-08-29 01:18:54 +01:00
|
|
|
}
|
|
|
|
R[163] = R[326];
|
|
|
|
|
|
|
|
for (i = 0; i < 82; ++i) {
|
|
|
|
r0 = R[2 * i];
|
|
|
|
r1 = R[2 * i + 1];
|
|
|
|
r2 = r0 + r1 * (uint32)416;
|
2020-09-01 12:55:46 +01:00
|
|
|
*out++ = (unsigned char) r2;
|
2020-08-29 01:18:54 +01:00
|
|
|
r2 >>= 8;
|
2020-09-01 12:55:46 +01:00
|
|
|
R[i] = (uint16) r2;
|
2020-08-29 01:18:54 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < 40; ++i) {
|
|
|
|
r0 = R[2 * i];
|
|
|
|
r1 = R[2 * i + 1];
|
|
|
|
r2 = r0 + r1 * (uint32)676;
|
2020-09-01 12:55:46 +01:00
|
|
|
*out++ = (unsigned char) r2;
|
2020-08-29 01:18:54 +01:00
|
|
|
r2 >>= 8;
|
2020-09-01 12:55:46 +01:00
|
|
|
R[i] = (uint16) r2;
|
2020-08-29 01:18:54 +01:00
|
|
|
}
|
|
|
|
r0 = R[80];
|
|
|
|
r1 = R[81];
|
|
|
|
r2 = r0 + r1 * (uint32)676;
|
2020-09-01 12:55:46 +01:00
|
|
|
*out++ = (unsigned char) r2;
|
2020-08-29 01:18:54 +01:00
|
|
|
r2 >>= 8;
|
2020-09-01 12:55:46 +01:00
|
|
|
*out++ = (unsigned char) r2;
|
2020-08-29 01:18:54 +01:00
|
|
|
r2 >>= 8;
|
2020-09-01 12:55:46 +01:00
|
|
|
R[40] = (uint16) r2;
|
2020-08-29 01:18:54 +01:00
|
|
|
|
|
|
|
for (i = 0; i < 20; ++i) {
|
|
|
|
r0 = R[2 * i];
|
|
|
|
r1 = R[2 * i + 1];
|
|
|
|
r2 = r0 + r1 * (uint32)1786;
|
2020-09-01 12:55:46 +01:00
|
|
|
*out++ = (unsigned char) r2;
|
2020-08-29 01:18:54 +01:00
|
|
|
r2 >>= 8;
|
2020-09-01 12:55:46 +01:00
|
|
|
R[i] = (uint16) r2;
|
2020-08-29 01:18:54 +01:00
|
|
|
}
|
|
|
|
R[20] = R[40];
|
|
|
|
|
|
|
|
for (i = 0; i < 10; ++i) {
|
|
|
|
r0 = R[2 * i];
|
|
|
|
r1 = R[2 * i + 1];
|
|
|
|
r2 = r0 + r1 * (uint32)12461;
|
2020-09-01 12:55:46 +01:00
|
|
|
*out++ = (unsigned char) r2;
|
2020-08-29 01:18:54 +01:00
|
|
|
r2 >>= 8;
|
2020-09-01 12:55:46 +01:00
|
|
|
*out++ = (unsigned char) r2;
|
2020-08-29 01:18:54 +01:00
|
|
|
r2 >>= 8;
|
2020-09-01 12:55:46 +01:00
|
|
|
R[i] = (uint16) r2;
|
2020-08-29 01:18:54 +01:00
|
|
|
}
|
|
|
|
R[10] = R[20];
|
|
|
|
|
|
|
|
for (i = 0; i < 5; ++i) {
|
|
|
|
r0 = R[2 * i];
|
|
|
|
r1 = R[2 * i + 1];
|
|
|
|
r2 = r0 + r1 * (uint32)2370;
|
2020-09-01 12:55:46 +01:00
|
|
|
*out++ = (unsigned char) r2;
|
2020-08-29 01:18:54 +01:00
|
|
|
r2 >>= 8;
|
2020-09-01 12:55:46 +01:00
|
|
|
*out++ = (unsigned char) r2;
|
2020-08-29 01:18:54 +01:00
|
|
|
r2 >>= 8;
|
2020-09-01 12:55:46 +01:00
|
|
|
R[i] = (uint16) r2;
|
2020-08-29 01:18:54 +01:00
|
|
|
}
|
|
|
|
R[5] = R[10];
|
|
|
|
|
|
|
|
for (i = 0; i < 3; ++i) {
|
|
|
|
r0 = R[2 * i];
|
|
|
|
r1 = R[2 * i + 1];
|
|
|
|
r2 = r0 + r1 * (uint32)86;
|
2020-09-01 12:55:46 +01:00
|
|
|
R[i] = (uint16) r2;
|
2020-08-29 01:18:54 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
r0 = R[0];
|
|
|
|
r1 = R[1];
|
|
|
|
r2 = r0 + r1 * (uint32)7396;
|
2020-09-01 12:55:46 +01:00
|
|
|
*out++ = (unsigned char) r2;
|
2020-08-29 01:18:54 +01:00
|
|
|
r2 >>= 8;
|
2020-09-01 12:55:46 +01:00
|
|
|
*out++ = (unsigned char) r2;
|
2020-08-29 01:18:54 +01:00
|
|
|
r2 >>= 8;
|
2020-09-01 12:55:46 +01:00
|
|
|
R[0] = (uint16) r2;
|
2020-08-29 01:18:54 +01:00
|
|
|
R[1] = R[2];
|
|
|
|
|
|
|
|
r0 = R[0];
|
|
|
|
r1 = R[1];
|
|
|
|
r2 = r0 + r1 * (uint32)835;
|
2020-09-01 12:55:46 +01:00
|
|
|
*out++ = (unsigned char) r2;
|
2020-08-29 01:18:54 +01:00
|
|
|
r2 >>= 8;
|
2020-09-01 12:55:46 +01:00
|
|
|
*out++ = (unsigned char) r2;
|
2020-08-29 01:18:54 +01:00
|
|
|
r2 >>= 8;
|
2020-09-01 12:55:46 +01:00
|
|
|
R[0] = (uint16) r2;
|
2020-08-29 01:18:54 +01:00
|
|
|
|
|
|
|
r0 = R[0];
|
2020-09-01 20:16:45 +01:00
|
|
|
*out++ = (unsigned char) r0;
|
2020-08-29 01:18:54 +01:00
|
|
|
}
|