2019-09-24 12:21:05 +01:00
|
|
|
#include "blas.h"
|
|
|
|
#include "gf.h"
|
|
|
|
|
|
|
|
#include <stddef.h>
|
|
|
|
|
2020-11-27 17:55:15 +00:00
|
|
|
void PQCLEAN_RAINBOWVCLASSIC_CLEAN_gf256v_predicated_add(uint8_t *accu_b, uint8_t predicate, const uint8_t *a, size_t _num_byte) {
|
2019-09-24 12:21:05 +01:00
|
|
|
uint8_t pr_u8 = (uint8_t) ((uint8_t) 0 - predicate);
|
|
|
|
for (size_t i = 0; i < _num_byte; i++) {
|
|
|
|
accu_b[i] ^= (a[i] & pr_u8);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-11-27 17:55:15 +00:00
|
|
|
void PQCLEAN_RAINBOWVCLASSIC_CLEAN_gf256v_add(uint8_t *accu_b, const uint8_t *a, size_t _num_byte) {
|
2019-09-24 12:21:05 +01:00
|
|
|
for (size_t i = 0; i < _num_byte; i++) {
|
|
|
|
accu_b[i] ^= a[i];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-11-27 17:55:15 +00:00
|
|
|
void PQCLEAN_RAINBOWVCLASSIC_CLEAN_gf256v_mul_scalar(uint8_t *a, uint8_t b, size_t _num_byte) {
|
2019-09-24 12:21:05 +01:00
|
|
|
for (size_t i = 0; i < _num_byte; i++) {
|
2020-11-27 17:55:15 +00:00
|
|
|
a[i] = PQCLEAN_RAINBOWVCLASSIC_CLEAN_gf256_mul(a[i], b);
|
2019-09-24 12:21:05 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-11-27 17:55:15 +00:00
|
|
|
void PQCLEAN_RAINBOWVCLASSIC_CLEAN_gf256v_madd(uint8_t *accu_c, const uint8_t *a, uint8_t gf256_b, size_t _num_byte) {
|
2019-09-24 12:21:05 +01:00
|
|
|
for (size_t i = 0; i < _num_byte; i++) {
|
2020-11-27 17:55:15 +00:00
|
|
|
accu_c[i] ^= PQCLEAN_RAINBOWVCLASSIC_CLEAN_gf256_mul(a[i], gf256_b);
|
2019-09-24 12:21:05 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|