/* $OpenBSD: xform.c,v 1.16 2001/08/28 12:20:43 ben Exp $ */1/*-2* The authors of this code are John Ioannidis ([email protected]),3* Angelos D. Keromytis ([email protected]),4* Niels Provos ([email protected]) and5* Damien Miller ([email protected]).6*7* This code was written by John Ioannidis for BSD/OS in Athens, Greece,8* in November 1995.9*10* Ported to OpenBSD and NetBSD, with additional transforms, in December 1996,11* by Angelos D. Keromytis.12*13* Additional transforms and features in 1997 and 1998 by Angelos D. Keromytis14* and Niels Provos.15*16* Additional features in 1999 by Angelos D. Keromytis.17*18* AES XTS implementation in 2008 by Damien Miller19*20* Copyright (C) 1995, 1996, 1997, 1998, 1999 by John Ioannidis,21* Angelos D. Keromytis and Niels Provos.22*23* Copyright (C) 2001, Angelos D. Keromytis.24*25* Copyright (C) 2008, Damien Miller26* Copyright (c) 2014 The FreeBSD Foundation27* All rights reserved.28*29* Portions of this software were developed by John-Mark Gurney30* under sponsorship of the FreeBSD Foundation and31* Rubicon Communications, LLC (Netgate).32*33* Permission to use, copy, and modify this software with or without fee34* is hereby granted, provided that this entire notice is included in35* all copies of any software which is or includes a copy or36* modification of this software.37* You may use this code under the GNU public license if you so wish. Please38* contribute changes back to the authors under this freer than GPL license39* so that we may further the use of strong encryption without limitations to40* all.41*42* THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR43* IMPLIED WARRANTY. IN PARTICULAR, NONE OF THE AUTHORS MAKES ANY44* REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE45* MERCHANTABILITY OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR46* PURPOSE.47*/4849#include <sys/types.h>50#include <opencrypto/deflate.h>51#include <opencrypto/xform_comp.h>5253static uint32_t deflate_compress(uint8_t *, uint32_t, uint8_t **);54static uint32_t deflate_decompress(uint8_t *, uint32_t, uint8_t **);5556/* Compression instance */57const struct comp_algo comp_algo_deflate = {58CRYPTO_DEFLATE_COMP, "Deflate",5990, deflate_compress,60deflate_decompress61};6263/*64* And compression65*/6667static uint32_t68deflate_compress(uint8_t *data, uint32_t size, uint8_t **out)69{70return deflate_global(data, size, 0, out);71}7273static uint32_t74deflate_decompress(uint8_t *data, uint32_t size, uint8_t **out)75{76return deflate_global(data, size, 1, out);77}787980