diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2002-04-22 23:10:10 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2002-04-22 23:10:10 +0000 |
commit | 8aae07172099cb259e5bfc06d6f440ff6cfbb2e0 (patch) | |
tree | bdb9c646f13bc3f8a982ad7098dedcb7b3ea41a7 | |
parent | 0515b4493a7cba282f12a211c359b99a9118b55d (diff) |
KNF
-rw-r--r-- | sys/crypto/cryptosoft.c | 68 | ||||
-rw-r--r-- | sys/crypto/cryptosoft.h | 4 | ||||
-rw-r--r-- | sys/crypto/xform.c | 10 | ||||
-rw-r--r-- | sys/crypto/xform.h | 6 |
4 files changed, 44 insertions, 44 deletions
diff --git a/sys/crypto/cryptosoft.c b/sys/crypto/cryptosoft.c index bb0bc55ce35..9ae12656614 100644 --- a/sys/crypto/cryptosoft.c +++ b/sys/crypto/cryptosoft.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cryptosoft.c,v 1.33 2002/04/03 23:22:36 fgsch Exp $ */ +/* $OpenBSD: cryptosoft.c,v 1.34 2002/04/22 23:10:09 deraadt Exp $ */ /* * The author of this code is Angelos D. Keromytis (angelos@cis.upenn.edu) @@ -12,7 +12,7 @@ * Permission to use, copy, and modify this software with or without fee * is hereby granted, provided that this entire notice is included in * all source code copies of any software which is or includes a copy or - * modification of this software. + * modification of this software. * * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR * IMPLIED WARRANTY. IN PARTICULAR, NONE OF THE AUTHORS MAKES ANY @@ -39,13 +39,13 @@ #include <crypto/xform.h> u_int8_t hmac_ipad_buffer[64] = { - 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, - 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, - 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, - 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, - 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, - 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, - 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, + 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, + 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, + 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, + 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, + 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, + 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, + 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36, 0x36 }; @@ -174,7 +174,7 @@ swcr_encdec(struct cryptodesc *crd, struct swcr_data *sw, caddr_t buf, bcopy(blk, iv, blks); ivp = iv; } else { /* decrypt */ - /* + /* * Keep encrypted block for XOR'ing * with next block */ @@ -297,7 +297,7 @@ swcr_encdec(struct cryptodesc *crd, struct swcr_data *sw, caddr_t buf, bcopy(blk, iv, blks); ivp = iv; } else { /* decrypt */ - /* + /* * Keep encrypted block for XOR'ing * with next block */ @@ -320,7 +320,7 @@ swcr_encdec(struct cryptodesc *crd, struct swcr_data *sw, caddr_t buf, /* Copy back decrypted block */ cuio_copyback(uio, k, blks, blk); - + count += blks; /* Advance pointer */ @@ -449,7 +449,7 @@ swcr_authcompute(struct cryptop *crp, struct cryptodesc *crd, COPYBACK(outtype, buf, crd->crd_inject, axf->authsize, aalg); else bcopy(aalg, crp->crp_mac, axf->authsize); - + return 0; } @@ -464,29 +464,29 @@ swcr_compdec(struct cryptodesc *crd, struct swcr_data *sw, struct comp_algo *cxf; int adj; u_int32_t result; - + cxf = sw->sw_cxf; /* We must handle the whole buffer of data in one time * then if there is not all the data in the mbuf, we must * copy in a buffer. */ - + MALLOC(data, u_int8_t *, crd->crd_len, M_CRYPTO_DATA, M_NOWAIT); if (data == NULL) return (EINVAL); COPYDATA(outtype, buf, crd->crd_skip, crd->crd_len, data); - + if (crd->crd_flags & CRD_F_COMP) result = cxf->compress(data, crd->crd_len, &out); else result = cxf->decompress(data, crd->crd_len, &out); - + FREE(data, M_CRYPTO_DATA); if (result == 0) return EINVAL; - /* Copy back the (de)compressed data. m_copyback is + /* Copy back the (de)compressed data. m_copyback is * extending the mbuf as necessary. */ sw->sw_size = result; @@ -498,7 +498,7 @@ swcr_compdec(struct cryptodesc *crd, struct swcr_data *sw, return 0; } } - + COPYBACK(outtype, buf, crd->crd_skip, result, out); if (result < crd->crd_len) { adj = result - crd->crd_len; @@ -617,7 +617,7 @@ swcr_newsession(u_int32_t *sid, struct cryptoini *cri) cri->cri_klen / 8); (*swd)->sw_exf = txf; break; - + case CRYPTO_MD5_HMAC: axf = &auth_hash_hmac_md5_96; goto authcommon; @@ -633,41 +633,41 @@ swcr_newsession(u_int32_t *sid, struct cryptoini *cri) swcr_freesession(i); return ENOBUFS; } - + (*swd)->sw_octx = malloc(axf->ctxsize, M_CRYPTO_DATA, M_NOWAIT); if ((*swd)->sw_octx == NULL) { swcr_freesession(i); return ENOBUFS; } - + for (k = 0; k < cri->cri_klen / 8; k++) cri->cri_key[k] ^= HMAC_IPAD_VAL; - + axf->Init((*swd)->sw_ictx); axf->Update((*swd)->sw_ictx, cri->cri_key, cri->cri_klen / 8); axf->Update((*swd)->sw_ictx, hmac_ipad_buffer, HMAC_BLOCK_LEN - (cri->cri_klen / 8)); - + for (k = 0; k < cri->cri_klen / 8; k++) cri->cri_key[k] ^= (HMAC_IPAD_VAL ^ HMAC_OPAD_VAL); - + axf->Init((*swd)->sw_octx); axf->Update((*swd)->sw_octx, cri->cri_key, cri->cri_klen / 8); axf->Update((*swd)->sw_octx, hmac_opad_buffer, HMAC_BLOCK_LEN - (cri->cri_klen / 8)); - + for (k = 0; k < cri->cri_klen / 8; k++) cri->cri_key[k] ^= HMAC_OPAD_VAL; (*swd)->sw_axf = axf; break; - + case CRYPTO_MD5_KPDK: axf = &auth_hash_key_md5; goto auth2common; - + case CRYPTO_SHA1_KPDK: axf = &auth_hash_key_sha1; auth2common: @@ -677,7 +677,7 @@ swcr_newsession(u_int32_t *sid, struct cryptoini *cri) swcr_freesession(i); return ENOBUFS; } - + /* Store the key so we can "append" it to the payload */ (*swd)->sw_octx = malloc(cri->cri_klen / 8, M_CRYPTO_DATA, M_NOWAIT); @@ -685,7 +685,7 @@ swcr_newsession(u_int32_t *sid, struct cryptoini *cri) swcr_freesession(i); return ENOBUFS; } - + (*swd)->sw_klen = cri->cri_klen / 8; bcopy(cri->cri_key, (*swd)->sw_octx, cri->cri_klen / 8); axf->Init((*swd)->sw_ictx); @@ -698,7 +698,7 @@ swcr_newsession(u_int32_t *sid, struct cryptoini *cri) case CRYPTO_MD5: axf = &auth_hash_md5; goto auth3common; - + case CRYPTO_SHA1: axf = &auth_hash_sha1; auth3common: @@ -708,7 +708,7 @@ swcr_newsession(u_int32_t *sid, struct cryptoini *cri) swcr_freesession(i); return ENOBUFS; } - + axf->Init((*swd)->sw_ictx); (*swd)->sw_axf = axf; break; @@ -721,7 +721,7 @@ swcr_newsession(u_int32_t *sid, struct cryptoini *cri) swcr_freesession(i); return EINVAL; } - + (*swd)->sw_alg = cri->cri_alg; cri = cri->cri_next; swd = &((*swd)->sw_next); @@ -890,7 +890,7 @@ swcr_process(struct cryptop *crp) break; case CRYPTO_DEFLATE_COMP: - if ((crp->crp_etype = swcr_compdec(crd, sw, + if ((crp->crp_etype = swcr_compdec(crd, sw, crp->crp_buf, type)) != 0) goto done; else diff --git a/sys/crypto/cryptosoft.h b/sys/crypto/cryptosoft.h index 6a445672918..7a98cbb9e5e 100644 --- a/sys/crypto/cryptosoft.h +++ b/sys/crypto/cryptosoft.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cryptosoft.h,v 1.9 2002/03/19 23:24:53 angelos Exp $ */ +/* $OpenBSD: cryptosoft.h,v 1.10 2002/04/22 23:10:09 deraadt Exp $ */ /* * The author of this code is Angelos D. Keromytis (angelos@cis.upenn.edu) @@ -12,7 +12,7 @@ * Permission to use, copy, and modify this software with or without fee * is hereby granted, provided that this entire notice is included in * all source code copies of any software which is or includes a copy or - * modification of this software. + * modification of this software. * * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR * IMPLIED WARRANTY. IN PARTICULAR, NONE OF THE AUTHORS MAKES ANY diff --git a/sys/crypto/xform.c b/sys/crypto/xform.c index 7d813e956e4..6170d901553 100644 --- a/sys/crypto/xform.c +++ b/sys/crypto/xform.c @@ -1,4 +1,4 @@ -/* $OpenBSD: xform.c,v 1.17 2002/03/05 15:59:41 markus Exp $ */ +/* $OpenBSD: xform.c,v 1.18 2002/04/22 23:10:09 deraadt Exp $ */ /* * The authors of this code are John Ioannidis (ji@tla.org), * Angelos D. Keromytis (kermit@csd.uch.gr) and @@ -179,17 +179,17 @@ struct auth_hash auth_hash_hmac_ripemd_160_96 = { }; struct auth_hash auth_hash_key_md5 = { - CRYPTO_MD5_KPDK, "Keyed MD5", + CRYPTO_MD5_KPDK, "Keyed MD5", 0, 16, 16, sizeof(MD5_CTX), (void (*)(void *)) MD5Init, MD5Update_int, - (void (*)(u_int8_t *, void *)) MD5Final + (void (*)(u_int8_t *, void *)) MD5Final }; struct auth_hash auth_hash_key_sha1 = { CRYPTO_SHA1_KPDK, "Keyed SHA1", 0, 20, 20, sizeof(SHA1_CTX), (void (*)(void *)) SHA1Init, SHA1Update_int, - (void (*)(u_int8_t *, void *)) SHA1Final + (void (*)(u_int8_t *, void *)) SHA1Final }; struct auth_hash auth_hash_md5 = { @@ -203,7 +203,7 @@ struct auth_hash auth_hash_sha1 = { CRYPTO_SHA1, "SHA1", 0, 20, 20, sizeof(SHA1_CTX), (void (*)(void *)) SHA1Init, SHA1Update_int, - (void (*)(u_int8_t *, void *)) SHA1Final + (void (*)(u_int8_t *, void *)) SHA1Final }; /* Compression instance */ diff --git a/sys/crypto/xform.h b/sys/crypto/xform.h index d48154d1643..ae236e0e386 100644 --- a/sys/crypto/xform.h +++ b/sys/crypto/xform.h @@ -1,4 +1,4 @@ -/* $OpenBSD: xform.h,v 1.9 2002/02/24 00:30:00 deraadt Exp $ */ +/* $OpenBSD: xform.h,v 1.10 2002/04/22 23:10:09 deraadt Exp $ */ /* * The author of this code is Angelos D. Keromytis (angelos@cis.upenn.edu) @@ -12,7 +12,7 @@ * Permission to use, copy, and modify this software with or without fee * is hereby granted, provided that this entire notice is included in * all source code copies of any software which is or includes a copy or - * modification of this software. + * modification of this software. * * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR * IMPLIED WARRANTY. IN PARTICULAR, NONE OF THE AUTHORS MAKES ANY @@ -33,7 +33,7 @@ struct auth_hash { int type; char *name; u_int16_t keysize; - u_int16_t hashsize; + u_int16_t hashsize; u_int16_t authsize; u_int16_t ctxsize; void (*Init) (void *); |