| ... | ... | @@ -226,9 +226,10 @@ fn AesSiv(comptime Aes: anytype) type { |
| 226 | 226 | |
| 227 | 227 | /// Encrypts plaintext with multiple associated data components. |
| 228 | 228 | /// This is the most general form of AES-SIV encryption that accepts |
| 229 | | /// an arbitrary vector of associated data strings as specified in RFC 5297. |
| 229 | /// a vector of up to 126 associated data strings as specified in RFC 5297. |
| 230 | 230 | pub fn encryptWithAdVector(c: []u8, tag: *[tag_length]u8, m: []const u8, ad: []const []const u8, key: [key_length]u8) void { |
| 231 | 231 | debug.assert(c.len == m.len); |
| 232 | debug.assert(ad.len <= 126); // AES-SIV supports at most 126 associated data components |
| 232 | 233 | |
| 233 | 234 | // Split key into K1 (for S2V) and K2 (for CTR) |
| 234 | 235 | const k1 = key[0 .. Aes.key_bits / 8]; |
| ... | ... | @@ -260,9 +261,10 @@ fn AesSiv(comptime Aes: anytype) type { |
| 260 | 261 | |
| 261 | 262 | /// Decrypts ciphertext with multiple associated data components. |
| 262 | 263 | /// This is the most general form of AES-SIV decryption that accepts |
| 263 | | /// an arbitrary vector of associated data strings as specified in RFC 5297. |
| 264 | /// a vector of up to 126 associated data strings as specified in RFC 5297. |
| 264 | 265 | pub fn decryptWithAdVector(m: []u8, c: []const u8, tag: [tag_length]u8, ad: []const []const u8, key: [key_length]u8) AuthenticationError!void { |
| 265 | 266 | assert(c.len == m.len); |
| 267 | assert(ad.len <= 126); // AES-SIV supports at most 126 associated data components |
| 266 | 268 | |
| 267 | 269 | // Split key into K1 (for S2V) and K2 (for CTR) |
| 268 | 270 | const k1 = key[0 .. Aes.key_bits / 8]; |