Restore Referer-Policy and wrap up MbedTLS changes

redbean will now set Referer-Policy to no-referrer-when-downgrade on
text/html responses by default. There's better explanations on the bits
of security redbean is offering. In short, it's 128+ for modern clients
and 112+ for legacy. If the -B flag is used then it's 192+ for modern
and 150+ for non-EC.
This commit is contained in:
Justine Tunney 2021-08-03 22:42:17 -07:00
parent 344d2dc356
commit df8ab0aa0c
32 changed files with 679 additions and 663 deletions

View file

@ -1114,49 +1114,3 @@ BENCH(cmpint, bench) {
EZBENCH2("cmpint 3.1", donothing, mbedtls_mpi_cmp_int(&z, 0));
EZBENCH2("cmpint 3.2", donothing, mbedtls_mpi_cmp_int(&z, 1));
}
mbedtls_mpi_uint F1(mbedtls_mpi_uint *d, const mbedtls_mpi_uint *a,
const mbedtls_mpi_uint *b, size_t n) {
size_t i;
unsigned char cf;
mbedtls_mpi_uint c, x;
cf = c = i = 0;
for (; i < n; ++i) SBB(d[i], a[i], b[i], c, c);
return c;
}
mbedtls_mpi_uint F2(mbedtls_mpi_uint *d, const mbedtls_mpi_uint *a,
const mbedtls_mpi_uint *b, size_t n) {
size_t i;
unsigned char cf;
mbedtls_mpi_uint c, x;
cf = c = i = 0;
asm volatile("xor\t%1,%1\n\t"
".align\t16\n1:\t"
"mov\t(%5,%3,8),%1\n\t"
"sbb\t(%6,%3,8),%1\n\t"
"mov\t%1,(%4,%3,8)\n\t"
"lea\t1(%3),%3\n\t"
"dec\t%2\n\t"
"jnz\t1b"
: "=@ccb"(cf), "=&r"(x), "+c"(n), "=r"(i)
: "r"(d), "r"(a), "r"(b), "3"(0)
: "cc", "memory");
return cf;
}
TEST(wut, wut) {
uint64_t A[8];
uint64_t B[8];
uint64_t C[8];
uint64_t D[8];
int i;
for (i = 0; i < 1000; ++i) {
rngset(A, sizeof(A), rand64, -1);
rngset(B, sizeof(B), rand64, -1);
int x = F1(C, A, B, 8);
int y = F2(D, A, B, 8);
ASSERT_EQ(x, y);
ASSERT_EQ(0, memcmp(C, D, sizeof(C)));
}
}