[crypto] Change cipher_{en,de}crypt() to void functions

It is a programming error, not a runtime error, if we attempt to use
block ciphers with an incorrect blocksize, so use an assert() rather
than an error status return.
This commit is contained in:
Michael Brown
2009-02-18 22:27:34 +00:00
parent a3219b24a8
commit b4d3d686cc
3 changed files with 25 additions and 50 deletions

View File

@@ -1,24 +0,0 @@
#include <stdint.h>
#include <errno.h>
#include <gpxe/crypto.h>
int cipher_encrypt ( struct cipher_algorithm *cipher,
void *ctx, const void *src, void *dst,
size_t len ) {
if ( ( len & ( cipher->blocksize - 1 ) ) ) {
return -EINVAL;
}
cipher->encrypt ( ctx, src, dst, len );
return 0;
}
int cipher_decrypt ( struct cipher_algorithm *cipher,
void *ctx, const void *src, void *dst,
size_t len ) {
if ( ( len & ( cipher->blocksize - 1 ) ) ) {
return -EINVAL;
}
cipher->decrypt ( ctx, src, dst, len );
return 0;
}