Fix freeze applying to cloned objects

Previously, freezing a cloned ActiveRecord object froze the original
too. By cloning `@attributes` before freezing, we prevent cloned objects
(which in Ruby share state of ivars) from being effected by `#freeze`.

Resolves issue #4936, which has further information on this issue, as
well as steps to reproduce.

* Add a test case for `#freeze` not causing `cloned.frozen?` to be true.
* Clone @attributes before freezing in `ActiveRecord::Core`, then
  reassign the cloned, frozen hash to the frozen model's `@attributes`
  ivar.

/cc @steveklabnik
Reorganize MessageEncryptor

1) According to OpenSSL's documentation, cipher.random_iv must be called
   after cipher.encrypt and already sets the generated IV on the cipher.

2) OpenSSL::CipherError was moved to OpenSSL::Cipher::CipherError in
   Ruby 1.8.7. Since Rails 4 requires at least Ruby 1.9.3, support for
   the old location can be dropped.
Merge pull request #10235 from joergleis/patch-1

Reorganize MessageEncryptor
Merge pull request #10200 from calebthompson/ct-fix-freeze-freezing-cloned-models

Fix freeze applying to cloned objects