commit ce9ae0b5203f377ae9cc0621d9a7edc939bf5fc5
parent 1912d0c56d46faf0e717ff1484055e1a2f843e1b
Author: Armin Preiml <apreiml@strohwolke.at>
Date: Mon, 9 May 2022 16:15:25 +0200
crypto::cipher: remove deprecated stream interface
fixes https://todo.sr.ht/~sircmpwn/hare/639
Signed-off-by: Armin Preiml <apreiml@strohwolke.at>
Diffstat:
2 files changed, 3 insertions(+), 23 deletions(-)
diff --git a/crypto/cipher/cipher.ha b/crypto/cipher/cipher.ha
@@ -1,13 +1,8 @@
// License: MPL-2.0
-// (c) 2021 Armin Preiml <apreiml@strohwolke.at>
+// (c) 2021-2022 Armin Preiml <apreiml@strohwolke.at>
// Discards any state associated with a block or a stream cipher algorithm,
// securely erasing secret data from memory.
-export fn finish(a: (*block | *stream)) void = {
- match (a) {
- case let a: *block =>
- a.finish(a);
- case let a: *stream =>
- a.finish(a);
- };
+export fn finish(a: *block) void = {
+ a.finish(a);
};
diff --git a/crypto/cipher/stream.ha b/crypto/cipher/stream.ha
@@ -3,21 +3,6 @@
use io;
use crypto::math::{xor};
-// An abstract interface for implementing cipher streams
-export type stream = struct {
- xor: *fn(s: *stream, dest: []u8, src: []u8) void,
- finish: *fn(s: *stream) void,
-};
-
-// Applies xor of the key produced by the stream to src and writes the result
-// in dest. 'dest' and 'src' may be the same slice, and both slices must have
-// the same length.
-export fn stream_xor(s: *stream, dest: []u8, src: []u8) void = {
- assert(len(dest) == len(src), "stream_xor: slices must have the same length");
- s.xor(s, dest, src);
-};
-
-
// An abstract interface for implementing streams that encrypt or decrypt by
// producing a key stream that is xored with the data. The implementing stream
// must call [[xorstream_init]] after creation so that [[io::reader]],