aes: xts: Enforce NIST SP 800-38E data unit size

NIST SP 800-38E requites the data unit size be limited to at most 2^20 AES
blocks in size. Enforce this restriction.
diff --git a/library/aes.c b/library/aes.c
index 2dc600c..2b64387 100644
--- a/library/aes.c
+++ b/library/aes.c
@@ -1158,6 +1158,9 @@
     if( length < 16 )
         return( MBEDTLS_ERR_AES_INVALID_INPUT_LENGTH );
 
+    /* NIST SP 80-38E disallows data units larger than 2**20 blocks. */
+    if( length > ( 1 << 20 ) * 16 )
+        return MBEDTLS_ERR_AES_INVALID_INPUT_LENGTH;
 
     mbedtls_aes_crypt_ecb( &ctx->tweak, MBEDTLS_AES_ENCRYPT, iv, t_buf.u8 );