From patchwork Mon May 27 21:29:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Petr_=C5=A0tetiar?= X-Patchwork-Id: 1105969 X-Patchwork-Delegate: ynezz@true.cz 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=lists.openwrt.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=true.cz Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="jcYKs86e"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45CVWY00wkz9s7h for ; Tue, 28 May 2019 07:30:32 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Subject:MIME-Version:References: In-Reply-To:Message-Id:Date:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=FDchkV9fGK1XnJWTR3moV1F4Hky1zXi9LcPL48+gcAI=; b=jcYKs86eP5gIJ2 ukW0fakUGF6m/k/MCNY3l3sl9e4hbL/S/lolNykNatzisOqS4yCh8yzBLdCt0+jKn6gBgZipQW4o9 agMl2IEkXhecKKLZ0ygrrw0vquvihy4n4h6Pg7Sr3c9rHRvJ+mKGNJXCI9tWzfxihdSaAgFoa3TFL /Bf4DOGJvV4S03Q2TPGqMN0HVlbuVYC3I6TK3kVCrf1HiFS86kuZmT45Lqk1QA1Aqo4Tqqwgmsd8n xv3Vknc0OBTaWFIzo3ZVplC7DDUw2SlUPisZbHO97cTdBwWC1QSP/fxCYdmBpOOPhboT6TXqCeMNH GHAIf5Na2a4NHx5uRqBg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hVNCJ-0007rQ-Vy; Mon, 27 May 2019 21:30:24 +0000 Received: from smtp-out.xnet.cz ([178.217.244.18]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hVNBv-0006BM-FT for openwrt-devel@lists.openwrt.org; Mon, 27 May 2019 21:30:02 +0000 Received: from meh.true.cz (meh.true.cz [108.61.167.218]) (Authenticated sender: petr@true.cz) by smtp-out.xnet.cz (Postfix) with ESMTPSA id A5A1A4FA7; Mon, 27 May 2019 23:29:56 +0200 (CEST) Received: by meh.true.cz (OpenSMTPD) with ESMTP id 9161dbbc; Mon, 27 May 2019 23:29:55 +0200 (CEST) From: =?utf-8?q?Petr_=C5=A0tetiar?= To: openwrt-devel@lists.openwrt.org Date: Mon, 27 May 2019 23:29:41 +0200 Message-Id: <1558992584-11997-2-git-send-email-ynezz@true.cz> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1558992584-11997-1-git-send-email-ynezz@true.cz> References: <1558992584-11997-1-git-send-email-ynezz@true.cz> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190527_142959_824345_E47CFE6B X-CRM114-Status: UNSURE ( 9.16 ) X-CRM114-Notice: Please train this message. X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [178.217.244.18 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record Subject: [OpenWrt-Devel] [PATCH 1/4] urng: add micro non-physical true RNG based on timing jitter X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Stephan_M=C3=BCller?= , =?utf-8?q?Petr_=C5=A0tetiar?= Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org μrngd is OpenWrt's micro non-physical true random number generator based on timing jitter. Using the Jitter RNG core, the rngd provides an entropy source that feeds into the Linux /dev/random device if its entropy runs low. It updates the /dev/random entropy estimator such that the newly provided entropy unblocks /dev/random. The seeding of /dev/random also ensures that /dev/urandom benefits from entropy. Especially during boot time, when the entropy of Linux is low, the Jitter RNGd provides a source of sufficient entropy. Signed-off-by: Petr Štetiar --- package/system/urngd/Makefile | 48 +++++++++++++++++++++++++++++++++++ package/system/urngd/files/urngd.init | 21 +++++++++++++++ 2 files changed, 69 insertions(+) create mode 100644 package/system/urngd/Makefile create mode 100644 package/system/urngd/files/urngd.init diff --git a/package/system/urngd/Makefile b/package/system/urngd/Makefile new file mode 100644 index 000000000000..e57a5d60f748 --- /dev/null +++ b/package/system/urngd/Makefile @@ -0,0 +1,48 @@ +include $(TOPDIR)/rules.mk + +PKG_NAME:=urngd +PKG_RELEASE:=1 + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL=https://github.com/ynezz/openwrt-urngd +PKG_SOURCE_DATE:=2019-05-27 +PKG_SOURCE_VERSION:=41e4163b2e7f4c1c1f51cdfa487d6052ff859cf2 +PKG_MIRROR_HASH:=839b1b23163bc907625ed6c6122faec9404cb72d8587ece796a9cec1422b6077 + +PKG_LICENSE:=GPL-2.0 BSD-3-Clause +PKG_LICENSE_FILES:= + +PKG_BUILD_PARALLEL:=1 + +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/cmake.mk + +define Package/$(PKG_NAME) + SECTION:=utils + CATEGORY:=Base system + TITLE:=OpenWrt non-physical true random number generator based on timing jitter + DEPENDS:=+libubox +endef + +define Package/$(PKG_NAME)/description + urngd is OpenWrt's micro non-physical true random number generator based on + timing jitter. + + Using the Jitter RNG core, the rngd provides an entropy source that feeds into + the Linux /dev/random device if its entropy runs low. It updates the + /dev/random entropy estimator such that the newly provided entropy unblocks + /dev/random. + + The seeding of /dev/random also ensures that /dev/urandom benefits from + entropy. Especially during boot time, when the entropy of Linux is low, the + Jitter RNGd provides a source of sufficient entropy. +endef + +define Package/$(PKG_NAME)/install + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/$(PKG_NAME).init $(1)/etc/init.d/$(PKG_NAME) + $(INSTALL_DIR) $(1)/sbin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/$(PKG_NAME) $(1)/sbin/$(PKG_NAME) +endef + +$(eval $(call BuildPackage,$(PKG_NAME))) diff --git a/package/system/urngd/files/urngd.init b/package/system/urngd/files/urngd.init new file mode 100644 index 000000000000..ab1d5cf9d46a --- /dev/null +++ b/package/system/urngd/files/urngd.init @@ -0,0 +1,21 @@ +#!/bin/sh /etc/rc.common + +START=00 + +USE_PROCD=1 +NAME=urngd +PROG=/sbin/urngd + +start_service() { + procd_open_instance + procd_set_param command "$PROG" + procd_close_instance +} + +stop() { + service_stop $PROG +} + +reload() { + service_reload $PROG +}