12155bb23SAllan Jude /* $OpenBSD: xform.h,v 1.8 2001/08/28 12:20:43 ben Exp $ */ 22155bb23SAllan Jude 32155bb23SAllan Jude /*- 42155bb23SAllan Jude * The author of this code is Angelos D. Keromytis (angelos@cis.upenn.edu) 52155bb23SAllan Jude * 62155bb23SAllan Jude * This code was written by Angelos D. Keromytis in Athens, Greece, in 72155bb23SAllan Jude * February 2000. Network Security Technologies Inc. (NSTI) kindly 82155bb23SAllan Jude * supported the development of this code. 92155bb23SAllan Jude * 102155bb23SAllan Jude * Copyright (c) 2000 Angelos D. Keromytis 112155bb23SAllan Jude * Copyright (c) 2014 The FreeBSD Foundation 122155bb23SAllan Jude * All rights reserved. 132155bb23SAllan Jude * 142155bb23SAllan Jude * Portions of this software were developed by John-Mark Gurney 152155bb23SAllan Jude * under sponsorship of the FreeBSD Foundation and 162155bb23SAllan Jude * Rubicon Communications, LLC (Netgate). 172155bb23SAllan Jude * 182155bb23SAllan Jude * Permission to use, copy, and modify this software without fee 192155bb23SAllan Jude * is hereby granted, provided that this entire notice is included in 202155bb23SAllan Jude * all source code copies of any software which is or includes a copy or 212155bb23SAllan Jude * modification of this software. 222155bb23SAllan Jude * 232155bb23SAllan Jude * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR 242155bb23SAllan Jude * IMPLIED WARRANTY. IN PARTICULAR, NONE OF THE AUTHORS MAKES ANY 252155bb23SAllan Jude * REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE 262155bb23SAllan Jude * MERCHANTABILITY OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR 272155bb23SAllan Jude * PURPOSE. 282155bb23SAllan Jude */ 292155bb23SAllan Jude 302155bb23SAllan Jude #ifndef _CRYPTO_XFORM_AUTH_H_ 312155bb23SAllan Jude #define _CRYPTO_XFORM_AUTH_H_ 322155bb23SAllan Jude 33*46f69ebaSJohn Baldwin #include <sys/types.h> 342155bb23SAllan Jude 352155bb23SAllan Jude #include <crypto/sha1.h> 36174a5014SJohn Baldwin #include <crypto/sha2/sha224.h> 372155bb23SAllan Jude #include <crypto/sha2/sha256.h> 382155bb23SAllan Jude #include <crypto/sha2/sha384.h> 392155bb23SAllan Jude #include <crypto/sha2/sha512.h> 402155bb23SAllan Jude #include <opencrypto/rmd160.h> 412155bb23SAllan Jude #include <opencrypto/gmac.h> 42507281e5SSean Eric Fagan #include <opencrypto/cbc_mac.h> 432155bb23SAllan Jude 442155bb23SAllan Jude #include <opencrypto/cryptodev.h> 452155bb23SAllan Jude 462155bb23SAllan Jude /* XXX use a define common with other hash stuff ! */ 472155bb23SAllan Jude #define AH_ALEN_MAX 64 /* max authenticator hash length */ 482155bb23SAllan Jude 492155bb23SAllan Jude /* Declarations */ 502155bb23SAllan Jude struct auth_hash { 512155bb23SAllan Jude int type; 52d8787d4fSMark Johnston const char *name; 53d3d79e96SJohn Baldwin uint16_t keysize; 54d3d79e96SJohn Baldwin uint16_t hashsize; 55d3d79e96SJohn Baldwin uint16_t ctxsize; 56d3d79e96SJohn Baldwin uint16_t blocksize; 572155bb23SAllan Jude void (*Init) (void *); 589b6b2f86SJohn Baldwin void (*Setkey) (void *, const uint8_t *, u_int); 599b6b2f86SJohn Baldwin void (*Reinit) (void *, const uint8_t *, u_int); 609b6b2f86SJohn Baldwin int (*Update) (void *, const void *, u_int); 61d3d79e96SJohn Baldwin void (*Final) (uint8_t *, void *); 622155bb23SAllan Jude }; 632155bb23SAllan Jude 64d8787d4fSMark Johnston extern const struct auth_hash auth_hash_null; 65d8787d4fSMark Johnston extern const struct auth_hash auth_hash_hmac_sha1; 66d8787d4fSMark Johnston extern const struct auth_hash auth_hash_hmac_ripemd_160; 67d8787d4fSMark Johnston extern const struct auth_hash auth_hash_hmac_sha2_224; 68d8787d4fSMark Johnston extern const struct auth_hash auth_hash_hmac_sha2_256; 69d8787d4fSMark Johnston extern const struct auth_hash auth_hash_hmac_sha2_384; 70d8787d4fSMark Johnston extern const struct auth_hash auth_hash_hmac_sha2_512; 71c3a688efSJohn Baldwin extern const struct auth_hash auth_hash_ripemd_160; 72d8787d4fSMark Johnston extern const struct auth_hash auth_hash_sha1; 73d8787d4fSMark Johnston extern const struct auth_hash auth_hash_sha2_224; 74d8787d4fSMark Johnston extern const struct auth_hash auth_hash_sha2_256; 75d8787d4fSMark Johnston extern const struct auth_hash auth_hash_sha2_384; 76d8787d4fSMark Johnston extern const struct auth_hash auth_hash_sha2_512; 77d8787d4fSMark Johnston extern const struct auth_hash auth_hash_nist_gmac_aes_128; 78d8787d4fSMark Johnston extern const struct auth_hash auth_hash_nist_gmac_aes_192; 79d8787d4fSMark Johnston extern const struct auth_hash auth_hash_nist_gmac_aes_256; 80d8787d4fSMark Johnston extern const struct auth_hash auth_hash_blake2b; 81d8787d4fSMark Johnston extern const struct auth_hash auth_hash_blake2s; 82d8787d4fSMark Johnston extern const struct auth_hash auth_hash_poly1305; 83d8787d4fSMark Johnston extern const struct auth_hash auth_hash_ccm_cbc_mac_128; 84d8787d4fSMark Johnston extern const struct auth_hash auth_hash_ccm_cbc_mac_192; 85d8787d4fSMark Johnston extern const struct auth_hash auth_hash_ccm_cbc_mac_256; 862155bb23SAllan Jude 872155bb23SAllan Jude union authctx { 882155bb23SAllan Jude SHA1_CTX sha1ctx; 892155bb23SAllan Jude RMD160_CTX rmd160ctx; 90174a5014SJohn Baldwin SHA224_CTX sha224ctx; 912155bb23SAllan Jude SHA256_CTX sha256ctx; 922155bb23SAllan Jude SHA384_CTX sha384ctx; 932155bb23SAllan Jude SHA512_CTX sha512ctx; 942155bb23SAllan Jude struct aes_gmac_ctx aes_gmac_ctx; 95507281e5SSean Eric Fagan struct aes_cbc_mac_ctx aes_cbc_mac_ctx; 962155bb23SAllan Jude }; 972155bb23SAllan Jude 982155bb23SAllan Jude #endif /* _CRYPTO_XFORM_AUTH_H_ */ 99