New upstream version 18.11-rc1
[deb_dpdk.git] / drivers / crypto / openssl / rte_openssl_pmd.c
index 7d263ab..003116d 100644 (file)
@@ -1509,15 +1509,7 @@ process_openssl_auth_op(struct openssl_qp *qp, struct rte_crypto_op *op,
 
        srclen = op->sym->auth.data.length;
 
-       if (sess->auth.operation == RTE_CRYPTO_AUTH_OP_VERIFY)
-               dst = qp->temp_digest;
-       else {
-               dst = op->sym->auth.digest.data;
-               if (dst == NULL)
-                       dst = rte_pktmbuf_mtod_offset(mbuf_dst, uint8_t *,
-                                       op->sym->auth.data.offset +
-                                       op->sym->auth.data.length);
-       }
+       dst = qp->temp_digest;
 
        switch (sess->auth.mode) {
        case OPENSSL_AUTH_AS_AUTH:
@@ -1540,6 +1532,15 @@ process_openssl_auth_op(struct openssl_qp *qp, struct rte_crypto_op *op,
                                sess->auth.digest_length) != 0) {
                        op->status = RTE_CRYPTO_OP_STATUS_AUTH_FAILED;
                }
+       } else {
+               uint8_t *auth_dst;
+
+               auth_dst = op->sym->auth.digest.data;
+               if (auth_dst == NULL)
+                       auth_dst = rte_pktmbuf_mtod_offset(mbuf_dst, uint8_t *,
+                                       op->sym->auth.data.offset +
+                                       op->sym->auth.data.length);
+               memcpy(auth_dst, dst, sess->auth.digest_length);
        }
 
        if (status != 0)
@@ -1564,7 +1565,7 @@ process_openssl_dsa_sign_op(struct rte_crypto_op *cop,
                cop->status = RTE_CRYPTO_OP_STATUS_ERROR;
        } else {
                const BIGNUM *r = NULL, *s = NULL;
-               get_dsa_sign(sign, r, s);
+               get_dsa_sign(sign, &r, &s);
 
                op->r.length = BN_bn2bin(r, op->r.data);
                op->s.length = BN_bn2bin(s, op->s.data);
@@ -1666,7 +1667,7 @@ process_openssl_dh_op(struct rte_crypto_op *cop,
                        cop->status = RTE_CRYPTO_OP_STATUS_NOT_PROCESSED;
                        return -1;
                }
-               set_dh_priv_key(dh_key, priv_key, ret);
+               ret = set_dh_priv_key(dh_key, priv_key);
                if (ret) {
                        OPENSSL_LOG(ERR, "Failed to set private key\n");
                        cop->status = RTE_CRYPTO_OP_STATUS_ERROR;
@@ -1715,7 +1716,7 @@ process_openssl_dh_op(struct rte_crypto_op *cop,
                        cop->status = RTE_CRYPTO_OP_STATUS_NOT_PROCESSED;
                        return -1;
                }
-               set_dh_priv_key(dh_key, priv_key, ret);
+               ret = set_dh_priv_key(dh_key, priv_key);
                if (ret) {
                        OPENSSL_LOG(ERR, "Failed to set private key\n");
                        cop->status = RTE_CRYPTO_OP_STATUS_ERROR;
@@ -1743,7 +1744,7 @@ process_openssl_dh_op(struct rte_crypto_op *cop,
                                __func__, __LINE__);
 
                /* get the generated keys */
-               get_dh_pub_key(dh_key, pub_key);
+               get_dh_pub_key(dh_key, &pub_key);
 
                /* output public key */
                op->pub_key.length = BN_bn2bin(pub_key,
@@ -1758,7 +1759,7 @@ process_openssl_dh_op(struct rte_crypto_op *cop,
                                __func__, __LINE__);
 
                /* get the generated keys */
-               get_dh_priv_key(dh_key, priv_key);
+               get_dh_priv_key(dh_key, &priv_key);
 
                /* provide generated private key back to user */
                op->priv_key.length = BN_bn2bin(priv_key,