요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.
1. 요약·해설
원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.
Intel Firmware Hub RNG
hw_random.rst:50-104thermal noise 기반 하드웨어, e820와 MMIO 예약, `request_mem_region` 제거 이유 및 참고 문서를 기록합니다.
2. 영어 원문 전체
번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.
원문 전체 펼치기
=================================
Hardware random number generators
=================================
Introduction
============
The hw_random framework is software that makes use of a
special hardware feature on your CPU or motherboard,
a Random Number Generator (RNG). The software has two parts:
a core providing the /dev/hwrng character device and its
sysfs support, plus a hardware-specific driver that plugs
into that core.
To make the most effective use of these mechanisms, you
should download the support software as well. Download the
latest version of the "rng-tools" package from:
https://github.com/nhorman/rng-tools
Those tools use /dev/hwrng to fill the kernel entropy pool,
which is used internally and exported by the /dev/urandom and
/dev/random special files.
Theory of operation
===================
CHARACTER DEVICE. Using the standard open()
and read() system calls, you can read random data from
the hardware RNG device. This data is NOT CHECKED by any
fitness tests, and could potentially be bogus (if the
hardware is faulty or has been tampered with). Data is only
output if the hardware "has-data" flag is set, but nevertheless
a security-conscious person would run fitness tests on the
data before assuming it is truly random.
The rng-tools package uses such tests in "rngd", and lets you
run them by hand with a "rngtest" utility.
/dev/hwrng is char device major 10, minor 183.
CLASS DEVICE. There is a /sys/class/misc/hw_random node with
two unique attributes, "rng_available" and "rng_current". The
"rng_available" attribute lists the hardware-specific drivers
available, while "rng_current" lists the one which is currently
connected to /dev/hwrng. If your system has more than one
RNG available, you may change the one used by writing a name from
the list in "rng_available" into "rng_current".
==========================================================================
Hardware driver for Intel/AMD/VIA Random Number Generators (RNG)
- Copyright 2000,2001 Jeff Garzik <[email protected]>
- Copyright 2000,2001 Philipp Rumpf <[email protected]>
About the Intel RNG hardware, from the firmware hub datasheet
=============================================================
The Firmware Hub integrates a Random Number Generator (RNG)
using thermal noise generated from inherently random quantum
mechanical properties of silicon. When not generating new random
bits the RNG circuitry will enter a low power state. Intel will
provide a binary software driver to give third party software
access to our RNG for use as a security feature. At this time,
the RNG is only to be used with a system in an OS-present state.
Intel RNG Driver notes
======================
FIXME: support poll(2)
.. note::
request_mem_region was removed, for three reasons:
1) Only one RNG is supported by this driver;
2) The location used by the RNG is a fixed location in
MMIO-addressable memory;
3) users with properly working BIOS e820 handling will always
have the region in which the RNG is located reserved, so
request_mem_region calls always fail for proper setups.
However, for people who use mem=XX, BIOS e820 information is
**not** in /proc/iomem, and request_mem_region(RNG_ADDR) can
succeed.
Driver details
==============
Based on:
Intel 82802AB/82802AC Firmware Hub (FWH) Datasheet
May 1999 Order Number: 290658-002 R
Intel 82802 Firmware Hub:
Random Number Generator
Programmer's Reference Manual
December 1999 Order Number: 298029-001 R
Intel 82802 Firmware HUB Random Number Generator Driver
Copyright (c) 2000 Matt Sottek <[email protected]>
Special thanks to Matt Sottek. I did the "guts", he
did the "brains" and all the testing.
3. 한국어 전문 번역
영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.
하드웨어 난수 생성기 소개
1-24`hw_random` framework는 CPU 또는 motherboard의 특수 하드웨어 기능인 Random Number Generator(RNG)를 사용합니다. 소프트웨어는 `/dev/hwrng` character device와 sysfs 지원을 제공하는 core, 그리고 core에 연결되는 하드웨어 전용 드라이버로 구성됩니다.
이 메커니즘을 효과적으로 사용하려면 최신 `rng-tools` package를 `https://github.com/nhorman/rng-tools`에서 내려받는 것이 좋습니다.
이 도구들은 `/dev/hwrng`를 사용해 커널 entropy pool을 채웁니다. 이 pool은 커널 내부에서 사용되고 `/dev/urandom`과 `/dev/random` special file을 통해 공개됩니다.
동작 원리와 장치 선택
25-49표준 `open()`과 `read()` 시스템 호출로 하드웨어 RNG character device에서 난수 데이터를 읽습니다. 이 데이터에는 fitness test가 전혀 적용되지 않으므로 하드웨어가 고장 났거나 변조되면 잘못된 값일 수 있습니다. 하드웨어의 `has-data` flag가 설정됐을 때만 출력되지만 보안을 중시한다면 진짜 난수라고 가정하기 전에 fitness test를 수행해야 합니다.
`rng-tools` package의 `rngd`는 이런 test를 사용하며 `rngtest` utility로 직접 실행할 수도 있습니다.
`/dev/hwrng`는 character device major 10, minor 183입니다.
| sysfs attribute | 설명 |
|---|---|
| /sys/class/misc/hw_random/rng_available | 사용 가능한 하드웨어 전용 RNG driver 목록입니다. |
| /sys/class/misc/hw_random/rng_current | 현재 `/dev/hwrng`에 연결된 driver를 보여 줍니다. RNG가 여러 개면 `rng_available`의 이름 하나를 여기에 써서 선택을 바꿀 수 있습니다. |
Intel/AMD/VIA RNG 드라이버와 Intel 하드웨어
50-68Intel/AMD/VIA RNG 하드웨어 드라이버 절입니다. 원문은 Jeff Garzik과 Philipp Rumpf의 2000~2001년 저작권을 기록합니다.
Firmware Hub는 silicon의 본질적으로 무작위인 양자역학적 특성에서 생기는 thermal noise를 사용하는 RNG를 통합합니다. 새 random bit를 만들지 않을 때 RNG 회로는 저전력 상태로 들어갑니다.
Intel은 보안 기능으로 RNG를 제3자 소프트웨어가 사용할 수 있게 binary software driver를 제공한다고 설명합니다. 원문 작성 시점의 RNG는 OS가 실행 중인 상태의 시스템에서만 사용하도록 되어 있습니다.
Intel RNG 드라이버 주의사항
69-87`poll(2)` 지원은 원문에서 FIXME로 남아 있습니다.
`request_mem_region` 호출은 다음 세 이유로 제거되었습니다.
- 이 드라이버는 RNG 하나만 지원합니다.
- RNG가 사용하는 위치는 MMIO로 접근 가능한 메모리의 고정 위치입니다.
- BIOS e820 처리가 올바른 시스템은 RNG가 있는 영역을 항상 reserved로 표시하므로 정상 구성에서 `request_mem_region` 호출은 늘 실패합니다.
`mem=XX`를 사용하는 경우 BIOS e820 정보가 `/proc/iomem`에 없으므로 `request_mem_region(RNG_ADDR)`가 성공할 수 있습니다.
드라이버 참고 문서와 기여
88-104| 자료 | 세부 정보 |
|---|---|
| Intel 82802AB/82802AC Firmware Hub (FWH) Datasheet | May 1999, Order Number 290658-002 R |
| Intel 82802 Firmware Hub Random Number Generator Programmer's Reference Manual | December 1999, Order Number 298029-001 R |
| Intel 82802 Firmware HUB Random Number Generator Driver | Copyright (c) 2000 Matt Sottek <[email protected]> |
원문 저자는 Matt Sottek에게 특별히 감사하며, 자신은 드라이버의 핵심 구현을 맡고 Matt는 설계 아이디어와 모든 시험을 맡았다고 적었습니다.
하드웨어 RNG interface
hw_random.rst:1-49`/dev/hwrng`, rng-tools와 entropy pool의 관계, fitness test 필요성과 sysfs driver 선택을 설명합니다.