From 9e6910dc0c747c8f30b87f6482f4eadb48ad6654 Mon Sep 17 00:00:00 2001 From: forsyth Date: Mon, 17 Jan 2011 10:45:22 +0000 Subject: emu/Nt/ipif.c --- appl/cmd/ssh/cipherdes.b | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 appl/cmd/ssh/cipherdes.b (limited to 'appl/cmd/ssh/cipherdes.b') diff --git a/appl/cmd/ssh/cipherdes.b b/appl/cmd/ssh/cipherdes.b new file mode 100644 index 00000000..7de0a7ca --- /dev/null +++ b/appl/cmd/ssh/cipherdes.b @@ -0,0 +1,43 @@ +implement Cipher; + +include "sys.m"; + +include "ipints.m"; + ipints: IPints; + IPint: import ipints; + +include "crypt.m"; + crypt: Crypt; + DESstate: import crypt; + +include "sshio.m"; + +Cipherstate: adt +{ + enc: ref DESstate; + dec: ref DESstate; +}; + +cs: ref Cipherstate; + +id(): int +{ + return SSH_CIPHER_DES; +} + +init(key: array of byte, nil: int) +{ + ipints = load IPints IPints->PATH; + crypt = load Crypt Crypt->PATH; + cs = ref Cipherstate(crypt->dessetup(key, nil), crypt->dessetup(key, nil)); +} + +encrypt(buf: array of byte, nbuf: int) +{ + crypt->descbc(cs.enc, buf, nbuf, Crypt->Encrypt); +} + +decrypt(buf: array of byte, nbuf: int) +{ + crypt->descbc(cs.dec, buf, nbuf, Crypt->Decrypt); +} -- cgit v1.2.3