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/crypto | |
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/crypto')
-rw-r--r-- | src/crypto/axtls_aes.c | 1 | ||||
-rw-r--r-- | src/crypto/cipher.c | 24 |
2 files changed, 25 insertions, 0 deletions
diff --git a/src/crypto/axtls_aes.c b/src/crypto/axtls_aes.c index a587c5cb..ac7e921d 100644 --- a/src/crypto/axtls_aes.c +++ b/src/crypto/axtls_aes.c @@ -1,5 +1,6 @@ #include "crypto/axtls/crypto.h" #include <string.h> +#include <errno.h> #include <gpxe/crypto.h> #include <gpxe/aes.h> diff --git a/src/crypto/cipher.c b/src/crypto/cipher.c new file mode 100644 index 00000000..9c392009 --- /dev/null +++ b/src/crypto/cipher.c @@ -0,0 +1,24 @@ +#include <stdint.h> +#include <errno.h> +#include <gpxe/crypto.h> + +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; +} + +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; +} + |