Loading apps/speed.c +15 −7 Original line number Original line Diff line number Diff line Loading @@ -903,16 +903,20 @@ static int EVP_Update_loop(void *args) if (decrypt) { if (decrypt) { for (count = 0; COND(nb_iter); count++) { for (count = 0; COND(nb_iter); count++) { rc = EVP_DecryptUpdate(ctx, buf, &outl, buf, lengths[testnum]); rc = EVP_DecryptUpdate(ctx, buf, &outl, buf, lengths[testnum]); if (rc != 1) if (rc != 1) { /* reset iv in case of counter overflow */ EVP_CipherInit_ex(ctx, NULL, NULL, NULL, iv, -1); EVP_CipherInit_ex(ctx, NULL, NULL, NULL, iv, -1); } } } } else { } else { for (count = 0; COND(nb_iter); count++) { for (count = 0; COND(nb_iter); count++) { rc = EVP_EncryptUpdate(ctx, buf, &outl, buf, lengths[testnum]); rc = EVP_EncryptUpdate(ctx, buf, &outl, buf, lengths[testnum]); if (rc != 1) if (rc != 1) { /* reset iv in case of counter overflow */ EVP_CipherInit_ex(ctx, NULL, NULL, NULL, iv, -1); EVP_CipherInit_ex(ctx, NULL, NULL, NULL, iv, -1); } } } } } if (decrypt) if (decrypt) EVP_DecryptFinal_ex(ctx, buf, &outl); EVP_DecryptFinal_ex(ctx, buf, &outl); else else Loading @@ -937,20 +941,24 @@ static int EVP_Update_loop_ccm(void *args) #endif #endif if (decrypt) { if (decrypt) { for (count = 0; COND(nb_iter); count++) { for (count = 0; COND(nb_iter); count++) { EVP_DecryptInit_ex(ctx, NULL, NULL, NULL, iv); EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_SET_TAG, sizeof(tag), tag); EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_SET_TAG, sizeof(tag), tag); EVP_DecryptUpdate(ctx, NULL, &outl, NULL, lengths[testnum]); /* reset iv */ EVP_DecryptInit_ex(ctx, NULL, NULL, NULL, iv); /* counter is reset on every update */ EVP_DecryptUpdate(ctx, buf, &outl, buf, lengths[testnum]); EVP_DecryptUpdate(ctx, buf, &outl, buf, lengths[testnum]); EVP_DecryptFinal_ex(ctx, buf, &outl); } } } else { } else { for (count = 0; COND(nb_iter); count++) { for (count = 0; COND(nb_iter); count++) { EVP_EncryptInit_ex(ctx, NULL, NULL, NULL, iv); /* restore iv length field */ EVP_EncryptUpdate(ctx, NULL, &outl, NULL, lengths[testnum]); EVP_EncryptUpdate(ctx, NULL, &outl, NULL, lengths[testnum]); /* counter is reset on every update */ EVP_EncryptUpdate(ctx, buf, &outl, buf, lengths[testnum]); EVP_EncryptUpdate(ctx, buf, &outl, buf, lengths[testnum]); EVP_EncryptFinal_ex(ctx, buf, &outl); } } } } if (decrypt) EVP_DecryptFinal_ex(ctx, buf, &outl); else EVP_EncryptFinal_ex(ctx, buf, &outl); return count; return count; } } Loading Loading
apps/speed.c +15 −7 Original line number Original line Diff line number Diff line Loading @@ -903,16 +903,20 @@ static int EVP_Update_loop(void *args) if (decrypt) { if (decrypt) { for (count = 0; COND(nb_iter); count++) { for (count = 0; COND(nb_iter); count++) { rc = EVP_DecryptUpdate(ctx, buf, &outl, buf, lengths[testnum]); rc = EVP_DecryptUpdate(ctx, buf, &outl, buf, lengths[testnum]); if (rc != 1) if (rc != 1) { /* reset iv in case of counter overflow */ EVP_CipherInit_ex(ctx, NULL, NULL, NULL, iv, -1); EVP_CipherInit_ex(ctx, NULL, NULL, NULL, iv, -1); } } } } else { } else { for (count = 0; COND(nb_iter); count++) { for (count = 0; COND(nb_iter); count++) { rc = EVP_EncryptUpdate(ctx, buf, &outl, buf, lengths[testnum]); rc = EVP_EncryptUpdate(ctx, buf, &outl, buf, lengths[testnum]); if (rc != 1) if (rc != 1) { /* reset iv in case of counter overflow */ EVP_CipherInit_ex(ctx, NULL, NULL, NULL, iv, -1); EVP_CipherInit_ex(ctx, NULL, NULL, NULL, iv, -1); } } } } } if (decrypt) if (decrypt) EVP_DecryptFinal_ex(ctx, buf, &outl); EVP_DecryptFinal_ex(ctx, buf, &outl); else else Loading @@ -937,20 +941,24 @@ static int EVP_Update_loop_ccm(void *args) #endif #endif if (decrypt) { if (decrypt) { for (count = 0; COND(nb_iter); count++) { for (count = 0; COND(nb_iter); count++) { EVP_DecryptInit_ex(ctx, NULL, NULL, NULL, iv); EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_SET_TAG, sizeof(tag), tag); EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_SET_TAG, sizeof(tag), tag); EVP_DecryptUpdate(ctx, NULL, &outl, NULL, lengths[testnum]); /* reset iv */ EVP_DecryptInit_ex(ctx, NULL, NULL, NULL, iv); /* counter is reset on every update */ EVP_DecryptUpdate(ctx, buf, &outl, buf, lengths[testnum]); EVP_DecryptUpdate(ctx, buf, &outl, buf, lengths[testnum]); EVP_DecryptFinal_ex(ctx, buf, &outl); } } } else { } else { for (count = 0; COND(nb_iter); count++) { for (count = 0; COND(nb_iter); count++) { EVP_EncryptInit_ex(ctx, NULL, NULL, NULL, iv); /* restore iv length field */ EVP_EncryptUpdate(ctx, NULL, &outl, NULL, lengths[testnum]); EVP_EncryptUpdate(ctx, NULL, &outl, NULL, lengths[testnum]); /* counter is reset on every update */ EVP_EncryptUpdate(ctx, buf, &outl, buf, lengths[testnum]); EVP_EncryptUpdate(ctx, buf, &outl, buf, lengths[testnum]); EVP_EncryptFinal_ex(ctx, buf, &outl); } } } } if (decrypt) EVP_DecryptFinal_ex(ctx, buf, &outl); else EVP_EncryptFinal_ex(ctx, buf, &outl); return count; return count; } } Loading