|
|
@ -592,18 +592,22 @@ stream_decrypt(buffer_t *ciphertext, cipher_ctx_t *cipher_ctx, size_t capacity) |
|
|
|
dump("CIPHER", ciphertext->data, ciphertext->len); |
|
|
|
#endif |
|
|
|
|
|
|
|
brealloc(ciphertext, plaintext->len, capacity); |
|
|
|
memcpy(ciphertext->data, plaintext->data, plaintext->len); |
|
|
|
ciphertext->len = plaintext->len; |
|
|
|
|
|
|
|
// Add to bloom filter |
|
|
|
if (cipher_ctx->init == 1) { |
|
|
|
if (cipher->method >= RC4_MD5) { |
|
|
|
if (ppbloom_check((void *)cipher_ctx->nonce, cipher->nonce_len) == 1) { |
|
|
|
LOGE("crypto: stream: repeat IV detected"); |
|
|
|
return CRYPTO_ERROR; |
|
|
|
} |
|
|
|
ppbloom_add((void *)cipher_ctx->nonce, cipher->nonce_len); |
|
|
|
cipher_ctx->init = 2; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
brealloc(ciphertext, plaintext->len, capacity); |
|
|
|
memcpy(ciphertext->data, plaintext->data, plaintext->len); |
|
|
|
ciphertext->len = plaintext->len; |
|
|
|
|
|
|
|
return CRYPTO_OK; |
|
|
|
} |
|
|
|
|
|
|
|