Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Wim Lewis
nettle
Commits
250c4c17
Commit
250c4c17
authored
Sep 09, 2001
by
Niels Möller
Browse files
* cbc.h (CBC_CTX): New macro.
(CBC_ENCRYPT): New macro. (CBC_DECRYPT): New macro. Rev: src/nettle/cbc.h:1.3
parent
7e12e96e
Changes
1
Hide whitespace changes
Inline
Side-by-side
cbc.h
View file @
250c4c17
...
...
@@ -46,11 +46,44 @@ cbc_decrypt(void *ctx, void (*f)(void *ctx,
unsigned
length
,
uint8_t
*
dst
,
const
uint8_t
*
src
);
#define CBC_CTX(type, size) \
{ type ctx; uint8_t iv[size]; }
#define CBC_SET_IV(ctx, data) \
memcpy((ctx)->iv, (data), sizeof((ctx)->iv))
#if 0
#define CBC_ENCRYPT(self, f, length, dst, src) \
do { if (0) (f)(&(self)->ctx, 0, NULL, NULL); \
cbc_encrypt((void *) &(self)->ctx, \
(void (*)(void *, unsigned, uint8_t *, const uint8_t *)) (f), \
sizeof((self)->iv), (self)->iv, \
(length), (dst), (src)); \
} while (0)
#endif
#define CBC_ENCRYPT(self, f, length, dst, src) \
(0 ? ((f)(&(self)->ctx, 0, NULL, NULL)) \
: cbc_encrypt((void *) &(self)->ctx, \
(void (*)(void *, unsigned, uint8_t *, const uint8_t *)) (f), \
sizeof((self)->iv), (self)->iv, \
(length), (dst), (src)))
#define CBC_DECRYPT(self, f, length, dst, src) \
(0 ? ((f)(&(self)->ctx, 0, NULL, NULL)) \
: cbc_decrypt((void *) &(self)->ctx, \
(void (*)(void *, unsigned, uint8_t *, const uint8_t *)) (f), \
sizeof((self)->iv), (self)->iv, \
(length), (dst), (src)))
#if 0
/* Type safer variants */
#define CBC_ENCRYPT(ctx, f, b, iv, l, dst, src) \
#define CBC_ENCRYPT
2
(ctx, f, b, iv, l, dst, src) \
(0 ? ((f)((ctx),0,NULL,NULL)) \
: cbc_encrypt((void *)(ctx), \
((*)(void *, unsigned, uint8_t *, const uint8_t *)) (f), \
(
void
(*)(void *, unsigned, uint8_t *, const uint8_t *)) (f), \
(b), (iv), (l), (dst), (src)))
#endif
#endif
/* NETTLE_CBC_H_INCLUDED */
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment