STM32F7 19 True random number generator (RNG)

Started by tha, December 16, 2022, 08:26:33 AM

Previous topic - Next topic

tha

19 True random number generator (RNG)

19.1 Introduction

The RNG คือ a true random number generator ที่จัดให้มี 32-bit entropy samples อย่างต่อเนื่อง, มีรากฐานบน an analog noise source. มันสามารถถูกใช้โดย the application เป็น a live entropy source เพื่อสร้างd a NIST compliant Deterministic Random Bit Generator (DRBG).

The RNG true random number generator ถูกตรวจสอบความถูกต้องแล้วตาม the German AIS-31 standard.

tha

19.2 RNG main features

•   The RNG ส่งมอบ 32-bit true random numbers, ที่ผลิตโดย an analog entropy source ที่ประมวลผลภายหลังด้วย linear-
     feedback shift registers (LFSR).
•   มันถูกตรวจสอบความถูกต้องตาม the AIS-31 pre-defined class PTG.2 evaluation methodology, ซึ่งเป็นส่วนหนึ่งของ the
     German Common Criteria (CC) scheme.
•   มันผลิต one 32-bit random samples ทุกๆ 42 RNG clock cycles (clock ที่อุทิศให้).
•   มันอนุญาตให้ embedded continuous basic health tests ที่มี associated error management
     –   รวม too low sampling clock detection และ repetition count tests.
•   มันสามารถถูกปิดใช้งานเพื่อลด power consumption.
•   มันมี an AMBA AHB slave peripheral, สามารถเข้าถึงได้ผ่านทาง 32-bit word single accesses เท่านั้น (นอกเหนือจากนั้น an
     AHB bus error จะถูกสร้าง). คำเตือน! การเขียนใด ๆ ที่ไม่เท่ากับ 32 bits อาจทำให้ the register content เสียหาย.

tha

19.3 RNG functional description

19.3.1 RNG block diagram

Figure 116 แสดง the RNG block diagram.



tha

19.3.2 RNG internal signals

Table 121 อธิบายรายการของประโยชน์น่ารู้ internal signals มีให้ใช้งานที่ the RNG level, ไม่ใช่ที่ the STM32 product level (on pads).


tha

19.3.3 Random number generation

The true random number generator (RNG) ส่งมอบ random data อย่างแท้จริงผ่านทาง AHB interface ของมันในช่วงเวลาที่กำหนด. The RNG จัดให้มีใช้ the entropy source model ตามภาพใน Figure 117, และจัดให้มีฟังก์ชันหลักสามประการสำหรับแอปพลิเคชัน:
•   รวบรวม the bitstring output ของ the entropy source box
•   รับตัวอย่างของ the noise source เพื่อวัตถุประสงค์ในการตรวจสอบความถูกต้อง
•   รวบรวม error messages จาก continuous health tests



ส่วนประกอบหลักของ the RNG คือ:
•   แหล่งที่มาของ physical randomness (analog noise source)
•   ขั้นตอนการแปลงเป็นดิจิทัลสำหรับ analog noise source นี้
•   ขั้นตอนการส่งมอบ post-processed noise source (raw data)
•   An output buffer สำหรับ the raw data. ถ้า cryptographic conditioning เพิ่มเติมถูกต้องการโดย the application มันจะ
     จำเป็นต้องถูกดำเนินการโดย software.
•   เอาต์พุตเสริมสำหรับ the digitized noise source (ไม่มีบัฟเฟอร์, บน digital pads)
•   Basic health tests บน the digitized noise source

tha

ส่วนประกอบทั้งหมดถูกให้รายละเอียดด้านล่าง

Noise source

The noise source เป็นองค์ประกอบที่บรรจุ the non-deterministic, entropy-providing activity ที่ในที่สุดรับผิดชอบต่อความไม่แน่นอนที่เกี่ยวข้องกับ the bitstring output โดย the entropy source. มันถูกประกอบด้วย:
•   Two analog noise sources, แต่ละมีรากฐานบน three XOR free-running ring oscillator outputs. มันสามารถเป็นได้ที่จะ
     ปิดใช้งาน analog oscillators เหล่านั้นเพื่อประหยัดพลังงาน, ดังอธิบายใน Section 19.4: RNG low-power usage.
•   ขั้นตอนการสุ่มตัวอย่างของเอาต์พุตเหล่านี้ถูกให้สัญญานนาฬิกาโดย a dedicated clock input (rng_clk), ส่งมอบ a 2-bit raw data
     output.

noise source sampling นี้เป็นอิสระจาก the AHB interface clock frequency (rng_hclk).

Note: ใน Section 19.7: Entropy source validation recommended(ที่แนะนำ) RNG clock frequencies ถูกให้ไว้.

tha

Post processing

The sample values ที่ได้รับจาก a true random noise source ประกอบด้วย 2-bit bitstrings. เนื่องจาก noise source output นี้ถูกไบอัส, the RNG จัดให้มีใช้ a post-processing component ที่ลดการไบอัสนั้นให้อยู่ในระดับที่ยอมรับได้.

The RNG post-processing ประกอบด้วยสองขั้นตอน ซึ่งนำไปใช้กับแต่ละ noise source bits:
•   The RNG เอาครึ่งหนึ่งของ the bits จาก the sampled noise source, และครึ่งหนึ่งของ the bits จาก inverted sampled noise
     source. ดังนั้น, ถ้า the source สร้าง '1' มากกว่า '0' (หรือตรงกันข้าม), มันจะถูกกรอง
•   A linear feedback shift register (LFSR) ดำเนินการ a whitening process, ผลิต 8-bit strings.

ส่วนประกอบนี้ถูกให้สัญญานนาฬิกาโดย the RNG clock.

The times ที่ต้องการระหว่าง two random number generations, และระหว่าง the RNG initialization และ availability of first sample ถูกอธิบายใน Section 19.6: RNG processing time.

tha

Output buffer

The RNG_DR data output register สามารถจัดเก็บมากถึง two 16-bit words ซึ่งถูกส่งออกมาจาก the post-processing component (LFSR). เพื่ออ่านกลับ 32-bit random samples ต้องรอ 42 RNG clock cycles.

เมื่อใดก็ตามที่ a random number มีให้ใช้งานผ่านทางh the RNG_DR register the DRDY flag เปลี่ยนผ่านจาก "0" ไปเป็น "1". แฟล็คนี้ยังคง high จนกว่า output buffer กลายมาเป็นว่างเปล่าหลังจากการอ่าน one word จาก the RNG_DR register.

Note:  เมื่อ interrupts ถูกเปิดใช้งาน an interrupt จะถูกสร้างเมื่อ data ready flag นี้เปลี่ยนผ่านจาก "0" ไปเป็น "1". Interrupt จาก
           นั้นจะถูกเคลียร์โดยอัตโนมัติโดย the RNG ดังที่อธิบายข้างบน.