OCBv3: fix demos/timing failures
This commit is contained in:
parent
3ecd18763b
commit
6ac1c5fa34
@ -1273,7 +1273,7 @@ static void time_encmacs_(unsigned long MAC_SIZE)
|
|||||||
t_start();
|
t_start();
|
||||||
t1 = t_read();
|
t1 = t_read();
|
||||||
z = 16;
|
z = 16;
|
||||||
if ((err = ocb3_encrypt_authenticate_memory(cipher_idx, key, 16, IV, 16, (unsigned char*)"", 0, buf, MAC_SIZE*1024, buf, tag, &z)) != CRYPT_OK) {
|
if ((err = ocb3_encrypt_authenticate_memory(cipher_idx, key, 16, IV, 15, (unsigned char*)"", 0, buf, MAC_SIZE*1024, buf, tag, &z)) != CRYPT_OK) {
|
||||||
fprintf(stderr, "\nOCB3 error... %s\n", error_to_string(err));
|
fprintf(stderr, "\nOCB3 error... %s\n", error_to_string(err));
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
@ -54,11 +54,9 @@ int ocb3_add_aad(ocb3_state *ocb, const unsigned char *aad, unsigned long aadlen
|
|||||||
unsigned char *data;
|
unsigned char *data;
|
||||||
unsigned long datalen, l;
|
unsigned long datalen, l;
|
||||||
|
|
||||||
LTC_ARGCHK(ocb != NULL);
|
LTC_ARGCHK(ocb != NULL);
|
||||||
if (aad == NULL) LTC_ARGCHK(aadlen == 0);
|
if (aadlen == 0) return CRYPT_OK;
|
||||||
if (aadlen == 0) LTC_ARGCHK(aad == NULL);
|
LTC_ARGCHK(aad != NULL);
|
||||||
|
|
||||||
if (aad == NULL || aadlen == 0) return CRYPT_OK;
|
|
||||||
|
|
||||||
if (ocb->adata_buffer_bytes > 0) {
|
if (ocb->adata_buffer_bytes > 0) {
|
||||||
l = ocb->block_len - ocb->adata_buffer_bytes;
|
l = ocb->block_len - ocb->adata_buffer_bytes;
|
||||||
|
Loading…
Reference in New Issue
Block a user