Browse Source

Enable OCB invalid tag tests when the plaintext is not empty

André Berenguel 5 years ago
parent
commit
d4ef39d8e5
1 changed files with 4 additions and 1 deletions
  1. 4 1
      Tests/CryptoSwiftTests/AESOCBTests.swift

+ 4 - 1
Tests/CryptoSwiftTests/AESOCBTests.swift

@@ -133,6 +133,9 @@ final class OCBTests: XCTestCase {
     }
 
     func testInvalidTag(fixture: TestFixture) -> Bool {
+      if fixture.P.isEmpty {
+        return true // TODO: solve the verification with empty plaintext
+      }
       let ocb = OCB(nonce: fixture.N, additionalAuthenticatedData: fixture.A, mode: .combined)
       let aes = try! AES(key: K, blockMode: ocb, padding: .noPadding)
       var C_ = fixture.C.slice
@@ -144,7 +147,7 @@ final class OCBTests: XCTestCase {
     for (i, fixture) in fixtures.enumerated() {
       XCTAssertTrue(testEncrypt(fixture: fixture), "Encryption failed")
       XCTAssertTrue(testDecrypt(fixture: fixture), "(\(i) - Decryption failed.")
-      //XCTAssertTrue(testInvalidTag(fixture: fixture), "(\(i) - Invalid Tag verification failed.")
+      XCTAssertTrue(testInvalidTag(fixture: fixture), "(\(i) - Invalid Tag verification failed.")
     }
   }