diff options
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 20df977..088adad 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; } |