summaryrefslogtreecommitdiff
path: root/sys/crypto/xform.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/crypto/xform.c')
-rw-r--r--sys/crypto/xform.c35
1 files changed, 34 insertions, 1 deletions
diff --git a/sys/crypto/xform.c b/sys/crypto/xform.c
index e845673f2a7..b8e9d4a93a7 100644
--- a/sys/crypto/xform.c
+++ b/sys/crypto/xform.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: xform.c,v 1.10 2001/06/27 04:57:08 angelos Exp $ */
+/* $OpenBSD: xform.c,v 1.11 2001/07/05 16:44:00 jjbg Exp $ */
/*
* The authors of this code are John Ioannidis (ji@tla.org),
* Angelos D. Keromytis (kermit@csd.uch.gr) and
@@ -54,6 +54,7 @@
#include <crypto/rijndael.h>
#include <crypto/cryptodev.h>
#include <crypto/xform.h>
+#include <crypto/deflate.h>
extern void des_ecb3_encrypt(caddr_t, caddr_t, caddr_t, caddr_t, caddr_t, int);
extern void des_ecb_encrypt(caddr_t, caddr_t, caddr_t, int);
@@ -88,6 +89,9 @@ int MD5Update_int(void *, u_int8_t *, u_int16_t);
int SHA1Update_int(void *, u_int8_t *, u_int16_t);
int RMD160Update_int(void *, u_int8_t *, u_int16_t);
+u_int32_t deflate_compress(u_int8_t *, u_int32_t, u_int8_t **);
+u_int32_t deflate_decompress(u_int8_t *, u_int32_t, u_int8_t **);
+
/* Encryption instances */
struct enc_xform enc_xform_des = {
CRYPTO_DES_CBC, "DES",
@@ -179,6 +183,13 @@ struct auth_hash auth_hash_key_sha1 = {
(void (*)(u_int8_t *, void *)) SHA1Final
};
+/* Compression instance */
+struct comp_algo comp_algo_deflate = {
+ CRYPTO_DEFLATE_COMP, "Deflate",
+ 90, deflate_compress,
+ deflate_decompress
+};
+
/*
* Encryption wrapper routines.
*/
@@ -389,3 +400,25 @@ SHA1Update_int(void *ctx, u_int8_t *buf, u_int16_t len)
SHA1Update(ctx, buf, len);
return 0;
}
+
+/*
+ * And compression
+ */
+
+u_int32_t
+deflate_compress(data, size, out)
+ u_int8_t *data;
+ u_int32_t size;
+ u_int8_t **out;
+{
+ return deflate_global(data, size, 0, out);
+}
+
+u_int32_t
+deflate_decompress(data, size, out)
+ u_int8_t *data;
+ u_int32_t size;
+ u_int8_t **out;
+{
+ return deflate_global(data, size, 1, out);
+}