mirror of
https://github.com/ipxe/ipxe
synced 2026-02-05 19:12:46 +03:00
[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:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user