INNER CODE UNIT · C#

fullBlockLength

sdrapkin/SecurityDriven.Inferno · EtM_CBC.cs:116

			int fullBlockLength = cipherLength - AES_IV_LENGTH;
			byte[] finalBlock = null;
			try
			{
				var iv = _iv.Value;
				var encKey = _encKey.Value;
				var macKey = _macKey.Value;
				var sessionKey = _sessionKey.Value;

				Kdf.SP800_108_Ctr.DeriveKey(hmacFactory: _hmacFactory, key: masterKey, label: salt, context: new ArraySegment<byte>(ciphertext.Array, ciphertext.Offset, CONTEXT_BUFFER_LENGTH), derivedOutput: sessionKey.AsArraySegment(), counter: counter);
				Utils.BlockCopy(sessionKey, 0, macKey, 0, MAC_KEY_LENGTH);

				using (var hmac = _hmacFactory())
				{
					hmac.Key = macKey;
					hmac.TransformBlock(ciphertext.Array, ciphertext.Offset + CONTEXT_TWEAK_LENGTH, AES_IV_LENGTH + cipherLength, null, 0);
					hmac.TransformFinalBlock(ciphertext.Array, 0, 0);
					var fullmacActual = hmac.HashInner;

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…