OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/renderer/webcrypto/shared_crypto.h" | 5 #include "content/renderer/webcrypto/shared_crypto.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 1978 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1989 EXPECT_STATUS(Status::Error(), | 1989 EXPECT_STATUS(Status::Error(), |
1990 AesGcmDecrypt(key, | 1990 AesGcmDecrypt(key, |
1991 test_iv, | 1991 test_iv, |
1992 test_additional_data, | 1992 test_additional_data, |
1993 test_tag_size_bits, | 1993 test_tag_size_bits, |
1994 test_cipher_text, | 1994 test_cipher_text, |
1995 Corrupted(test_authentication_tag), | 1995 Corrupted(test_authentication_tag), |
1996 &plain_text)); | 1996 &plain_text)); |
1997 | 1997 |
1998 // Try different incorrect tag lengths | 1998 // Try different incorrect tag lengths |
1999 uint8 kAlternateTagLengths[] = {8, 96, 120, 128, 160, 255}; | 1999 uint8 kAlternateTagLengths[] = {0, 8, 96, 120, 128, 160, 255}; |
eroman
2014/02/20 01:28:22
Previously, decrypting with taglength=0 would succ
| |
2000 for (size_t tag_i = 0; tag_i < arraysize(kAlternateTagLengths); ++tag_i) { | 2000 for (size_t tag_i = 0; tag_i < arraysize(kAlternateTagLengths); ++tag_i) { |
2001 unsigned int wrong_tag_size_bits = kAlternateTagLengths[tag_i]; | 2001 unsigned int wrong_tag_size_bits = kAlternateTagLengths[tag_i]; |
2002 if (test_tag_size_bits == wrong_tag_size_bits) | 2002 if (test_tag_size_bits == wrong_tag_size_bits) |
2003 continue; | 2003 continue; |
2004 EXPECT_STATUS_ERROR(AesGcmDecrypt(key, | 2004 EXPECT_STATUS_ERROR(AesGcmDecrypt(key, |
2005 test_iv, | 2005 test_iv, |
2006 test_additional_data, | 2006 test_additional_data, |
2007 wrong_tag_size_bits, | 2007 wrong_tag_size_bits, |
2008 test_cipher_text, | 2008 test_cipher_text, |
2009 test_authentication_tag, | 2009 test_authentication_tag, |
2010 &plain_text)); | 2010 &plain_text)); |
2011 } | 2011 } |
2012 } | 2012 } |
2013 } | 2013 } |
2014 | 2014 |
2015 } // namespace webcrypto | 2015 } // namespace webcrypto |
2016 | 2016 |
2017 } // namespace content | 2017 } // namespace content |
OLD | NEW |