Replace the use of OpenSSL's SHA2 by a native implementation.

* Introduces the classes CSHA256 and CSHA512 in sha2.{cpp,h}.
* The HMAC-SHA512 implementation is moved there too, with a similar interface.
* In hash.h, CHash256 (=double SHA256) and CHash160 (SHA256 + RIPEMD160) are added.
* The rest of hash.h is refactored to use those classes.
* The internal miner is also modified to use CHash256 (hiding the inner SHA256 workings).
* The 'midstate' and 'hash1' fields from the getwork() output are removed.