diff options
| author | Michael Brown | 2007-07-24 18:11:31 +0200 |
|---|---|---|
| committer | Michael Brown | 2007-07-24 18:11:31 +0200 |
| commit | 9aa61ad5a26e04493a38bf4f9b6bd1228fef7a79 (patch) | |
| tree | 3b86aec2b1cc194dca76178c0415c131e8a92b1b /src/include/gpxe/crypto.h | |
| parent | Define -DOBJECT when generating Makefile rules, for consistency. (diff) | |
| download | ipxe-9aa61ad5a26e04493a38bf4f9b6bd1228fef7a79.tar.gz ipxe-9aa61ad5a26e04493a38bf4f9b6bd1228fef7a79.tar.xz ipxe-9aa61ad5a26e04493a38bf4f9b6bd1228fef7a79.zip | |
Add per-file error identifiers
Diffstat (limited to 'src/include/gpxe/crypto.h')
| -rw-r--r-- | src/include/gpxe/crypto.h | 28 |
1 files changed, 7 insertions, 21 deletions
diff --git a/src/include/gpxe/crypto.h b/src/include/gpxe/crypto.h index fc1f50bc5..95665acc5 100644 --- a/src/include/gpxe/crypto.h +++ b/src/include/gpxe/crypto.h @@ -9,7 +9,6 @@ #include <stdint.h> #include <stddef.h> -#include <errno.h> /** A cryptographic algorithm */ struct crypto_algorithm { @@ -101,30 +100,17 @@ static inline int cipher_setkey ( struct crypto_algorithm *crypto, return crypto->setkey ( ctx, key, keylen ); } -static inline int cipher_encrypt ( struct crypto_algorithm *crypto, - void *ctx, const void *src, void *dst, - size_t len ) { - if ( ( len & ( crypto->blocksize - 1 ) ) ) { - return -EINVAL; - } - crypto->encode ( ctx, src, dst, len ); - return 0; -} - -static inline int cipher_decrypt ( struct crypto_algorithm *crypto, - void *ctx, const void *src, void *dst, - size_t len ) { - if ( ( len & ( crypto->blocksize - 1 ) ) ) { - return -EINVAL; - } - crypto->decode ( ctx, src, dst, len ); - return 0; -} - static inline int is_stream_cipher ( struct crypto_algorithm *crypto ) { return ( crypto->blocksize == 1 ); } extern struct crypto_algorithm crypto_null; +extern int cipher_encrypt ( struct crypto_algorithm *crypto, + void *ctx, const void *src, void *dst, + size_t len ); +extern int cipher_decrypt ( struct crypto_algorithm *crypto, + void *ctx, const void *src, void *dst, + size_t len ); + #endif /* _GPXE_CRYPTO_H */ |
