Bug 1521360 - ensure that Prio early cleanup runs correctly r=henrycg

Differential Revision: https://phabricator.services.mozilla.com/D17309

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Robert Helmer 2019-02-08 22:52:56 +00:00
Родитель f9cb3cc490
Коммит ea4a0e3afc
2 изменённых файлов: 27 добавлений и 14 удалений

10
third_party/prio/prio/client.c поставляемый
Просмотреть файл

@ -287,9 +287,6 @@ PrioClient_encode(const_PrioConfig cfg, const bool* data_in,
*for_server_a = NULL;
*for_server_b = NULL;
P_CHECKA(pA = PrioPacketClient_new(cfg, PRIO_SERVER_A));
P_CHECKA(pB = PrioPacketClient_new(cfg, PRIO_SERVER_B));
msgpack_sbuffer sbufA, sbufB;
msgpack_packer packerA, packerB;
@ -298,6 +295,9 @@ PrioClient_encode(const_PrioConfig cfg, const bool* data_in,
msgpack_packer_init(&packerA, &sbufA, msgpack_sbuffer_write);
msgpack_packer_init(&packerB, &sbufB, msgpack_sbuffer_write);
P_CHECKA(pA = PrioPacketClient_new(cfg, PRIO_SERVER_A));
P_CHECKA(pB = PrioPacketClient_new(cfg, PRIO_SERVER_B));
P_CHECKC(PrioPacketClient_set_data(cfg, data_in, pA, pB));
P_CHECKC(serial_write_packet_client(&packerA, pA, cfg));
P_CHECKC(serial_write_packet_client(&packerB, pB, cfg));
@ -343,7 +343,9 @@ PrioPacketClient_decrypt(PrioPacketClient p, const_PrioConfig cfg,
{
SECStatus rv = SECSuccess;
msgpack_unpacker upk;
P_CHECKCB(msgpack_unpacker_init(&upk, data_len));
if (!msgpack_unpacker_init(&upk, data_len)) {
return SECFailure;
}
// Decrypt the ciphertext into dec_buf
unsigned int bytes_decrypted;

31
third_party/prio/prio/serial.c поставляемый
Просмотреть файл

@ -58,12 +58,14 @@ static SECStatus
serial_read_mp_int(msgpack_unpacker* upk, mp_int* n, const mp_int* max)
{
SECStatus rv = SECSuccess;
msgpack_unpacked res;
msgpack_unpacked_init(&res);
P_CHECKCB(upk != NULL);
P_CHECKCB(n != NULL);
P_CHECKCB(max != NULL);
msgpack_unpacked res;
msgpack_unpacked_init(&res);
UP_CHECK(msgpack_unpacker_next(upk, &res))
msgpack_object obj = res.data;
@ -79,11 +81,13 @@ static SECStatus
serial_read_int(msgpack_unpacker* upk, int* n)
{
SECStatus rv = SECSuccess;
P_CHECKCB(upk != NULL);
P_CHECKCB(n != NULL);
msgpack_unpacked res;
msgpack_unpacked_init(&res);
P_CHECKCB(upk != NULL);
P_CHECKCB(n != NULL);
UP_CHECK(msgpack_unpacker_next(upk, &res))
msgpack_object obj = res.data;
@ -118,12 +122,14 @@ serial_read_mp_array(msgpack_unpacker* upk, MPArray arr, size_t len,
const mp_int* max)
{
SECStatus rv = SECSuccess;
msgpack_unpacked res;
msgpack_unpacked_init(&res);
P_CHECKCB(upk != NULL);
P_CHECKCB(arr != NULL);
P_CHECKCB(max != NULL);
msgpack_unpacked res;
msgpack_unpacked_init(&res);
UP_CHECK(msgpack_unpacker_next(upk, &res))
msgpack_object obj = res.data;
@ -223,11 +229,13 @@ static SECStatus
serial_read_prg_seed(msgpack_unpacker* upk, PrioPRGSeed* seed)
{
SECStatus rv = SECSuccess;
P_CHECKCB(upk != NULL);
P_CHECKCB(seed != NULL);
msgpack_unpacked res;
msgpack_unpacked_init(&res);
P_CHECKCB(upk != NULL);
P_CHECKCB(seed != NULL);
UP_CHECK(msgpack_unpacker_next(upk, &res))
msgpack_object obj = res.data;
@ -322,10 +330,13 @@ serial_read_packet_client(msgpack_unpacker* upk, PrioPacketClient p,
const_PrioConfig cfg)
{
SECStatus rv = SECSuccess;
P_CHECKCB(upk != NULL);
P_CHECKCB(p != NULL);
msgpack_unpacked res;
msgpack_unpacked_init(&res);
P_CHECKCB(upk != NULL);
P_CHECKCB(p != NULL);
UP_CHECK(msgpack_unpacker_next(upk, &res))
msgpack_object obj = res.data;