Providers: fix OSSL_FUNC_CIPHER_CIPHER functions
authorRichard Levitte <levitte@openssl.org>
Thu, 10 Oct 2019 16:14:33 +0000 (18:14 +0200)
committerRichard Levitte <levitte@openssl.org>
Fri, 11 Oct 2019 13:55:36 +0000 (15:55 +0200)
This involves gcm_cipher() (providers/common/ciphers/cipher_gcm.c),
ccm_cipher() (providers/common/ciphers/cipher_ccm.c), and
tdes_wrap_cipher() (providers/common/ciphers/cipher_tdes_wrap.c)

These are generic implementations of the OSSL_FUNC_CIPHER_CIPHER
function, which returned -1 on error when they should return 0.

Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/10137)

providers/common/ciphers/cipher_ccm.c
providers/common/ciphers/cipher_gcm.c
providers/implementations/ciphers/cipher_tdes_wrap.c

index 904af3a5e059aeaede163e8bdeb4269f9ec593a6..021a004276245df9d0fd4bb9b6c1c6624ba91a4f 100644 (file)
@@ -278,11 +278,11 @@ int ccm_cipher(void *vctx,
 
     if (outsize < inl) {
         ERR_raise(ERR_LIB_PROV, PROV_R_OUTPUT_BUFFER_TOO_SMALL);
-        return -1;
+        return 0;
     }
 
     if (ccm_cipher_internal(ctx, out, outl, in, inl) <= 0)
-        return -1;
+        return 0;
 
     *outl = inl;
     return 1;
index 580928fddea51c93f6b7f140247975cb99af5b31..d7c67e8b6b6d3de158faa274e39ce9d31f5c0edd 100644 (file)
@@ -263,11 +263,11 @@ int gcm_cipher(void *vctx,
 
     if (outsize < inl) {
         ERR_raise(ERR_LIB_PROV, PROV_R_OUTPUT_BUFFER_TOO_SMALL);
-        return -1;
+        return 0;
     }
 
     if (gcm_cipher_internal(ctx, out, outl, in, inl) <= 0)
-        return -1;
+        return 0;
 
     *outl = inl;
     return 1;
index 75cc25df064ef0396b2100abbca640c8aaeb57cc..b26f2cb403dc9025b38fb7a7325651fae0dc749c 100644 (file)
@@ -131,7 +131,7 @@ static int tdes_wrap_cipher(void *vctx,
     *outl = 0;
     if (outsize < inl) {
         PROVerr(0, PROV_R_OUTPUT_BUFFER_TOO_SMALL);
-        return -1;
+        return 0;
     }
 
     ret = tdes_wrap_cipher_internal(ctx, out, in, inl);