This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-crypto.git


The following commit(s) were added to refs/heads/master by this push:
     new d606eeb  Don't ignore native API return code, more to do.
d606eeb is described below

commit d606eeb9661da75f8fcd3d858de66897c80c45a1
Author: Gary Gregory <[email protected]>
AuthorDate: Thu Mar 17 09:52:12 2022 -0400

    Don't ignore native API return code, more to do.
---
 .../apache/commons/crypto/cipher/OpenSslGaloisCounterMode.java | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git 
a/src/main/java/org/apache/commons/crypto/cipher/OpenSslGaloisCounterMode.java 
b/src/main/java/org/apache/commons/crypto/cipher/OpenSslGaloisCounterMode.java
index d8b8de4..9edbc5d 100644
--- 
a/src/main/java/org/apache/commons/crypto/cipher/OpenSslGaloisCounterMode.java
+++ 
b/src/main/java/org/apache/commons/crypto/cipher/OpenSslGaloisCounterMode.java
@@ -301,19 +301,19 @@ class OpenSslGaloisCounterMode extends 
OpenSslFeedbackCipher {
      * @param type CtrlValues
      * @param arg argument like a tag length
      * @param data byte buffer or null
+     * @return return 0 if there is any error, else return 1.
      */
-    private void evpCipherCtxCtrl(final long context, final int type, final 
int arg, final ByteBuffer data) {
+    private int evpCipherCtxCtrl(final long context, final int type, final int 
arg, final ByteBuffer data) {
         checkState();
-
         try {
             if (data != null) {
                 data.order(ByteOrder.nativeOrder());
-                OpenSslNative.ctrl(context, type, arg, data.array());
-            } else {
-                OpenSslNative.ctrl(context, type, arg, null);
+                return OpenSslNative.ctrl(context, type, arg, data.array());
             }
+            return OpenSslNative.ctrl(context, type, arg, null);
         } catch (final Exception e) {
             System.out.println(e.getMessage());
+            return 0;
         }
     }
 }

Reply via email to