From patchwork Sat Dec 20 16:52:06 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rickard Strandqvist X-Patchwork-Id: 5522981 Return-Path: X-Original-To: patchwork-ceph-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 3BC989F1CD for ; Sat, 20 Dec 2014 16:49:41 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 575EC20158 for ; Sat, 20 Dec 2014 16:49:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6DF0D2010E for ; Sat, 20 Dec 2014 16:49:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753027AbaLTQtV (ORCPT ); Sat, 20 Dec 2014 11:49:21 -0500 Received: from mail-wg0-f49.google.com ([74.125.82.49]:34538 "EHLO mail-wg0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753295AbaLTQtU (ORCPT ); Sat, 20 Dec 2014 11:49:20 -0500 Received: by mail-wg0-f49.google.com with SMTP id n12so3648173wgh.22 for ; Sat, 20 Dec 2014 08:49:19 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=vG2f4zRnTbegdQfUc0C1ACqc6VBhgg6rJK6qfBx/JSA=; b=L08+f0kPmGou9V5xIA7pvIqD0SSv94/k/dCVptuO7RZPHUcgLQcNQnPGLjQkB9sous YMbUH4XlIcNCjviqDTr4P0KeTCMx/mFPzz5xG2xFQH7EbCce+S0W0WSdD+r0lMfydP4V Eun5aIq+U/FMKwvGhewLowvFHWrA5WpqsIBgkaIhxBZHgZ04U3cX8xFU6xjd8huqJTq0 eTiJBtVSyF3vMi6p147sj6YvBoYL6c/01VKmNr/qTmu+Ca262HLLFYf2YsYovPvIUJ1W cId/AxQB18D49ny5bMi31avx5lyOiNODK/ZUh9fqmT0MEHQQuK8zqo7l93fnmz2+g3IG czSg== X-Gm-Message-State: ALoCoQktqHMP1rVJncCQ/fou3GQ9b7yc7ZmOlrtIuMVHfMnlqZyss6pkBMMwwOsPVNfw5ojp0bas X-Received: by 10.180.97.196 with SMTP id ec4mr15728672wib.71.1419094159034; Sat, 20 Dec 2014 08:49:19 -0800 (PST) Received: from localhost.localdomain (h-246-111.a218.priv.bahnhof.se. [85.24.246.111]) by mx.google.com with ESMTPSA id gl11sm16864036wjc.40.2014.12.20.08.49.18 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 20 Dec 2014 08:49:18 -0800 (PST) From: Rickard Strandqvist To: Sage Weil , "David S. Miller" Cc: Rickard Strandqvist , ceph-devel@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] net: ceph: crypto.c: Remove some unused functions Date: Sat, 20 Dec 2014 17:52:06 +0100 Message-Id: <1419094326-9218-1-git-send-email-rickard_strandqvist@spectrumdigital.se> X-Mailer: git-send-email 1.7.10.4 Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Removes some functions that are not used anywhere: ceph_encrypt() ceph_decrypt() ceph_crypto_key_encode() This was partially found by using a static code analysis program called cppcheck. Signed-off-by: Rickard Strandqvist --- net/ceph/crypto.c | 52 ---------------------------------------------------- net/ceph/crypto.h | 7 ------- 2 files changed, 59 deletions(-) diff --git a/net/ceph/crypto.c b/net/ceph/crypto.c index 62fc5e7..5a82890 100644 --- a/net/ceph/crypto.c +++ b/net/ceph/crypto.c @@ -22,18 +22,6 @@ int ceph_crypto_key_clone(struct ceph_crypto_key *dst, return 0; } -int ceph_crypto_key_encode(struct ceph_crypto_key *key, void **p, void *end) -{ - if (*p + sizeof(u16) + sizeof(key->created) + - sizeof(u16) + key->len > end) - return -ERANGE; - ceph_encode_16(p, key->type); - ceph_encode_copy(p, &key->created, sizeof(key->created)); - ceph_encode_16(p, key->len); - ceph_encode_copy(p, key->key, key->len); - return 0; -} - int ceph_crypto_key_decode(struct ceph_crypto_key *key, void **p, void *end) { ceph_decode_need(p, end, 2*sizeof(u16) + sizeof(key->created), bad); @@ -329,26 +317,6 @@ static int ceph_aes_decrypt2(const void *key, int key_len, } -int ceph_decrypt(struct ceph_crypto_key *secret, void *dst, size_t *dst_len, - const void *src, size_t src_len) -{ - switch (secret->type) { - case CEPH_CRYPTO_NONE: - if (*dst_len < src_len) - return -ERANGE; - memcpy(dst, src, src_len); - *dst_len = src_len; - return 0; - - case CEPH_CRYPTO_AES: - return ceph_aes_decrypt(secret->key, secret->len, dst, - dst_len, src, src_len); - - default: - return -EINVAL; - } -} - int ceph_decrypt2(struct ceph_crypto_key *secret, void *dst1, size_t *dst1_len, void *dst2, size_t *dst2_len, @@ -382,26 +350,6 @@ int ceph_decrypt2(struct ceph_crypto_key *secret, } } -int ceph_encrypt(struct ceph_crypto_key *secret, void *dst, size_t *dst_len, - const void *src, size_t src_len) -{ - switch (secret->type) { - case CEPH_CRYPTO_NONE: - if (*dst_len < src_len) - return -ERANGE; - memcpy(dst, src, src_len); - *dst_len = src_len; - return 0; - - case CEPH_CRYPTO_AES: - return ceph_aes_encrypt(secret->key, secret->len, dst, - dst_len, src, src_len); - - default: - return -EINVAL; - } -} - int ceph_encrypt2(struct ceph_crypto_key *secret, void *dst, size_t *dst_len, const void *src1, size_t src1_len, const void *src2, size_t src2_len) diff --git a/net/ceph/crypto.h b/net/ceph/crypto.h index d149822..36082d5 100644 --- a/net/ceph/crypto.h +++ b/net/ceph/crypto.h @@ -22,17 +22,10 @@ static inline void ceph_crypto_key_destroy(struct ceph_crypto_key *key) int ceph_crypto_key_clone(struct ceph_crypto_key *dst, const struct ceph_crypto_key *src); -int ceph_crypto_key_encode(struct ceph_crypto_key *key, void **p, void *end); int ceph_crypto_key_decode(struct ceph_crypto_key *key, void **p, void *end); int ceph_crypto_key_unarmor(struct ceph_crypto_key *key, const char *in); /* crypto.c */ -int ceph_decrypt(struct ceph_crypto_key *secret, - void *dst, size_t *dst_len, - const void *src, size_t src_len); -int ceph_encrypt(struct ceph_crypto_key *secret, - void *dst, size_t *dst_len, - const void *src, size_t src_len); int ceph_decrypt2(struct ceph_crypto_key *secret, void *dst1, size_t *dst1_len, void *dst2, size_t *dst2_len,