|
@ -345,6 +345,8 @@ stream_encrypt_all(buffer_t *plaintext, cipher_t *cipher, size_t capacity) |
|
|
cipher_ctx_set_nonce(&cipher_ctx, nonce, nonce_len, 1); |
|
|
cipher_ctx_set_nonce(&cipher_ctx, nonce, nonce_len, 1); |
|
|
memcpy(ciphertext->data, nonce, nonce_len); |
|
|
memcpy(ciphertext->data, nonce, nonce_len); |
|
|
|
|
|
|
|
|
|
|
|
ppbloom_add((void *)nonce, nonce_len); |
|
|
|
|
|
|
|
|
if (cipher->method >= SALSA20) { |
|
|
if (cipher->method >= SALSA20) { |
|
|
crypto_stream_xor_ic((uint8_t *)(ciphertext->data + nonce_len), |
|
|
crypto_stream_xor_ic((uint8_t *)(ciphertext->data + nonce_len), |
|
|
(const uint8_t *)plaintext->data, (uint64_t)(plaintext->len), |
|
|
(const uint8_t *)plaintext->data, (uint64_t)(plaintext->len), |
|
@ -399,6 +401,8 @@ stream_encrypt(buffer_t *plaintext, cipher_ctx_t *cipher_ctx, size_t capacity) |
|
|
memcpy(ciphertext->data, cipher_ctx->nonce, nonce_len); |
|
|
memcpy(ciphertext->data, cipher_ctx->nonce, nonce_len); |
|
|
cipher_ctx->counter = 0; |
|
|
cipher_ctx->counter = 0; |
|
|
cipher_ctx->init = 1; |
|
|
cipher_ctx->init = 1; |
|
|
|
|
|
|
|
|
|
|
|
ppbloom_add((void *)cipher_ctx->nonce, nonce_len); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (cipher->method >= SALSA20) { |
|
|
if (cipher->method >= SALSA20) { |
|
|