From owner-svn-src-projects@FreeBSD.ORG Sun Apr 27 18:57:57 2014 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 0489031E; Sun, 27 Apr 2014 18:57:57 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E559515AF; Sun, 27 Apr 2014 18:57:56 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s3RIvuQR089788; Sun, 27 Apr 2014 18:57:56 GMT (envelope-from markm@svn.freebsd.org) Received: (from markm@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s3RIvuP4089787; Sun, 27 Apr 2014 18:57:56 GMT (envelope-from markm@svn.freebsd.org) Message-Id: <201404271857.s3RIvuP4089787@svn.freebsd.org> From: Mark Murray Date: Sun, 27 Apr 2014 18:57:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r265021 - projects/random_number_generator/sys/dev/random X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Apr 2014 18:57:57 -0000 Author: markm Date: Sun Apr 27 18:57:56 2014 New Revision: 265021 URL: http://svnweb.freebsd.org/changeset/base/265021 Log: Reorder to get 'n' set correctly. Modified: projects/random_number_generator/sys/dev/random/live_entropy_sources.c Modified: projects/random_number_generator/sys/dev/random/live_entropy_sources.c ============================================================================== --- projects/random_number_generator/sys/dev/random/live_entropy_sources.c Sun Apr 27 18:12:55 2014 (r265020) +++ projects/random_number_generator/sys/dev/random/live_entropy_sources.c Sun Apr 27 18:57:56 2014 (r265021) @@ -150,17 +150,17 @@ live_entropy_sources_feed(void) LIST_FOREACH(lles, &les_sources, lles_entries) { for (i = 0; i < harvest_pool_count*read_rate; i++) { + /* This *must* be quick, since it's a live entropy source. */ + n = lles->lles_rsource->les_read(event.he_entropy, HARVESTSIZE); + KASSERT((n > 0 && n <= HARVESTSIZE), ("very bad return from les_read (= %d) in %s", n, __func__)); + memset(event.he_entropy + n, 0, HARVESTSIZE - n); + event.he_somecounter = get_cyclecount(); event.he_size = n; event.he_bits = (n*8)/2; event.he_source = lles->lles_rsource->les_source; event.he_destination = harvest_destination[event.he_source]++; - /* This *must* be quick, since it's a live entropy source. */ - n = lles->lles_rsource->les_read(event.he_entropy, HARVESTSIZE); - KASSERT((n > 0 && n <= HARVESTSIZE), ("very bad return from les_read (= %d) in %s", n, __func__)); - memset(event.he_entropy + n, 0, HARVESTSIZE - n); - /* Do the actual entropy insertion */ harvest_process_event(&event); }