From patchwork Fri Jan 11 09:04:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Babic X-Patchwork-Id: 1023459 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=googlegroups.com (client-ip=2a00:1450:4864:20::43f; helo=mail-wr1-x43f.google.com; envelope-from=swupdate+bncbcxploxj6ikrbh5y4hqqkgqe3znej4y@googlegroups.com; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=googlegroups.com header.i=@googlegroups.com header.b="VbQijj8b"; dkim-atps=neutral Received: from mail-wr1-x43f.google.com (mail-wr1-x43f.google.com [IPv6:2a00:1450:4864:20::43f]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43bcPZ6H1xz9sCX for ; Fri, 11 Jan 2019 20:04:34 +1100 (AEDT) Received: by mail-wr1-x43f.google.com with SMTP id v24sf4200149wrd.23 for ; Fri, 11 Jan 2019 01:04:34 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1547197471; cv=pass; d=google.com; s=arc-20160816; b=a7AEm1CvRvtHplhls8+/w6lxMUxjg/8SwgS/B1pv2/vA+wMOjG5+Gq3+ibIHV7uETv xTGRcH04vJhKSqAMxqfCWs3hbhjvwpPCLWoo+g/7quahJKKCvHre1pWf1GminUenFKuf ZNSuptQ052LU+nxEm7IvYQXTVdsMUB7ux3TUyMSJMTAyOCKubQ8QD8ZhLU9LnW1gz2oa 9CbIepRKyNnMU7udDDxuqv2mv3O6CcJ4uHedbQNblwWzyG/lR3lY5SVAVPADuX6p8kUx fXIJqNUyNT6IXse1/vXvK9IsvN6/6X5gYL3kGHZrdb1bf/Ma0n+1N4+JR+vqJMcflF55 724w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:message-id:date:subject:cc:to:from :mime-version:sender:dkim-signature; bh=1yPFC+p56rDgipCBU2VGVnyU4IHSxfhG/N/LLT7RgtE=; b=Cqyf/o9/kIm25VXtdo1gegT+xlrYV0SWwxBzsKoACAQnbE+qQL/zFlzp54ilXDczlc 319u2yXabT+ce5ytyyKCQCI9i5Hegjty5QXtx66GPCkM1D7YISMDj0mBSJmT6R9kSQGI 1Uigwcqd8Ht8Sc0UJ1fMRmYcDaMWoM1OaT2fAhYwR8vvoNX4flE2apj8NzWKxH1MGKNX vmRpp/vvb0Yq821OOoNmJj2I2WmVcD8mLl9b5nNuXPZAILQQABswZQxcFVZ8bxk8tQOf FDIX1J3hhGNXlZqTytFkL+azw/97ekzjyb90fTWX42WvKjDdeA7GHitzH41RiVN/4HCN Hvxw== ARC-Authentication-Results: i=2; gmr-mx.google.com; spf=neutral (google.com: 212.18.0.10 is neither permitted nor denied by best guess record for domain of sbabic@denx.de) smtp.mailfrom=sbabic@denx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20161025; h=sender:mime-version:from:to:cc:subject:date:message-id :x-original-sender:x-original-authentication-results:precedence :mailing-list:list-id:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=1yPFC+p56rDgipCBU2VGVnyU4IHSxfhG/N/LLT7RgtE=; b=VbQijj8bjtpQ9OBWmvkhgJgWLk9orrSn5E7vW3ckouxXUjYInAuquoKeWt5yLWBt+8 JnKt+Slg3o25TWT0OY60xpBQVWTNNz4iqXKWORPAUUnVfB1ilJz+JC0pKXk1qqCUV3aA Z1CsuIJ/Behz1Qq3JF6guqr5GZLJUqfQpeNFA1vp2xQg2OZaeiMuSpsC4quy2SyTWjkp /DcCVdacRUh20cpGwMxy+ltRav/6DWsj8kdojxyvzPf7A2AgSwRmeXNEfMcrW2w94tGW TmdfVplwIhtCVb2+gyuH4gNx28O2inDUDQTWazCitU5m4PbFms/uml2100zebWWzSEq+ vj6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=sender:x-gm-message-state:mime-version:from:to:cc:subject:date :message-id:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:x-spam-checked-in-group:list-post :list-help:list-archive:list-subscribe:list-unsubscribe; bh=1yPFC+p56rDgipCBU2VGVnyU4IHSxfhG/N/LLT7RgtE=; b=Eiqrhq79kZQstMdmgSPcRbrHop6ZzvJ98zaD06exD7vS1roB8AJ4IJnrOmVC1aUlfa R42N+o1uo3vsw/XpmXMInrQ1kfexBZpiiH4XKXIjUV5lbhdIDlpm3qbZMryl772xhcYF 0R5nNkge6QczeILCmvlmkwy5IgGApTgifYG7D1Z4s/LgXi3DmnE736PutBcDhI9S9mfO HZs6ku+M2Q/o/EW60hgJWeOY81eXDdXA8Bblw4bDT/0emhO6AXPaeutf3HxGZN3alO6c k29jtVLkU6nBbXdzx/JgA509js4M1wX/P+qTd2RNl+ymQv1Y9tu7BL3B7iomzlVg91W6 MDig== Sender: swupdate@googlegroups.com X-Gm-Message-State: AJcUukd27IH7y4m++3QdjG+71EXO8h7w1I2rifKYMyM64NSHMdaY8S+C qBPNw0248aKxjfVc+obb8bA= X-Google-Smtp-Source: ALg8bN6QYe9VyqK8kFTL7rFFGc5u3BUzBoWFVPdPpVEqUo6AwrqBQ29pB7n+ZmxaAXrdQMKFWr4PjA== X-Received: by 2002:a5d:5307:: with SMTP id e7mr99228wrv.4.1547197471843; Fri, 11 Jan 2019 01:04:31 -0800 (PST) MIME-Version: 1.0 X-BeenThere: swupdate@googlegroups.com Received: by 2002:a1c:e919:: with SMTP id q25ls341526wmc.6.gmail; Fri, 11 Jan 2019 01:04:31 -0800 (PST) X-Received: by 2002:a1c:860f:: with SMTP id i15mr136451wmd.24.1547197471320; Fri, 11 Jan 2019 01:04:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547197471; cv=none; d=google.com; s=arc-20160816; b=A2ljLE7Pl5jstORGYuu0jUsLGlA59PQIeaWfMKRExlgoOSwVuiEbUavhq6iYJpA2Xy dmwZTcpuPMpcxyY0SVRJgC9tvjfpqT3eeHZmDvQEpJIbucrFSXEFPykt7Fhe0Y0WP9ao iunvNwUp5EdZ47WhgePU1s+nKh3iFahGQZoBtEfKZ+r4fXPir2HPSoUij2qP0ctIbo98 DUrdJujBlXdnLZG1zhkFIRrd1pPDASG7oI6nLr5jJOehBx0RvvAvPX0HgJ1DOr4jiM5X ay1TRTiQ/u27l6UHnE0rIbxALcM0uP5Pm3mfQgR6upr1GQOZh0YSEotqBGrZSdAo6X0r HBkQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:subject:cc:to:from; bh=2O7HKoeRJHAve856ePTBaAmGHfKK+gLOR9lY3d+D6Hg=; b=JWHahitkLa8TLGHJkcHQtDOdEN5ht2jQ0xyUMB2hjnuU7SfElhK4JE4uxgCoRGF0LD lQ7x82Qmq+QQk0hTe5juyOOSuH7G6EHokcMNJ6Pc8XETbEJUdc8MM3S8uBranhf+iR8k OdOkkuuqvp9GXBC1wH1SZzYwgeIWZIyJYNHLfG3rEOPW8JnyrDhArPxOt7FW1pN2JWfV 6hU02qGJwA6+0ZfxK6XwnrOjuO1cTISnUlraHzPAqvYhq1cLzM3xJpjCydQaO2YrCW16 n3gPnFyJm6wrR20RqlU3KrCpESuHgAZkAXJ/E3Kn+HXZi36iT19xnwnyKf7xp+TC+tNp Zd+A== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=neutral (google.com: 212.18.0.10 is neither permitted nor denied by best guess record for domain of sbabic@denx.de) smtp.mailfrom=sbabic@denx.de Received: from mail-out.m-online.net (mail-out.m-online.net. [212.18.0.10]) by gmr-mx.google.com with ESMTPS id 20si242227wmy.2.2019.01.11.01.04.31 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 11 Jan 2019 01:04:31 -0800 (PST) Received-SPF: neutral (google.com: 212.18.0.10 is neither permitted nor denied by best guess record for domain of sbabic@denx.de) client-ip=212.18.0.10; Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 43bcPW0l11z1rGvc; Fri, 11 Jan 2019 10:04:31 +0100 (CET) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 43bcPW0T8fz1qvX8; Fri, 11 Jan 2019 10:04:31 +0100 (CET) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024) with ESMTP id 1d7kHh-9Mogm; Fri, 11 Jan 2019 10:04:29 +0100 (CET) Received: from babic.homelinux.org (host-88-217-136-221.customer.m-online.net [88.217.136.221]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPS; Fri, 11 Jan 2019 10:04:29 +0100 (CET) Received: from localhost (mail.babic.homelinux.org [127.0.0.1]) by babic.homelinux.org (Postfix) with ESMTP id 1EC6F4540407; Fri, 11 Jan 2019 10:04:29 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at babic.homelinux.org Received: from babic.homelinux.org ([IPv6:::1]) by localhost (mail.babic.homelinux.org [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id mrykNWDU293f; Fri, 11 Jan 2019 10:04:22 +0100 (CET) Received: from papero.fritz.box (papero.fritz.box [192.168.178.132]) by babic.homelinux.org (Postfix) with ESMTP id B9DA2454026F; Fri, 11 Jan 2019 10:04:22 +0100 (CET) From: Stefano Babic To: swupdate@googlegroups.com Cc: Stefano Babic Subject: [swupdate] [PATCH] Drop not required inclusion of openSSL Date: Fri, 11 Jan 2019 10:04:21 +0100 Message-Id: <20190111090421.25334-1-sbabic@denx.de> X-Mailer: git-send-email 2.17.1 X-Original-Sender: sbabic@denx.de X-Original-Authentication-Results: gmr-mx.google.com; spf=neutral (google.com: 212.18.0.10 is neither permitted nor denied by best guess record for domain of sbabic@denx.de) smtp.mailfrom=sbabic@denx.de Precedence: list Mailing-list: list swupdate@googlegroups.com; contact swupdate+owners@googlegroups.com List-ID: X-Spam-Checked-In-Group: swupdate@googlegroups.com X-Google-Group-Id: 605343134186 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , Just a few files require to include headers from openSSL. Because openSSL requires a License Exception, the license for these file must be adjusted to take care that openSSL code is used. Patch tries to limit the number of files requiring this. Signed-off-by: Stefano Babic --- corelib/channel_curl.c | 6 +++--- handlers/ubivol_handler.c | 1 - include/channel_curl.h | 3 +-- include/sslapi.h | 7 ------- include/util.h | 3 +++ suricatta/server_hawkbit.c | 2 +- suricatta/test/test_server_hawkbit.c | 2 +- 7 files changed, 9 insertions(+), 15 deletions(-) diff --git a/corelib/channel_curl.c b/corelib/channel_curl.c index 05fe5fe..fea6c05 100644 --- a/corelib/channel_curl.c +++ b/corelib/channel_curl.c @@ -847,7 +847,7 @@ channel_op_res_t channel_get_file(channel_t *this, void *data) channel_data_t *channel_data = (channel_data_t *)data; if (channel_data->usessl) { - memset(channel_data->sha1hash, 0x0, SHA_DIGEST_LENGTH * 2 + 1); + memset(channel_data->sha1hash, 0x0, SWUPDATE_SHA_DIGEST_LENGTH * 2 + 1); channel_data->dgst = swupdate_HASH_init("sha1"); if (!channel_data->dgst) { result = CHANNEL_EINIT; @@ -1000,7 +1000,7 @@ channel_op_res_t channel_get_file(channel_t *this, void *data) } if (channel_data->usessl) { - unsigned char sha1hash[SHA_DIGEST_LENGTH]; + unsigned char sha1hash[SWUPDATE_SHA_DIGEST_LENGTH]; unsigned int md_len; (void)md_len; if (swupdate_HASH_final(channel_data->dgst, sha1hash, &md_len) != 1) { @@ -1009,7 +1009,7 @@ channel_op_res_t channel_get_file(channel_t *this, void *data) } char sha1hexchar[3]; - for (int i = 0; i < SHA_DIGEST_LENGTH; i++) { + for (int i = 0; i < SWUPDATE_SHA_DIGEST_LENGTH; i++) { sprintf(sha1hexchar, "%02x", sha1hash[i]); strcat(channel_data->sha1hash, sha1hexchar); } diff --git a/handlers/ubivol_handler.c b/handlers/ubivol_handler.c index 8b204dd..805e610 100644 --- a/handlers/ubivol_handler.c +++ b/handlers/ubivol_handler.c @@ -19,7 +19,6 @@ #include "handler.h" #include "flash.h" #include "util.h" -#include "sslapi.h" void ubi_handler(void); diff --git a/include/channel_curl.h b/include/channel_curl.h index 0ea3423..0e499c6 100644 --- a/include/channel_curl.h +++ b/include/channel_curl.h @@ -11,7 +11,6 @@ #endif #include #include -#include "sslapi.h" #include "swupdate_status.h" /* Curl Channel Implementation Private Header File. @@ -63,7 +62,7 @@ typedef struct { bool nofollow; int (*checkdwl)(void); struct swupdate_digest *dgst; - char sha1hash[SHA_DIGEST_LENGTH * 2 + 1]; + char sha1hash[SWUPDATE_SHA_DIGEST_LENGTH * 2 + 1]; sourcetype source; struct dict *headers; } channel_data_t; diff --git a/include/sslapi.h b/include/sslapi.h index 7bdb2b2..6f03ece 100644 --- a/include/sslapi.h +++ b/include/sslapi.h @@ -141,13 +141,6 @@ void swupdate_DECRYPT_cleanup(struct swupdate_digest *dgst); #define swupdate_DECRYPT_cleanup(p) #endif -/* - * if openSSL is not selected - */ -#ifndef SHA_DIGEST_LENGTH -#define SHA_DIGEST_LENGTH 20 -#endif - #ifndef SSL_PURPOSE_DEFAULT #define SSL_PURPOSE_EMAIL_PROT -1 #define SSL_PURPOSE_CODE_SIGN -1 diff --git a/include/util.h b/include/util.h index 4675d89..445e9f2 100644 --- a/include/util.h +++ b/include/util.h @@ -20,6 +20,9 @@ #define NOTIFY_BUF_SIZE 2048 #define ENOMEM_ASPRINTF -1 +#define SWUPDATE_SHA_DIGEST_LENGTH 20 +#define AES_BLOCK_SIZE 16 + extern int loglevel; typedef enum { diff --git a/suricatta/server_hawkbit.c b/suricatta/server_hawkbit.c index 34dc5ac..d02ab61 100644 --- a/suricatta/server_hawkbit.c +++ b/suricatta/server_hawkbit.c @@ -1046,7 +1046,7 @@ server_op_res_t server_process_update_artifact(int action_id, #ifdef CONFIG_SURICATTA_SSL if (strncmp((char *)&channel_data.sha1hash, json_object_get_string(json_data_artifact_sha1hash), - SHA_DIGEST_LENGTH) != 0) { + SWUPDATE_SHA_DIGEST_LENGTH) != 0) { ERROR( "Checksum does not match: Should be '%s', but " "actually is '%s'.\n", diff --git a/suricatta/test/test_server_hawkbit.c b/suricatta/test/test_server_hawkbit.c index fcb81ac..cc98f78 100644 --- a/suricatta/test/test_server_hawkbit.c +++ b/suricatta/test/test_server_hawkbit.c @@ -93,7 +93,7 @@ channel_op_res_t __wrap_channel_get_file(channel_t *this, void *data, int file_h #ifdef CONFIG_SURICATTA_SSL channel_data_t *channel_data = (channel_data_t *)data; strncpy(channel_data->sha1hash, mock_type(char *), - SHA_DIGEST_LENGTH * 2 + 1); + SWUPDATE_SHA_DIGEST_LENGTH * 2 + 1); #else (void)data; #endif