diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1999-02-17 18:10:39 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1999-02-17 18:10:39 +0000 |
commit | 9acba6420d4373d887c498e72cfabd70a27ae7a9 (patch) | |
tree | bdf32712ddf2b700e7ca52d4e83bd70a43728049 | |
parent | e87bd06433c9c3ed129321f904d555057fddd0ef (diff) |
indent
-rw-r--r-- | sys/netinet/ip_esp.h | 207 | ||||
-rw-r--r-- | sys/netinet/ip_ip4.h | 21 | ||||
-rw-r--r-- | sys/netinet/ip_ipsp.h | 150 | ||||
-rw-r--r-- | sys/netinet/ip_rmd160.h | 21 | ||||
-rw-r--r-- | sys/netinet/ip_sha1.c | 24 | ||||
-rw-r--r-- | sys/netinet/ip_sha1.h | 24 |
6 files changed, 214 insertions, 233 deletions
diff --git a/sys/netinet/ip_esp.h b/sys/netinet/ip_esp.h index 75ba8bf53aa..07b62939bcd 100644 --- a/sys/netinet/ip_esp.h +++ b/sys/netinet/ip_esp.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_esp.h,v 1.18 1998/11/25 02:01:28 niklas Exp $ */ +/* $OpenBSD: ip_esp.h,v 1.19 1999/02/17 18:10:38 deraadt Exp $ */ /* * The authors of this code are John Ioannidis (ji@tla.org), @@ -69,100 +69,92 @@ #define ESP_NEW_OPAD_VAL 0x5C struct esp_hash { - int type; - char *name; - u_int16_t hashsize; - u_int16_t ctxsize; - void (*Init)(void *); - void (*Update)(void *, u_int8_t *, u_int16_t); - void (*Final)(u_int8_t *, void *); + int type; + char *name; + u_int16_t hashsize; + u_int16_t ctxsize; + void (*Init) __P((void *)); + void (*Update) __P((void *, u_int8_t *, u_int16_t)); + void (*Final) __P((u_int8_t *, void *)); }; struct esp_xform { - int type; - char *name; - u_int16_t blocksize, ivsize; - u_int16_t minkey, maxkey; - u_int32_t ivmask; /* Or all possible modes, zero iv = 1 */ - void (*encrypt)(void *, u_int8_t *); - void (*decrypt)(void *, u_int8_t *); + int type; + char *name; + u_int16_t blocksize, ivsize; + u_int16_t minkey, maxkey; + u_int32_t ivmask; /* Or all possible modes, zero iv = 1 */ + void (*encrypt) __P((void *, u_int8_t *)); + void (*decrypt) __P((void *, u_int8_t *)); }; -struct esp_old -{ - u_int32_t esp_spi; /* Security Parameters Index */ - u_int8_t esp_iv[8]; /* iv[4] may actually be data! */ +struct esp_old { + u_int32_t esp_spi; /* Security Parameters Index */ + u_int8_t esp_iv[8]; /* iv[4] may actually be data! */ }; -struct esp_new -{ - u_int32_t esp_spi; /* Security Parameter Index */ - u_int32_t esp_rpl; /* Sequence Number, Replay Counter */ - u_int8_t esp_iv[8]; /* Data may start already at iv[0]! */ +struct esp_new { + u_int32_t esp_spi; /* Security Parameter Index */ + u_int32_t esp_rpl; /* Sequence Number, Replay Counter */ + u_int8_t esp_iv[8]; /* Data may start already at iv[0]! */ }; -struct espstat -{ - u_int32_t esps_hdrops; /* packet shorter than header shows */ - u_int32_t esps_notdb; - u_int32_t esps_badkcr; - u_int32_t esps_qfull; - u_int32_t esps_noxform; - u_int32_t esps_badilen; - u_int32_t esps_wrap; /* Replay counter wrapped around */ - u_int32_t esps_badauth; /* Only valid for transforms with auth */ - u_int32_t esps_replay; /* Possible packet replay detected */ - u_int32_t esps_input; /* Input ESP packets */ - u_int32_t esps_output; /* Output ESP packets */ - u_int32_t esps_invalid; /* Trying to use an invalid TDB */ - u_int64_t esps_ibytes; /* input bytes */ - u_int64_t esps_obytes; /* output bytes */ - u_int32_t esps_toobig; /* packet got larger than IP_MAXPACKET */ +struct espstat { + u_int32_t esps_hdrops; /* packet shorter than header shows */ + u_int32_t esps_notdb; + u_int32_t esps_badkcr; + u_int32_t esps_qfull; + u_int32_t esps_noxform; + u_int32_t esps_badilen; + u_int32_t esps_wrap; /* Replay counter wrapped around */ + u_int32_t esps_badauth; /* Only valid for transforms with auth */ + u_int32_t esps_replay; /* Possible packet replay detected */ + u_int32_t esps_input; /* Input ESP packets */ + u_int32_t esps_output; /* Output ESP packets */ + u_int32_t esps_invalid; /* Trying to use an invalid TDB */ + u_int64_t esps_ibytes; /* input bytes */ + u_int64_t esps_obytes; /* output bytes */ + u_int32_t esps_toobig; /* packet got larger than IP_MAXPACKET */ }; -struct esp_old_xdata -{ - u_int32_t edx_enc_algorithm; - int32_t edx_ivlen; /* 4 or 8 */ - struct esp_xform *edx_xform; - union - { - u_int8_t Iv[ESP_3DES_IVS]; /* that's enough space */ - u_int32_t Ivl; /* make sure this is 4 bytes */ - u_int64_t Ivq; /* make sure this is 8 bytes! */ - }Iu; +struct esp_old_xdata { + u_int32_t edx_enc_algorithm; + int32_t edx_ivlen; /* 4 or 8 */ + struct esp_xform *edx_xform; + union { + u_int8_t Iv[ESP_3DES_IVS]; /* that's enough space */ + u_int32_t Ivl; /* make sure this is 4 bytes */ + u_int64_t Ivq; /* make sure this is 8 bytes! */ + } Iu; #define edx_iv Iu.Iv #define edx_ivl Iu.Ivl #define edx_ivq Iu.Ivq - union - { - u_int8_t Rk[3][8]; - u_int32_t Eks[3][16][2]; - }Xu; + union { + u_int8_t Rk[3][8]; + u_int32_t Eks[3][16][2]; + } Xu; #define edx_rk Xu.Rk #define edx_eks Xu.Eks }; -struct esp_old_xencap -{ - u_int32_t edx_enc_algorithm; - u_int32_t edx_ivlen; - u_int32_t edx_keylen; - u_int8_t edx_data[1]; /* IV + key material */ +struct esp_old_xencap { + u_int32_t edx_enc_algorithm; + u_int32_t edx_ivlen; + u_int32_t edx_keylen; + u_int8_t edx_data[1]; /* IV + key material */ }; #define ESP_OLD_XENCAP_LEN (3 * sizeof(u_int32_t)) -struct esp_new_xencap -{ - u_int32_t edx_enc_algorithm; - u_int32_t edx_hash_algorithm; - u_int32_t edx_ivlen; /* 0 or 8 */ - u_int16_t edx_confkeylen; - u_int16_t edx_authkeylen; - int32_t edx_wnd; - u_int32_t edx_flags; - u_int8_t edx_data[1]; /* IV + key material */ +struct esp_new_xencap { + u_int32_t edx_enc_algorithm; + u_int32_t edx_hash_algorithm; + u_int32_t edx_ivlen; /* 0 or 8 */ + u_int16_t edx_confkeylen; + u_int16_t edx_authkeylen; + int32_t edx_wnd; + u_int32_t edx_flags; + u_int8_t edx_data[1]; /* IV + key material */ }; #define ESP_NEW_XENCAP_LEN (6 * sizeof(u_int32_t)) @@ -170,43 +162,38 @@ struct esp_new_xencap #define ESP_NEW_FLAG_AUTH 0x00000001 /* Doing authentication too */ #define ESP_NEW_FLAG_NPADDING 0x00000002 /* New style padding */ -struct esp_new_xdata -{ - u_int32_t edx_enc_algorithm; - u_int32_t edx_hash_algorithm; - u_int32_t edx_ivlen; /* 0 or 8 */ - u_int32_t edx_rpl; /* Replay counter */ - int32_t edx_wnd; /* Replay window */ - u_int32_t edx_bitmap; - u_int32_t edx_flags; - u_int32_t edx_initial; /* initial replay value */ - struct esp_hash *edx_hash; - struct esp_xform *edx_xform; - union - { - u_int8_t Iv[ESP_MAX_IVS]; /* that's enough space */ - u_int32_t Ivl; /* make sure this is 4 bytes */ - u_int64_t Ivq; /* make sure this is 8 bytes! */ - }Iu; - union - { - u_int8_t Rk[3][8]; - u_int32_t Eks[3][16][2]; - blf_ctx Bks; - cast_key Cks; - }Xu; - union - { - MD5_CTX edx_MD5_ictx; - SHA1_CTX edx_SHA1_ictx; - RMD160_CTX edx_RMD160_ictx; - } edx_ictx; - union - { - MD5_CTX edx_MD5_octx; - SHA1_CTX edx_SHA1_octx; - RMD160_CTX edx_RMD160_octx; - } edx_octx; +struct esp_new_xdata { + u_int32_t edx_enc_algorithm; + u_int32_t edx_hash_algorithm; + u_int32_t edx_ivlen; /* 0 or 8 */ + u_int32_t edx_rpl; /* Replay counter */ + int32_t edx_wnd; /* Replay window */ + u_int32_t edx_bitmap; + u_int32_t edx_flags; + u_int32_t edx_initial; /* initial replay value */ + struct esp_hash *edx_hash; + struct esp_xform *edx_xform; + union { + u_int8_t Iv[ESP_MAX_IVS]; /* that's enough space */ + u_int32_t Ivl; /* make sure this is 4 bytes */ + u_int64_t Ivq; /* make sure this is 8 bytes! */ + } Iu; + union { + u_int8_t Rk[3][8]; + u_int32_t Eks[3][16][2]; + blf_ctx Bks; + cast_key Cks; + } Xu; + union { + MD5_CTX edx_MD5_ictx; + SHA1_CTX edx_SHA1_ictx; + RMD160_CTX edx_RMD160_ictx; + } edx_ictx; + union { + MD5_CTX edx_MD5_octx; + SHA1_CTX edx_SHA1_octx; + RMD160_CTX edx_RMD160_octx; + } edx_octx; }; #define edx_bks Xu.Bks diff --git a/sys/netinet/ip_ip4.h b/sys/netinet/ip_ip4.h index 132d9706d60..96df0bab5de 100644 --- a/sys/netinet/ip_ip4.h +++ b/sys/netinet/ip_ip4.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_ip4.h,v 1.10 1998/05/18 21:10:55 provos Exp $ */ +/* $OpenBSD: ip_ip4.h,v 1.11 1999/02/17 18:10:38 deraadt Exp $ */ /* * The authors of this code are John Ioannidis (ji@tla.org), @@ -38,16 +38,15 @@ * Not quite all the functionality of RFC-1853, but the main idea is there. */ -struct ip4stat -{ - u_int32_t ip4s_ipackets; /* total input packets */ - u_int32_t ip4s_opackets; /* total output packets */ - u_int32_t ip4s_hdrops; /* packet shorter than header shows */ - u_int32_t ip4s_badlen; - u_int32_t ip4s_notip4; - u_int32_t ip4s_qfull; - u_int64_t ip4s_ibytes; - u_int64_t ip4s_obytes; +struct ip4stat { + u_int32_t ip4s_ipackets; /* total input packets */ + u_int32_t ip4s_opackets; /* total output packets */ + u_int32_t ip4s_hdrops; /* packet shorter than header shows */ + u_int32_t ip4s_badlen; + u_int32_t ip4s_notip4; + u_int32_t ip4s_qfull; + u_int64_t ip4s_ibytes; + u_int64_t ip4s_obytes; }; #define IP4_DEFAULT_TTL 0 diff --git a/sys/netinet/ip_ipsp.h b/sys/netinet/ip_ipsp.h index ade1e34521d..bfbf7736d01 100644 --- a/sys/netinet/ip_ipsp.h +++ b/sys/netinet/ip_ipsp.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ip_ipsp.h,v 1.21 1999/01/08 21:40:28 deraadt Exp $ */ +/* $OpenBSD: ip_ipsp.h,v 1.22 1999/02/17 18:10:38 deraadt Exp $ */ /* * The authors of this code are John Ioannidis (ji@tla.org), @@ -37,39 +37,36 @@ * IPSP global definitions. */ -struct expiration -{ - u_int32_t exp_timeout; - struct in_addr exp_dst; - u_int32_t exp_spi; - u_int8_t exp_sproto; - struct expiration *exp_next; - struct expiration *exp_prev; +struct expiration { + u_int32_t exp_timeout; + struct in_addr exp_dst; + u_int32_t exp_spi; + u_int8_t exp_sproto; + struct expiration *exp_next; + struct expiration *exp_prev; }; -struct flow -{ - struct flow *flow_next; /* Next in flow chain */ - struct flow *flow_prev; /* Previous in flow chain */ - struct tdb *flow_sa; /* Pointer to the SA */ - struct in_addr flow_src; /* Source address */ - struct in_addr flow_srcmask; /* Source netmask */ - struct in_addr flow_dst; /* Destination address */ - struct in_addr flow_dstmask; /* Destination netmask */ - u_int16_t flow_sport; /* Source port, if applicable */ - u_int16_t flow_dport; /* Destination port, if applicable */ - u_int8_t flow_proto; /* Transport protocol, if applicable */ - u_int8_t foo[3]; /* Alignment */ +struct flow { + struct flow *flow_next; /* Next in flow chain */ + struct flow *flow_prev; /* Previous in flow chain */ + struct tdb *flow_sa; /* Pointer to the SA */ + struct in_addr flow_src; /* Source address */ + struct in_addr flow_srcmask; /* Source netmask */ + struct in_addr flow_dst; /* Destination address */ + struct in_addr flow_dstmask; /* Destination netmask */ + u_int16_t flow_sport; /* Source port, if applicable */ + u_int16_t flow_dport; /* Destination port, if applicable */ + u_int8_t flow_proto; /* Transport protocol, if applicable */ + u_int8_t foo[3]; /* Alignment */ }; -struct tdb /* tunnel descriptor block */ -{ - struct tdb *tdb_hnext; /* next in hash chain */ - struct tdb *tdb_onext; /* next in output */ - struct tdb *tdb_inext; /* next in input (prev!) */ - struct xformsw *tdb_xform; /* transformation to use */ - u_int32_t tdb_spi; /* SPI to use */ - u_int32_t tdb_flags; /* Flags related to this TDB */ +struct tdb { /* tunnel descriptor block */ + struct tdb *tdb_hnext; /* next in hash chain */ + struct tdb *tdb_onext; /* next in output */ + struct tdb *tdb_inext; /* next in input (prev!) */ + struct xformsw *tdb_xform; /* transformation to use */ + u_int32_t tdb_spi; /* SPI to use */ + u_int32_t tdb_flags; /* Flags related to this TDB */ #define TDBF_UNIQUE 0x00001 /* This should not be used by others */ #define TDBF_TIMER 0x00002 /* Absolute expiration timer in use */ #define TDBF_BYTES 0x00004 /* Check the byte counters */ @@ -82,49 +79,57 @@ struct tdb /* tunnel descriptor block */ #define TDBF_SOFT_PACKETS 0x00200 /* Soft expiration */ #define TDBF_SOFT_FIRSTUSE 0x00400 /* Soft expiration */ #define TDBF_SAME_TTL 0x00800 /* Keep the packet TTL, in tunneling */ - u_int64_t tdb_exp_packets; /* Expire after so many packets s|r */ - u_int64_t tdb_soft_packets; /* Expiration warning */ - u_int64_t tdb_cur_packets; /* Current number of packets s|r'ed */ - u_int64_t tdb_exp_bytes; /* Expire after so many bytes passed */ - u_int64_t tdb_soft_bytes; /* Expiration warning */ - u_int64_t tdb_cur_bytes; /* Current count of bytes */ - u_int64_t tdb_exp_timeout; /* When does the SPI expire */ - u_int64_t tdb_soft_timeout; /* Send a soft-expire warning */ - u_int64_t tdb_established; /* When was the SPI established */ - u_int64_t tdb_first_use; /* When was it first used */ - u_int64_t tdb_soft_first_use; /* Soft warning */ - u_int64_t tdb_exp_first_use; /* Expire if tdb_first_use + + u_int64_t tdb_exp_packets; /* Expire after so many packets s|r */ + u_int64_t tdb_soft_packets; /* Expiration warning */ + u_int64_t tdb_cur_packets; /* Current number of packets s|r'ed */ + u_int64_t tdb_exp_bytes; /* Expire after so many bytes passed */ + u_int64_t tdb_soft_bytes; /* Expiration warning */ + u_int64_t tdb_cur_bytes; /* Current count of bytes */ + u_int64_t tdb_exp_timeout; /* When does the SPI expire */ + u_int64_t tdb_soft_timeout; /* Send a soft-expire warning */ + u_int64_t tdb_established; /* When was the SPI established */ + u_int64_t tdb_first_use; /* When was it first used */ + u_int64_t tdb_soft_first_use; /* Soft warning */ + u_int64_t tdb_exp_first_use; /* Expire if tdb_first_use + tdb_exp_first_use <= curtime */ - struct in_addr tdb_dst; /* dest address for this SPI */ - struct in_addr tdb_src; /* source address for this SPI, + struct in_addr tdb_dst; /* dest address for this SPI */ + struct in_addr tdb_src; /* source address for this SPI, * used when tunneling */ - struct in_addr tdb_osrc; - struct in_addr tdb_odst; /* Source and destination addresses + struct in_addr tdb_osrc; + struct in_addr tdb_odst; /* Source and destination addresses * of outer IP header if we're doing * tunneling */ - caddr_t tdb_xdata; /* transformation data (opaque) */ - struct flow *tdb_flow; /* Which flows use this SA */ - - u_int8_t tdb_ttl; /* TTL used in tunneling */ - u_int8_t tdb_sproto; /* IPsec protocol */ - u_int16_t tdb_satype; /* Alignment */ - u_int32_t tdb_epoch; /* Used by the kernfs interface */ - u_int8_t *tdb_confname; /* Used by the kernfs interface */ - u_int8_t *tdb_authname; /* Used by the kernfs interface */ + caddr_t tdb_xdata; /* transformation data (opaque) */ + struct flow *tdb_flow; /* Which flows use this SA */ + + u_int8_t tdb_ttl; /* TTL used in tunneling */ + u_int8_t tdb_sproto; /* IPsec protocol */ + u_int16_t tdb_satype; /* Alignment */ + u_int32_t tdb_epoch; /* Used by the kernfs interface */ + u_int8_t *tdb_confname; /* Used by the kernfs interface */ + u_int8_t *tdb_authname; /* Used by the kernfs interface */ }; #define TDB_HASHMOD 257 struct xformsw { - u_short xf_type; /* Unique ID of xform */ - u_short xf_flags; /* flags (see below) */ - char *xf_name; /* human-readable name */ - int (*xf_attach)(void); /* called at config time */ - int (*xf_init)(struct tdb *, struct xformsw *, struct mbuf *); /* xform initialization */ - int (*xf_zeroize)(struct tdb *); /* termination */ - struct mbuf *(*xf_input)(struct mbuf *, struct tdb *); /* called when packet received */ - int (*xf_output)(struct mbuf *, struct sockaddr_encap *, struct tdb *, struct mbuf **); /* called when packet sent */ + u_short xf_type; /* Unique ID of xform */ + u_short xf_flags; /* flags (see below) */ + char *xf_name; /* human-readable name */ + int (*xf_attach) __P((void)); /* called at config time */ + + /* xform initialization */ + int (*xf_init) __P((struct tdb *, struct xformsw *, struct mbuf *)); + + int (*xf_zeroize) __P((struct tdb *)); /* termination */ + + /* called when packet received */ + struct mbuf *(*xf_input) __P((struct mbuf *, struct tdb *)); + + /* called when packet sent */ + int (*xf_output) __P((struct mbuf *, struct sockaddr_encap *, + struct tdb *, struct mbuf **)); }; #define XF_IP4 1 /* IP inside IP */ @@ -154,11 +159,11 @@ struct xformsw static __inline u_int64_t htonq(u_int64_t q) { - register u_int32_t u, l; - u = q >> 32; - l = (u_int32_t) q; + register u_int32_t u, l; + u = q >> 32; + l = (u_int32_t) q; - return htonl(u) | ((u_int64_t)htonl(l) << 32); + return htonl(u) | ((u_int64_t)htonl(l) << 32); } #define ntohq(_x) htonq(_x) @@ -193,14 +198,15 @@ extern struct xformsw xformsw[], *xformswNXFORMSW; u_int32_t notify_msgids; /* Check if a given tdb has encryption, authentication and/or tunneling */ -#define TDB_ATTRIB(x) (((x)->tdb_confname != NULL ? NOTIFY_SATYPE_CONF : 0)| \ - ((x)->tdb_authname != NULL ? NOTIFY_SATYPE_AUTH : 0)| \ - ((x)->tdb_confname != NULL && \ - ((x)->tdb_flags & TDBF_TUNNELING) ? NOTIFY_SATYPE_TUNNEL : 0)) +#define TDB_ATTRIB(x) \ + (((x)->tdb_confname != NULL ? NOTIFY_SATYPE_CONF : 0)| \ + ((x)->tdb_authname != NULL ? NOTIFY_SATYPE_AUTH : 0)| \ + ((x)->tdb_confname != NULL && \ + ((x)->tdb_flags & TDBF_TUNNELING) ? NOTIFY_SATYPE_TUNNEL : 0)) /* Traverse spi chain and get attributes */ -#define SPI_CHAIN_ATTRIB(have, TDB_DIR, TDBP) {\ +#define SPI_CHAIN_ATTRIB(have, TDB_DIR, TDBP) { \ struct tdb *tmptdb = (TDBP); \ (have) = 0; \ \ diff --git a/sys/netinet/ip_rmd160.h b/sys/netinet/ip_rmd160.h index bae7366317f..114aed82a3b 100644 --- a/sys/netinet/ip_rmd160.h +++ b/sys/netinet/ip_rmd160.h @@ -1,7 +1,6 @@ -/* $OpenBSD: ip_rmd160.h,v 1.2 1998/03/23 15:17:48 janjaap Exp $ */ +/* $OpenBSD: ip_rmd160.h,v 1.3 1999/02/17 18:10:08 deraadt Exp $ */ -/********************************************************************\ - * +/* * FILE: rmd160.h * * CONTENTS: Header file for a sample C-implementation of the @@ -15,26 +14,18 @@ * Copyright (c) Katholieke Universiteit Leuven * 1996, All Rights Reserved * -\********************************************************************/ + */ #ifndef _RMD160_H /* make sure this file is read only once */ #define _RMD160_H -/********************************************************************/ - -/* structure definitions */ - typedef struct { u_int32_t state[5]; /* state (ABCDE) */ u_int32_t length[2]; /* number of bits */ - u_char bbuffer[64]; /* overflow buffer */ - u_int32_t buflen; /* number of chars in bbuffer */ + u_char bbuffer[64]; /* overflow buffer */ + u_int32_t buflen; /* number of chars in bbuffer */ } RMD160_CTX; -/********************************************************************/ - -/* function prototypes */ - void RMD160Init __P((RMD160_CTX *context)); void RMD160Transform __P((u_int32_t state[5], const u_int32_t block[16])); void RMD160Update __P((RMD160_CTX *context, const u_char *data, u_int nbytes)); @@ -44,5 +35,3 @@ char *RMD160File __P((char *, char *)); char *RMD160Data __P((const u_char *, size_t, char *)); #endif /* _RMD160_H */ - -/*********************** end of file rmd160.h ***********************/ diff --git a/sys/netinet/ip_sha1.c b/sys/netinet/ip_sha1.c index a3334143d18..aa832103b89 100644 --- a/sys/netinet/ip_sha1.c +++ b/sys/netinet/ip_sha1.c @@ -1,17 +1,17 @@ -/* $OpenBSD: ip_sha1.c,v 1.6 1997/06/21 00:09:20 deraadt Exp $ */ +/* $OpenBSD: ip_sha1.c,v 1.7 1999/02/17 18:10:23 deraadt Exp $ */ /* -SHA-1 in C -By Steve Reid <steve@edmweb.com> -100% Public Domain - -Test Vectors (from FIPS PUB 180-1) -"abc" - A9993E36 4706816A BA3E2571 7850C26C 9CD0D89D -"abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq" - 84983E44 1C3BD26E BAAE4AA1 F95129E5 E54670F1 -A million repetitions of "a" - 34AA973C D4C4DAA4 F61EEB2B DBAD2731 6534016F + * SHA-1 in C + * By Steve Reid <steve@edmweb.com> + * 100% Public Domain + * + * Test Vectors (from FIPS PUB 180-1) + * "abc" + * A9993E36 4706816A BA3E2571 7850C26C 9CD0D89D + * "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq" + * 84983E44 1C3BD26E BAAE4AA1 F95129E5 E54670F1 + * A million repetitions of "a" + * 34AA973C D4C4DAA4 F61EEB2B DBAD2731 6534016F */ /* #define LITTLE_ENDIAN * This should be #define'd already, if true. */ diff --git a/sys/netinet/ip_sha1.h b/sys/netinet/ip_sha1.h index 186a774f9a2..f8d6569bf92 100644 --- a/sys/netinet/ip_sha1.h +++ b/sys/netinet/ip_sha1.h @@ -1,23 +1,23 @@ -/* $OpenBSD: ip_sha1.h,v 1.4 1997/07/11 23:38:00 provos Exp $ */ +/* $OpenBSD: ip_sha1.h,v 1.5 1999/02/17 18:10:24 deraadt Exp $ */ /* -SHA-1 in C -By Steve Reid <steve@edmweb.com> -100% Public Domain -*/ + * SHA-1 in C + * By Steve Reid <steve@edmweb.com> + * 100% Public Domain + */ #ifndef _SHA1_H_ #define _SHA1_H_ typedef struct { - u_int32_t state[5]; - u_int32_t count[2]; - unsigned char buffer[64]; + u_int32_t state[5]; + u_int32_t count[2]; + unsigned char buffer[64]; } SHA1_CTX; -void SHA1Transform(u_int32_t state[5], unsigned char buffer[64]); -void SHA1Init(SHA1_CTX* context); -void SHA1Update(SHA1_CTX* context, unsigned char* data, unsigned int len); -void SHA1Final(unsigned char digest[20], SHA1_CTX* context); +void SHA1Transform __P((u_int32_t state[5], unsigned char buffer[64])); +void SHA1Init __P((SHA1_CTX* context)); +void SHA1Update __P((SHA1_CTX* context, unsigned char* data, unsigned int len)); +void SHA1Final __P((unsigned char digest[20], SHA1_CTX* context)); #endif /* _SHA1_H_ */ |