Move COPYDATA() and COPYBACK() macros to cryptodev.h, they will be used

in padlock(4) as well.
This commit is contained in:
Pawel Jakub Dawidek 2006-06-04 15:10:12 +00:00
parent 1dc8d404ae
commit d905998c95
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=159234
2 changed files with 27 additions and 27 deletions

View File

@ -413,5 +413,32 @@ extern void cuio_copyback(struct uio* uio, int off, int len, caddr_t cp);
extern struct iovec *cuio_getptr(struct uio *uio, int loc, int *off);
extern int cuio_apply(struct uio *uio, int off, int len,
int (*f)(void *, void *, u_int), void *arg);
struct mbuf;
#define COPYBACK(type, buf, off, size, in) do { \
switch (type) { \
case CRYPTO_BUF_CONTIG: \
bcopy(in, (u_char *)(buf) + (off), size); \
break; \
case CRYPTO_BUF_MBUF: \
m_copyback((struct mbuf *)(buf), off, size, in); \
break; \
case CRYPTO_BUF_IOV: \
cuio_copyback((struct uio *)(buf), off, size, in); \
break; \
} \
} while (0)
#define COPYDATA(type, buf, off, size, out) do { \
switch (type) { \
case CRYPTO_BUF_CONTIG: \
bcopy((u_char *)(buf) + (off), out, size); \
break; \
case CRYPTO_BUF_MBUF: \
m_copydata((struct mbuf *)(buf), off, size, out); \
break; \
case CRYPTO_BUF_IOV: \
cuio_copydata((struct uio *)(buf), off, size, out); \
break; \
} \
} while (0)
#endif /* _KERNEL */
#endif /* _CRYPTO_CRYPTO_H_ */

View File

@ -52,33 +52,6 @@ struct swcr_data **swcr_sessions = NULL;
u_int32_t swcr_sesnum = 0;
int32_t swcr_id = -1;
#define COPYBACK(type, buf, off, size, in) do { \
switch (type) { \
case CRYPTO_BUF_CONTIG: \
bcopy(in, (u_char *)(buf) + (off), size); \
break; \
case CRYPTO_BUF_MBUF: \
m_copyback((struct mbuf *)(buf), off, size, in); \
break; \
case CRYPTO_BUF_IOV: \
cuio_copyback((struct uio *)(buf), off, size, in); \
break; \
} \
} while (0)
#define COPYDATA(type, buf, off, size, out) do { \
switch (type) { \
case CRYPTO_BUF_CONTIG: \
bcopy((u_char *)(buf) + (off), out, size); \
break; \
case CRYPTO_BUF_MBUF: \
m_copydata((struct mbuf *)(buf), off, size, out); \
break; \
case CRYPTO_BUF_IOV: \
cuio_copydata((struct uio *)(buf), off, size, out); \
break; \
} \
} while (0)
static int swcr_encdec(struct cryptodesc *, struct swcr_data *, caddr_t, int);
static int swcr_authcompute(struct cryptodesc *crd, struct swcr_data *sw,
caddr_t buf, int outtype);