summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Baryshkov <dbaryshkov@gmail.com>2020-03-28 02:27:31 +0300
committerDmitry Baryshkov <dbaryshkov@gmail.com>2020-03-28 02:27:31 +0300
commit7054f199ec312f55e13256ccdf0d06b2b2335387 (patch)
tree25d9cdd6e986e421838f0f5e57e358beae3100e9
parent7fa4d8efcaecac06ebd38f3a4aa392ab76c721e4 (diff)
downloadgnutls-7054f199ec312f55e13256ccdf0d06b2b2335387.tar.gz
padlock: make cbc code return error properly
If underlying padlock_cbc_en/decrypt return an error, pass this error to calling code. Signed-off-by: Dmitry Baryshkov <dbaryshkov@gmail.com>
-rw-r--r--lib/accelerated/x86/aes-padlock.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/accelerated/x86/aes-padlock.c b/lib/accelerated/x86/aes-padlock.c
index f10b5c555d..018764bc67 100644
--- a/lib/accelerated/x86/aes-padlock.c
+++ b/lib/accelerated/x86/aes-padlock.c
@@ -119,13 +119,14 @@ padlock_aes_cbc_encrypt(void *_ctx, const void *src, size_t src_size,
{
struct padlock_ctx *ctx = _ctx;
struct padlock_cipher_data *pce;
+ int ret = 1;
pce = ALIGN16(&ctx->expanded_key);
if (src_size > 0)
- padlock_cbc_encrypt(dst, src, pce, src_size);
+ ret = padlock_cbc_encrypt(dst, src, pce, src_size);
- return 0;
+ return ret ? 0 : GNUTLS_E_ENCRYPTION_FAILED;
}
@@ -135,13 +136,14 @@ padlock_aes_cbc_decrypt(void *_ctx, const void *src, size_t src_size,
{
struct padlock_ctx *ctx = _ctx;
struct padlock_cipher_data *pcd;
+ int ret = 1;
pcd = ALIGN16(&ctx->expanded_key);
if (src_size > 0)
padlock_cbc_encrypt(dst, src, pcd, src_size);
- return 0;
+ return ret ? 0 : GNUTLS_E_ENCRYPTION_FAILED;
}
static void aes_deinit(void *_ctx)