crypto/aesni_gcm: fix zero data operation
[dpdk.git] / drivers / crypto / aesni_gcm / aesni_gcm_pmd.c
index e051624..05c68fb 100644 (file)
@@ -63,7 +63,7 @@ aesni_gcm_set_session_parameters(const struct aesni_gcm_ops *gcm_ops,
                if (auth_xform->auth.algo != RTE_CRYPTO_AUTH_AES_GMAC) {
                        GCM_LOG_ERR("Only AES GMAC is supported as an "
                                        "authentication only algorithm");
-                       return -EINVAL;
+                       return -ENOTSUP;
                }
                /* Set IV parameters */
                sess->iv.offset = auth_xform->auth.iv.offset;
@@ -86,7 +86,7 @@ aesni_gcm_set_session_parameters(const struct aesni_gcm_ops *gcm_ops,
                if (aead_xform->aead.algo != RTE_CRYPTO_AEAD_AES_GCM) {
                        GCM_LOG_ERR("The only combined operation "
                                                "supported is AES GCM");
-                       return -EINVAL;
+                       return -ENOTSUP;
                }
 
                /* Set IV parameters */
@@ -106,7 +106,7 @@ aesni_gcm_set_session_parameters(const struct aesni_gcm_ops *gcm_ops,
                digest_length = aead_xform->aead.digest_length;
        } else {
                GCM_LOG_ERR("Wrong xform type, has to be AEAD or authentication");
-               return -EINVAL;
+               return -ENOTSUP;
        }
 
 
@@ -129,7 +129,7 @@ aesni_gcm_set_session_parameters(const struct aesni_gcm_ops *gcm_ops,
                sess->key = AESNI_GCM_KEY_256;
                break;
        default:
-               GCM_LOG_ERR("Unsupported key length");
+               GCM_LOG_ERR("Invalid key length");
                return -EINVAL;
        }
 
@@ -224,7 +224,7 @@ process_gcm_crypto_op(struct aesni_gcm_qp *qp, struct rte_crypto_op *op,
 
        RTE_ASSERT(m_src != NULL);
 
-       while (offset >= m_src->data_len) {
+       while (offset >= m_src->data_len && data_length != 0) {
                offset -= m_src->data_len;
                m_src = m_src->next;