| ... | @@ -21,6 +21,12 @@ fn AesGcm(comptime Aes: anytype) type { | ... | @@ -21,6 +21,12 @@ fn AesGcm(comptime Aes: anytype) type { |
| 21 | | 21 | |
| 22 | const zeros = [_]u8{0} ** 16; | 22 | const zeros = [_]u8{0} ** 16; |
| 23 | | 23 | |
| | 24 | /// `c`: The ciphertext buffer to write the encrypted data to. |
| | 25 | /// `tag`: The authentication tag buffer to write the computed tag to. |
| | 26 | /// `m`: The plaintext message to encrypt. |
| | 27 | /// `ad`: The associated data to authenticate. |
| | 28 | /// `npub`: The nonce to use for encryption. |
| | 29 | /// `key`: The encryption key. |
| 24 | pub fn encrypt(c: []u8, tag: *[tag_length]u8, m: []const u8, ad: []const u8, npub: [nonce_length]u8, key: [key_length]u8) void { | 30 | pub fn encrypt(c: []u8, tag: *[tag_length]u8, m: []const u8, ad: []const u8, npub: [nonce_length]u8, key: [key_length]u8) void { |
| 25 | debug.assert(c.len == m.len); | 31 | debug.assert(c.len == m.len); |
| 26 | debug.assert(m.len <= 16 * ((1 << 32) - 2)); | 32 | debug.assert(m.len <= 16 * ((1 << 32) - 2)); |