/* $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/rmd160.h>51#include <opencrypto/xform_auth.h>5253static void RMD160Init_int(void *);54static int RMD160Update_int(void *, const void *, u_int);55static void RMD160Final_int(uint8_t *, void *);5657/* Plain hash */58const struct auth_hash auth_hash_ripemd_160 = {59.type = CRYPTO_RIPEMD160,60.name = "RIPEMD-160",61.hashsize = RIPEMD160_HASH_LEN,62.ctxsize = sizeof(RMD160_CTX),63.blocksize = RIPEMD160_BLOCK_LEN,64.Init = RMD160Init_int,65.Update = RMD160Update_int,66.Final = RMD160Final_int,67};6869/* Authentication instances */70const struct auth_hash auth_hash_hmac_ripemd_160 = {71.type = CRYPTO_RIPEMD160_HMAC,72.name = "HMAC-RIPEMD-160",73.keysize = RIPEMD160_BLOCK_LEN,74.hashsize = RIPEMD160_HASH_LEN,75.ctxsize = sizeof(RMD160_CTX),76.blocksize = RIPEMD160_BLOCK_LEN,77.Init = RMD160Init_int,78.Update = RMD160Update_int,79.Final = RMD160Final_int,80};8182static void83RMD160Init_int(void *ctx)84{85RMD160Init(ctx);86}8788static int89RMD160Update_int(void *ctx, const void *buf, u_int len)90{91RMD160Update(ctx, buf, len);92return 0;93}9495static void96RMD160Final_int(uint8_t *digest, void *ctx)97{98RMD160Final(digest, ctx);99}100101102