2
0
mirror of https://github.com/xcat2/xNBA.git synced 2024-12-15 07:41:45 +00:00
xNBA/src/crypto/cipher.c

25 lines
551 B
C
Raw Normal View History

2007-07-24 16:11:31 +00:00
#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;
}