lp:~gl-az/percona-xtrabackup/BT23557-bug1185343-2.2

Created by George Ormond Lorch III on 2013-10-15 and last modified on 2013-10-26
Get this branch:
bzr branch lp:~gl-az/percona-xtrabackup/BT23557-bug1185343-2.2
Only George Ormond Lorch III can upload to this branch. If you are George Ormond Lorch III please log in for upload directions.

Branch merges

Related bugs

Related blueprints

Recent revisions

4880. By George Ormond Lorch III on 2013-10-17

Fix for https://bugs.launchpad.net/percona-xtrabackup/+bug/1185343 - Fixed IV used in Xtrabackup encryption

In order to fix this in the safest possible way, followed general advice from various sources but summed up nicely here:
"An initialization vector has different security requirements than a key, so the IV usually does not need to be secret. However, in most cases, it is important that an initialization vector is never reused under the same key. For CBC and CFB, reusing an IV leaks some information about the first block of plaintext, and about any common prefix shared by the two messages. For OFB and CTR, reusing an IV completely destroys security. This can be seen because both modes effectively create a bitstream that is XORed with the plaintext, and this bitstream is dependent on the password and IV only. Reusing a bitstream destroys security. In CBC mode, the IV must, in addition, be unpredictable at encryption time; in particular, the (previously) common practice of re-using the last ciphertext block of a message as the IV for the next message is insecure (for example, this method was used by SSL 2.0). If an attacker knows the IV (or the previous block of ciphertext) before he specifies the next plaintext, he can check his guess about plaintext of some block that was encrypted with the same key before (this is known as the TLS CBC IV attack)." - http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation

This fix advances the XBCRYPT chunk header version and adds an iv field to store the iv that was used to encrypt that block.

On decryption, if the XBCRYPT version is 1 then the original fixed iv is used to decrypt, otherwise the iv in the block header is used.

On encryption, for each block being encrypted, an iv of the correct length is generated by using values returned from random() until the iv has been fully populated. This iv will be written into the XBCRYPT chunk header along with its size.

One new test case added, xbcrypt.sh. Added two files in inc: decrypt_v1_test_file.txt is a simple text file that was then encrypted @ v1 levels and put in decrypt_v1_test_file.xbcrypt. The new test case tests two simple scenarios:
  1 - Tests that a file can go through an encryption/decryption cycle and be 100% identical to the orginal file.
  2 - Tests that a file previously encrypted with and earlier version can be decrypted witht he current version.

4878. By Alexey Kopytov on 2013-09-26

Empty merge from 2.1.

4877. By Alexey Kopytov on 2013-09-23

Empty merge from 2.1.

4875. By Alexey Kopytov on 2013-09-23

Merged lp:percona-xtrabackup.

4874. By Alexey Kopytov on 2013-09-23

Automerge from 2.1.

4873. By Alexey Kopytov on 2013-09-16

Empty merge from 2.1.

4871. By Hrvoje Matijakovic on 2013-09-11

- upmerge from 2.1 branch

Branch metadata

Branch format:
Branch format 7
Repository format:
Bazaar repository format 2a (needs bzr 1.16 or later)
Stacked on:
lp:percona-xtrabackup/2.2
This branch contains Public information 
Everyone can see this information.