From patchwork Thu Jun 1 09:03:38 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Eremin-Solenikov X-Patchwork-Id: 100859 Delivered-To: patch@linaro.org Received: by 10.140.96.100 with SMTP id j91csp711322qge; Thu, 1 Jun 2017 02:20:38 -0700 (PDT) X-Received: by 10.200.56.88 with SMTP id r24mr484529qtb.174.1496308838305; Thu, 01 Jun 2017 02:20:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1496308838; cv=none; d=google.com; s=arc-20160816; b=Pz9ImSwvFRtCzNjxMgy9DQlKjxcpwh4CoDViiW9YQQ4Hx0HbUq3wfeF+qBeBb+EKqZ OIUk/kZ0lD7BfaZsB/xk7LWV7/ieTrWlvT+eThEyyu4XFn8LgzqnFlaCV0CIWkwVd99c r3jebQVflwRFepZBdZXZg8iDQI9GVTSpi+IcGxD7lBYTuA5ZTb6bgHKDr2XFGgEsPr5T X9TpTLifHcba3j4JN1fYmHEhxtDcP6xTU3HOCkxWzGhHxR9wvvWwRMMT4KhzGF/O4exM EA5a9TJuSiFoMHipoUmABDojH9vNSiM1iSPogl024Zof1nYhk6WKH2Xnqs32PI9lky+K CaqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:to:from:delivered-to:arc-authentication-results; bh=H2QrPLfQ5fgTgi3Ru9hS6kN7G0oILFoXPT8eG1lID/M=; b=UYpFnyBI5Fpg+Gja5+4zy9Ns0EGTBIIxyehK2U5vsw7kIt1RLCtXpk2e1KLJmhJYgB BxTVmFLga1jqhjymASqMih1cr56CxF5c6mp7FGSeviHyD3/BJ1laGWpAzkvgAsQpT7pL SjkDhMAuqOt4UYQYN2BdHIyxw++WVfHrpuptKOLoYrual+J6+p6XT9BlGiNSsvTHsgbH GdO6liN7ceXfUZJO/vwLwkZjB6cIq6oa50gmVXsGeymnnSMeqwR1PsQWCH2lk0NF8UwV YAyEAVleDkhnYmkDTlL35gOiMRHTDcmsD0fOa0/773tTTFLM7y+8MP1sliDEuW2j88jr h8Qw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id r40si19421127qtr.217.2017.06.01.02.20.38; Thu, 01 Jun 2017 02:20:38 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id D8F4E6084E; Thu, 1 Jun 2017 09:20:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, RCVD_IN_SORBS_SPAM, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 47DB560E48; Thu, 1 Jun 2017 09:07:09 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id C612060E48; Thu, 1 Jun 2017 09:07:00 +0000 (UTC) Received: from mail-lf0-f52.google.com (mail-lf0-f52.google.com [209.85.215.52]) by lists.linaro.org (Postfix) with ESMTPS id CB8F460B5E for ; Thu, 1 Jun 2017 09:04:07 +0000 (UTC) Received: by mail-lf0-f52.google.com with SMTP id h4so22656120lfj.3 for ; Thu, 01 Jun 2017 02:04:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=H2QrPLfQ5fgTgi3Ru9hS6kN7G0oILFoXPT8eG1lID/M=; b=eQ3HOjKpKG9nCRGmYdXBRZvxUmi4wZOo1854wvCp79rx7oH2YLQE5yzHs8ORbCE7E8 B5MZk2/8FZ80VPdcI8yErQI+YRYAM0baAVPZ8XgJLteeJ7lLsCVwbwicm7X6AbRJ96Ag 6o2HR1f9C4QhGTLTCI6u/NR8y9DwMLvKQ7OMcvAJ0ZM5NUvsMI7Vbfl0sW+a/hc1dFJN N1MKWHeXvK607mpMlYDZJYGu9td/1/DlhwpeRQ9ZZf9sLAwnJ6FgMnouQhCXCZZEx+1e /DqTOkCdFlpaFMrKQQOSNI9py4fVuO7LhWuWYvekM7wK+hKZcOXyybN2Mjy97YYyAa/3 pMHA== X-Gm-Message-State: AODbwcCHD6HE3WFbcV3D3dvZylGx1wLT4FYFumRXgAKCipI8oprv7L1z ErKB8tVv+g39UNcrhN7MDHLd X-Received: by 10.25.24.198 with SMTP id 67mr201323lfy.106.1496307846427; Thu, 01 Jun 2017 02:04:06 -0700 (PDT) Received: from forlindon.lumag.auriga.ru ([188.162.64.12]) by smtp.gmail.com with ESMTPSA id 129sm4232819ljf.36.2017.06.01.02.04.05 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 01 Jun 2017 02:04:05 -0700 (PDT) From: Dmitry Eremin-Solenikov To: lng-odp@lists.linaro.org Date: Thu, 1 Jun 2017 12:03:38 +0300 Message-Id: <20170601090339.9313-23-dmitry.ereminsolenikov@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170601090339.9313-1-dmitry.ereminsolenikov@linaro.org> References: <20170601090339.9313-1-dmitry.ereminsolenikov@linaro.org> Subject: [lng-odp] [PATCH API-NEXT v5 22/23] linux-generic: crypto: add SHA-1 authentication support X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" Signed-off-by: Dmitry Eremin-Solenikov --- platform/linux-generic/odp_crypto.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) -- 2.11.0 diff --git a/platform/linux-generic/odp_crypto.c b/platform/linux-generic/odp_crypto.c index 9e5a11900d66..3117f65d5601 100644 --- a/platform/linux-generic/odp_crypto.c +++ b/platform/linux-generic/odp_crypto.c @@ -61,6 +61,10 @@ static const odp_crypto_auth_capability_t auth_capa_md5_hmac[] = { {.digest_len = 12, .key_len = 16, .aad_len = {.min = 0, .max = 0, .inc = 0} }, {.digest_len = 16, .key_len = 16, .aad_len = {.min = 0, .max = 0, .inc = 0} } }; +static const odp_crypto_auth_capability_t auth_capa_sha1_hmac[] = { +{.digest_len = 12, .key_len = 20, .aad_len = {.min = 0, .max = 0, .inc = 0} }, +{.digest_len = 20, .key_len = 20, .aad_len = {.min = 0, .max = 0, .inc = 0} } }; + static const odp_crypto_auth_capability_t auth_capa_sha256_hmac[] = { {.digest_len = 16, .key_len = 32, .aad_len = {.min = 0, .max = 0, .inc = 0} }, {.digest_len = 32, .key_len = 32, .aad_len = {.min = 0, .max = 0, .inc = 0} } }; @@ -549,7 +553,7 @@ int odp_crypto_capability(odp_crypto_capability_t *capa) capa->auths.bit.null = 1; capa->auths.bit.md5_hmac = 1; - capa->auths.bit.sha1_hmac = 0; + capa->auths.bit.sha1_hmac = 1; capa->auths.bit.sha256_hmac = 1; capa->auths.bit.sha512_hmac = 0; capa->auths.bit.aes_gcm = 1; @@ -624,6 +628,10 @@ int odp_crypto_auth_capability(odp_auth_alg_t auth, src = auth_capa_md5_hmac; num = sizeof(auth_capa_md5_hmac) / size; break; + case ODP_AUTH_ALG_SHA1_HMAC: + src = auth_capa_sha1_hmac; + num = sizeof(auth_capa_sha1_hmac) / size; + break; case ODP_AUTH_ALG_SHA256_HMAC: src = auth_capa_sha256_hmac; num = sizeof(auth_capa_sha256_hmac) / size; @@ -741,6 +749,9 @@ odp_crypto_session_create(odp_crypto_session_param_t *param, case ODP_AUTH_ALG_MD5_HMAC: rc = process_auth_param(session, 16, EVP_md5()); break; + case ODP_AUTH_ALG_SHA1_HMAC: + rc = process_auth_param(session, 20, EVP_sha1()); + break; #if ODP_DEPRECATED_API case ODP_AUTH_ALG_SHA256_128: /* Fixed digest tag length with deprecated algo */