Add per-file error identifiers

This commit is contained in:
Michael Brown
2007-07-24 17:11:31 +01:00
parent f0acd8d7a7
commit 9aa61ad5a2
16 changed files with 393 additions and 178 deletions

View File

@@ -1,5 +1,6 @@
#include "crypto/axtls/crypto.h"
#include <string.h>
#include <errno.h>
#include <gpxe/crypto.h>
#include <gpxe/aes.h>

24
src/crypto/cipher.c Normal file
View File

@@ -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;
}