From patchwork Mon Dec 12 20:48:48 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Dryomov X-Patchwork-Id: 9471321 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 5239A607D6 for ; Mon, 12 Dec 2016 20:50:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 48CAB28518 for ; Mon, 12 Dec 2016 20:50:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3DE0F2851B; Mon, 12 Dec 2016 20:50:35 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CEAC228519 for ; Mon, 12 Dec 2016 20:50:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932493AbcLLUuJ (ORCPT ); Mon, 12 Dec 2016 15:50:09 -0500 Received: from mail-wj0-f196.google.com ([209.85.210.196]:35000 "EHLO mail-wj0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752704AbcLLUuG (ORCPT ); Mon, 12 Dec 2016 15:50:06 -0500 Received: by mail-wj0-f196.google.com with SMTP id he10so13559794wjc.2 for ; Mon, 12 Dec 2016 12:50:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:message-id:in-reply-to:references; bh=2c0iL3QmvZa3wD3FPulInyse2HbB13oeiXaM58vnsiE=; b=YZ4VaHwuqLFW7XgEC3ATm79V6W18CRK9GpjGRure9pn0xpQV/GN04U8Z0pS/gGDjT6 R63/zOibU4HUDkCD2meHxwBX29JJsgEyDh/Pqk+A7J22rhCXeNGG14tc4QuW7vvFiNkw GmvAEJbNm8hL4TQVXHiwGZFNGQRZ28gtuwUAN2jXlAWdNgikibI4aoCnRYbS2F1JGC31 obPI/8fWSZRMu+EQsCFGTfRaf/gmWv6UcCv/T88szVu7SQfDX6K3yfJRoCwX2mf8TWmW tBEAIY1GtEX02DTj5hW4N0302rUTO+lw1U35P4LnpzSgxkv0X5wQ1EZstk+W1ztG7cj9 MPbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=2c0iL3QmvZa3wD3FPulInyse2HbB13oeiXaM58vnsiE=; b=CLVUuQBEB8CtSrkBvlLoUMYf5NSsIY+jjYtVJw+O1YAbSS1JGMJINIUQGueZ7mhN9z d1kroro4jYuIqPtPZaUjJeeKf+26+SQm2bw35X2qzMDHXqihs0e0FwOOcVR8PdkfiPYq 8xlLazBVNc2UTOW4hmdUBOeNoEKkWN0sZ42Zn/oVIELrdvrDaCrQER3b7Q4y8EktofC3 jcF5DrQY6kIKX0s1HuRxl5BmNezp5ssrqKkMKW37bo0d6fH44KMSlpp74au89PcSZNZo lP2liz8QoighM87YZavY4qE3oDO7T8lNv2aCEVFWdfB/zUFMcOllZSElUBr4VZAN4Cvl 9L6A== X-Gm-Message-State: AKaTC00MhcV82rdvfuxW1lhDLSgJs50ViyNjVgA/4H0xlHSWRGmTEl8rqhPHqYOuXblFnA== X-Received: by 10.194.85.107 with SMTP id g11mr82509707wjz.82.1481575804947; Mon, 12 Dec 2016 12:50:04 -0800 (PST) Received: from dhcp-1-105.brq.redhat.com ([213.175.37.12]) by smtp.gmail.com with ESMTPSA id 135sm37201887wmh.14.2016.12.12.12.50.04 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 12 Dec 2016 12:50:04 -0800 (PST) From: Ilya Dryomov To: ceph-devel@vger.kernel.org Subject: [PATCH 03/15] libceph: introduce ceph_x_encrypt_offset() Date: Mon, 12 Dec 2016 21:48:48 +0100 Message-Id: <1481575740-1834-4-git-send-email-idryomov@gmail.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1481575740-1834-1-git-send-email-idryomov@gmail.com> References: <1481575740-1834-1-git-send-email-idryomov@gmail.com> Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Ilya Dryomov --- net/ceph/auth_x.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/net/ceph/auth_x.c b/net/ceph/auth_x.c index 28bde937d58a..de30c585c2a2 100644 --- a/net/ceph/auth_x.c +++ b/net/ceph/auth_x.c @@ -39,10 +39,14 @@ static int ceph_x_should_authenticate(struct ceph_auth_client *ac) return need != 0; } +static int ceph_x_encrypt_offset(void) +{ + return sizeof(u32) + sizeof(struct ceph_x_encrypt_header); +} + static int ceph_x_encrypt_buflen(int ilen) { - return sizeof(struct ceph_x_encrypt_header) + ilen + 16 + - sizeof(u32); + return ceph_x_encrypt_offset() + ilen + 16; } static int ceph_x_encrypt(struct ceph_crypto_key *secret,