get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/1.2/patches/812195/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 812195,
    "url": "http://patchwork.ozlabs.org/api/1.2/patches/812195/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/1505092240-10864-7-git-send-email-longpeng2@huawei.com/",
    "project": {
        "id": 14,
        "url": "http://patchwork.ozlabs.org/api/1.2/projects/14/?format=api",
        "name": "QEMU Development",
        "link_name": "qemu-devel",
        "list_id": "qemu-devel.nongnu.org",
        "list_email": "qemu-devel@nongnu.org",
        "web_url": "",
        "scm_url": "",
        "webscm_url": "",
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<1505092240-10864-7-git-send-email-longpeng2@huawei.com>",
    "list_archive_url": null,
    "date": "2017-09-11T01:10:38",
    "name": "[RFC,6/8] cryptodev: extract one util function",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "76472d1f13f863e0ee2748f75ab2f42420fb6a70",
    "submitter": {
        "id": 69776,
        "url": "http://patchwork.ozlabs.org/api/1.2/people/69776/?format=api",
        "name": "Longpeng (Mike, Cloud Infrastructure Service Product Dept.)",
        "email": "longpeng2@huawei.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/1505092240-10864-7-git-send-email-longpeng2@huawei.com/mbox/",
    "series": [
        {
            "id": 2424,
            "url": "http://patchwork.ozlabs.org/api/1.2/series/2424/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=2424",
            "date": "2017-09-11T01:10:38",
            "name": null,
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/2424/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/812195/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/812195/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>",
        "X-Original-To": "incoming@patchwork.ozlabs.org",
        "Delivered-To": "patchwork-incoming@bilbo.ozlabs.org",
        "Authentication-Results": "ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)",
        "Received": [
            "from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xr8zX6WY1z9s82\n\tfor <incoming@patchwork.ozlabs.org>;\n\tMon, 11 Sep 2017 11:12:24 +1000 (AEST)",
            "from localhost ([::1]:54826 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1drDGw-0004JK-0H\n\tfor incoming@patchwork.ozlabs.org; Sun, 10 Sep 2017 21:12:22 -0400",
            "from eggs.gnu.org ([2001:4830:134:3::10]:35254)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <longpeng2@huawei.com>) id 1drDG5-0004HK-Sp\n\tfor qemu-devel@nongnu.org; Sun, 10 Sep 2017 21:11:31 -0400",
            "from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <longpeng2@huawei.com>) id 1drDG1-00045o-2i\n\tfor qemu-devel@nongnu.org; Sun, 10 Sep 2017 21:11:29 -0400",
            "from szxga05-in.huawei.com ([45.249.212.191]:2257)\n\tby eggs.gnu.org with esmtps (TLS1.0:RSA_ARCFOUR_SHA1:16) (Exim 4.71)\n\t(envelope-from <longpeng2@huawei.com>) id 1drDG0-00041D-2a\n\tfor qemu-devel@nongnu.org; Sun, 10 Sep 2017 21:11:25 -0400",
            "from 172.30.72.59 (EHLO DGGEMS404-HUB.china.huawei.com)\n\t([172.30.72.59])\n\tby dggrg05-dlp.huawei.com (MOS 4.4.6-GA FastPath queued)\n\twith ESMTP id DHB06012; Mon, 11 Sep 2017 09:11:00 +0800 (CST)",
            "from localhost (10.177.246.209) by DGGEMS404-HUB.china.huawei.com\n\t(10.3.19.204) with Microsoft SMTP Server id 14.3.301.0;\n\tMon, 11 Sep 2017 09:10:53 +0800"
        ],
        "From": "\"Longpeng(Mike)\" <longpeng2@huawei.com>",
        "To": "<qemu-devel@nongnu.org>, <virtio-dev@lists.oasis-open.org>",
        "Date": "Mon, 11 Sep 2017 09:10:38 +0800",
        "Message-ID": "<1505092240-10864-7-git-send-email-longpeng2@huawei.com>",
        "X-Mailer": "git-send-email 1.8.4.msysgit.0",
        "In-Reply-To": "<1505092240-10864-1-git-send-email-longpeng2@huawei.com>",
        "References": "<1505092240-10864-1-git-send-email-longpeng2@huawei.com>",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain",
        "X-Originating-IP": "[10.177.246.209]",
        "X-CFilter-Loop": "Reflected",
        "X-Mirapoint-Virus-RAPID-Raw": "score=unknown(0),\n\trefid=str=0001.0A0B0205.59B5E2A5.001B, ss=1, re=0.000, recu=0.000,\n\treip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0,\n\tso=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32",
        "X-Mirapoint-Loop-Id": "1cd8c6a770e990a286b0f3307a590b81",
        "X-detected-operating-system": "by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic]\n\t[fuzzy]",
        "X-Received-From": "45.249.212.191",
        "Subject": "[Qemu-devel] [RFC 6/8] cryptodev: extract one util function",
        "X-BeenThere": "qemu-devel@nongnu.org",
        "X-Mailman-Version": "2.1.21",
        "Precedence": "list",
        "List-Id": "<qemu-devel.nongnu.org>",
        "List-Unsubscribe": "<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>",
        "List-Archive": "<http://lists.nongnu.org/archive/html/qemu-devel/>",
        "List-Post": "<mailto:qemu-devel@nongnu.org>",
        "List-Help": "<mailto:qemu-devel-request@nongnu.org?subject=help>",
        "List-Subscribe": "<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>",
        "Cc": "weidong.huang@huawei.com, mst@redhat.com, jasowang@redhat.com,\n\tjohn.griffin@intel.com, Varun.Sethi@freescale.com,\n\tdenglingli@chinamobile.com, arei.gonglei@hotmail.com,\n\tagraf@suse.de, arei.gonglei@huawei.com,\n\t\"Longpeng\\(Mike\\)\" <longpeng2@huawei.com>,\n\tvincent.jardin@6wind.com, Ola.Liljedahl@arm.com,\n\tluonengjun@huawei.com, xin.zeng@intel.com, liang.j.ma@intel.com,\n\tstefanha@redhat.com, Jani.Kokkonen@huawei.com,\n\tpasic@linux.vnet.ibm.com, brian.a.keating@intel.com,\n\twangxinxin.wang@huawei.com, cohuck@redhat.com, mike.caraman@nxp.com",
        "Errors-To": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org",
        "Sender": "\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"
    },
    "content": "From: Gonglei <arei.gonglei@huawei.com>\n\nSo that the new function can be used by both seesion creation\nand the following stateless crypto operation.\n\nSigned-off-by: Gonglei <arei.gonglei@huawei.com>\nSigned-off-by: Longpeng(Mike) <longpeng2@huawei.com>\n---\n backends/cryptodev-builtin.c | 100 +++++++++++++++++++++++++------------------\n 1 file changed, 58 insertions(+), 42 deletions(-)",
    "diff": "diff --git a/backends/cryptodev-builtin.c b/backends/cryptodev-builtin.c\nindex 6e10feb..ab3d88d 100755\n--- a/backends/cryptodev-builtin.c\n+++ b/backends/cryptodev-builtin.c\n@@ -152,73 +152,56 @@ err:\n    return -1;\n }\n \n-static int cryptodev_builtin_create_cipher_session(\n-                    CryptoDevBackendBuiltin *builtin,\n+static int\n+cryptodev_builtin_get_cipher_alg_mode(\n                     CryptoDevBackendSymSessionInfo *sess_info,\n+                    int *algo, int *mode,\n                     Error **errp)\n {\n-    int algo;\n-    int mode;\n-    QCryptoCipher *cipher;\n-    int index;\n-    CryptoDevBackendBuiltinSession *sess;\n-\n-    if (sess_info->op_type != VIRTIO_CRYPTO_SYM_OP_CIPHER) {\n-        error_setg(errp, \"Unsupported optype :%u\", sess_info->op_type);\n-        return -1;\n-    }\n-\n-    index = cryptodev_builtin_get_unused_session_index(builtin);\n-    if (index < 0) {\n-        error_setg(errp, \"Total number of sessions created exceeds %u\",\n-                  MAX_NUM_SESSIONS);\n-        return -1;\n-    }\n-\n     switch (sess_info->cipher_alg) {\n     case VIRTIO_CRYPTO_CIPHER_AES_ECB:\n-        mode = QCRYPTO_CIPHER_MODE_ECB;\n-        algo = cryptodev_builtin_get_aes_algo(sess_info->key_len,\n-                                                    mode, errp);\n-        if (algo < 0)  {\n+        *mode = QCRYPTO_CIPHER_MODE_ECB;\n+        *algo = cryptodev_builtin_get_aes_algo(sess_info->key_len,\n+                                               *mode, errp);\n+        if (*algo < 0)  {\n             return -1;\n         }\n         break;\n     case VIRTIO_CRYPTO_CIPHER_AES_CBC:\n-        mode = QCRYPTO_CIPHER_MODE_CBC;\n-        algo = cryptodev_builtin_get_aes_algo(sess_info->key_len,\n-                                                    mode, errp);\n-        if (algo < 0)  {\n+        *mode = QCRYPTO_CIPHER_MODE_CBC;\n+        *algo = cryptodev_builtin_get_aes_algo(sess_info->key_len,\n+                                               *mode, errp);\n+        if (*algo < 0)  {\n             return -1;\n         }\n         break;\n     case VIRTIO_CRYPTO_CIPHER_AES_CTR:\n-        mode = QCRYPTO_CIPHER_MODE_CTR;\n-        algo = cryptodev_builtin_get_aes_algo(sess_info->key_len,\n-                                                    mode, errp);\n-        if (algo < 0)  {\n+        *mode = QCRYPTO_CIPHER_MODE_CTR;\n+        *algo = cryptodev_builtin_get_aes_algo(sess_info->key_len,\n+                                              *mode, errp);\n+        if (*algo < 0)  {\n             return -1;\n         }\n         break;\n     case VIRTIO_CRYPTO_CIPHER_AES_XTS:\n-        mode = QCRYPTO_CIPHER_MODE_XTS;\n-        algo = cryptodev_builtin_get_aes_algo(sess_info->key_len,\n-                                                    mode, errp);\n-        if (algo < 0)  {\n+        *mode = QCRYPTO_CIPHER_MODE_XTS;\n+        *algo = cryptodev_builtin_get_aes_algo(sess_info->key_len,\n+                                               *mode, errp);\n+        if (*algo < 0)  {\n             return -1;\n         }\n         break;\n     case VIRTIO_CRYPTO_CIPHER_3DES_ECB:\n-        mode = QCRYPTO_CIPHER_MODE_ECB;\n-        algo = QCRYPTO_CIPHER_ALG_3DES;\n+        *mode = QCRYPTO_CIPHER_MODE_ECB;\n+        *algo = QCRYPTO_CIPHER_ALG_3DES;\n         break;\n     case VIRTIO_CRYPTO_CIPHER_3DES_CBC:\n-        mode = QCRYPTO_CIPHER_MODE_CBC;\n-        algo = QCRYPTO_CIPHER_ALG_3DES;\n+        *mode = QCRYPTO_CIPHER_MODE_CBC;\n+        *algo = QCRYPTO_CIPHER_ALG_3DES;\n         break;\n     case VIRTIO_CRYPTO_CIPHER_3DES_CTR:\n-        mode = QCRYPTO_CIPHER_MODE_CTR;\n-        algo = QCRYPTO_CIPHER_ALG_3DES;\n+        *mode = QCRYPTO_CIPHER_MODE_CTR;\n+        *algo = QCRYPTO_CIPHER_ALG_3DES;\n         break;\n     default:\n         error_setg(errp, \"Unsupported cipher alg :%u\",\n@@ -226,6 +209,39 @@ static int cryptodev_builtin_create_cipher_session(\n         return -1;\n     }\n \n+    return 0;\n+}\n+\n+static int cryptodev_builtin_create_cipher_session(\n+                    CryptoDevBackendBuiltin *builtin,\n+                    CryptoDevBackendSymSessionInfo *sess_info,\n+                    Error **errp)\n+{\n+    int algo;\n+    int mode;\n+    QCryptoCipher *cipher;\n+    int index;\n+    CryptoDevBackendBuiltinSession *sess;\n+    int ret;\n+\n+    if (sess_info->op_type != VIRTIO_CRYPTO_SYM_OP_CIPHER) {\n+        error_setg(errp, \"Unsupported optype :%u\", sess_info->op_type);\n+        return -1;\n+    }\n+\n+    index = cryptodev_builtin_get_unused_session_index(builtin);\n+    if (index < 0) {\n+        error_setg(errp, \"Total number of sessions created exceeds %u\",\n+                  MAX_NUM_SESSIONS);\n+        return -1;\n+    }\n+\n+    ret = cryptodev_builtin_get_cipher_alg_mode(sess_info,\n+                                                &algo, &mode, errp);\n+    if (ret < 0) {\n+        return -1;\n+    }\n+\n     cipher = qcrypto_cipher_new(algo, mode,\n                                sess_info->cipher_key,\n                                sess_info->key_len,\n",
    "prefixes": [
        "RFC",
        "6/8"
    ]
}