diff options
author | Jun-ichiro itojun Hagino <itojun@FreeBSD.org> | 2000-07-04 16:35:15 +0000 |
---|---|---|
committer | Jun-ichiro itojun Hagino <itojun@FreeBSD.org> | 2000-07-04 16:35:15 +0000 |
commit | 686cdd19b1b182f2257bc158116e78c5fef84980 (patch) | |
tree | 22136d6c52358a61b8b21d1cda50d53ec766ab1e /sys/crypto/blowfish/bf_cbc_m.c | |
parent | 2d311b79cdb0da87624d7791e2fc72067edc5217 (diff) | |
download | src-686cdd19b1b182f2257bc158116e78c5fef84980.tar.gz src-686cdd19b1b182f2257bc158116e78c5fef84980.zip |
sync with kame tree as of july00. tons of bug fixes/improvements.
API changes:
- additional IPv6 ioctls
- IPsec PF_KEY API was changed, it is mandatory to upgrade setkey(8).
(also syntax change)
Notes
Notes:
svn path=/head/; revision=62587
Diffstat (limited to 'sys/crypto/blowfish/bf_cbc_m.c')
-rw-r--r-- | sys/crypto/blowfish/bf_cbc_m.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/sys/crypto/blowfish/bf_cbc_m.c b/sys/crypto/blowfish/bf_cbc_m.c index 20df977ce78a..088adad1441c 100644 --- a/sys/crypto/blowfish/bf_cbc_m.c +++ b/sys/crypto/blowfish/bf_cbc_m.c @@ -1,3 +1,6 @@ +/* $FreeBSD$ */ +/* $KAME: bf_cbc_m.c,v 1.4 2000/06/14 10:41:16 itojun Exp $ */ + /* * heavily modified to accept mbuf, by Jun-ichiro itojun Itoh * <itojun@itojun.org>, 1997. @@ -58,8 +61,6 @@ * derivative of this code cannot be changed. i.e. this code cannot simply be * copied and put under another distribution licence * [including the GNU Public Licence.] - * - * $FreeBSD$ */ #include <sys/param.h> @@ -69,9 +70,9 @@ #include <crypto/blowfish/blowfish.h> #include <crypto/blowfish/bf_locl.h> -#define panic(x) {printf(x); return;} +#define panic(x) do { printf(x); return EINVAL; } while (0) -void BF_cbc_encrypt_m(m0, skip, length, key, iv, mode) +int BF_cbc_encrypt_m(m0, skip, length, key, iv, mode) struct mbuf *m0; int skip; int length; @@ -89,19 +90,19 @@ void BF_cbc_encrypt_m(m0, skip, length, key, iv, mode) /* sanity checks */ if (m0->m_pkthdr.len < skip) { printf("mbuf length < skip\n"); - return; + return EINVAL; } if (m0->m_pkthdr.len < length) { printf("mbuf length < encrypt length\n"); - return; + return EINVAL; } if (m0->m_pkthdr.len < skip + length) { printf("mbuf length < skip + encrypt length\n"); - return; + return EINVAL; } if (length % 8) { printf("length is not multiple of 8\n"); - return; + return EINVAL; } m = m0; @@ -155,7 +156,7 @@ void BF_cbc_encrypt_m(m0, skip, length, key, iv, mode) while (in - &inbuf[0] < 8) { if (!p) panic("mbuf chain?\n"); - + *in++ = *p++; noff++; if (noff < n->m_len) @@ -337,4 +338,6 @@ void BF_cbc_encrypt_m(m0, skip, length, key, iv, mode) length -= 8; } } + + return 0; } |