add SHA512/224 and SHA512/256 support (#4575)

* add SHA512/224 and SHA512/256 support

* add missing docs
diff --git a/CHANGELOG.rst b/CHANGELOG.rst
index 262c1f2..b95df95 100644
--- a/CHANGELOG.rst
+++ b/CHANGELOG.rst
@@ -8,6 +8,10 @@
 
 .. note:: This version is not yet released and is under active development.
 
+* Added support for :class:`~cryptography.hazmat.primitives.hashes.SHA512_224`
+  and :class:`~cryptography.hazmat.primitives.hashes.SHA512_256` when using
+  OpenSSL 1.1.1.
+
 .. _v2-4-1:
 
 2.4.1 - 2018-11-11
diff --git a/docs/hazmat/primitives/cryptographic-hashes.rst b/docs/hazmat/primitives/cryptographic-hashes.rst
index a73785d..1a96fc2 100644
--- a/docs/hazmat/primitives/cryptographic-hashes.rst
+++ b/docs/hazmat/primitives/cryptographic-hashes.rst
@@ -102,6 +102,20 @@
     SHA-512 is a cryptographic hash function from the SHA-2 family and is
     standardized by NIST. It produces a 512-bit message digest.
 
+.. class:: SHA512_224()
+
+    .. versionadded:: 2.5
+
+    SHA-512/224 is a cryptographic hash function from the SHA-2 family and is
+    standardized by NIST. It produces a 224-bit message digest.
+
+.. class:: SHA512_256()
+
+    .. versionadded:: 2.5
+
+    SHA-512/256 is a cryptographic hash function from the SHA-2 family and is
+    standardized by NIST. It produces a 256-bit message digest.
+
 BLAKE2
 ~~~~~~
 
diff --git a/src/cryptography/hazmat/primitives/hashes.py b/src/cryptography/hazmat/primitives/hashes.py
index 3f3aadd..7902993 100644
--- a/src/cryptography/hazmat/primitives/hashes.py
+++ b/src/cryptography/hazmat/primitives/hashes.py
@@ -109,6 +109,20 @@
 
 
 @utils.register_interface(HashAlgorithm)
+class SHA512_224(object):  # noqa: N801
+    name = "sha512-224"
+    digest_size = 28
+    block_size = 128
+
+
+@utils.register_interface(HashAlgorithm)
+class SHA512_256(object):  # noqa: N801
+    name = "sha512-256"
+    digest_size = 32
+    block_size = 128
+
+
+@utils.register_interface(HashAlgorithm)
 class SHA224(object):
     name = "sha224"
     digest_size = 28
diff --git a/tests/hazmat/primitives/test_hash_vectors.py b/tests/hazmat/primitives/test_hash_vectors.py
index 2db9e90..33c5f8e 100644
--- a/tests/hazmat/primitives/test_hash_vectors.py
+++ b/tests/hazmat/primitives/test_hash_vectors.py
@@ -101,6 +101,40 @@
 
 
 @pytest.mark.supported(
+    only_if=lambda backend: backend.hash_supported(hashes.SHA512_224()),
+    skip_message="Does not support SHA512/224",
+)
+@pytest.mark.requires_backend_interface(interface=HashBackend)
+class TestSHA512224(object):
+    test_SHA512_224 = generate_hash_test(
+        load_hash_vectors,
+        os.path.join("hashes", "SHA2"),
+        [
+            "SHA512_224LongMsg.rsp",
+            "SHA512_224ShortMsg.rsp",
+        ],
+        hashes.SHA512_224(),
+    )
+
+
+@pytest.mark.supported(
+    only_if=lambda backend: backend.hash_supported(hashes.SHA512_256()),
+    skip_message="Does not support SHA512/256",
+)
+@pytest.mark.requires_backend_interface(interface=HashBackend)
+class TestSHA512256(object):
+    test_SHA512_256 = generate_hash_test(
+        load_hash_vectors,
+        os.path.join("hashes", "SHA2"),
+        [
+            "SHA512_256LongMsg.rsp",
+            "SHA512_256ShortMsg.rsp",
+        ],
+        hashes.SHA512_256(),
+    )
+
+
+@pytest.mark.supported(
     only_if=lambda backend: backend.hash_supported(hashes.MD5()),
     skip_message="Does not support MD5",
 )