mirror of
https://github.com/ipxe/ipxe
synced 2026-02-11 22:00:06 +03:00
Add per-file error identifiers
This commit is contained in:
@@ -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
24
src/crypto/cipher.c
Normal 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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user