diff --git a/doc/crypto-rng-ring.dox b/doc/crypto-rng-ring.dox new file mode 100644 index 00000000..d5625dc2 --- /dev/null +++ b/doc/crypto-rng-ring.dox @@ -0,0 +1,187 @@ +/* + * Copyright (C) 2015 Southern Storm Software, Pty Ltd. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +/** +\file crypto-rng-ring.dox +\page crypto_rng_ring Ring Oscillator Noise Sources + +This page discusses how to construct and use a noise source based on the +jitter from a ring oscillator. The circuit here is very simple: more +complex ring oscillator designs are possible and may give better results. + +\note The output from a ring oscillator is not generally as good as a +"true" noise source. The oscillation can easily settle into regular +patterns or sync up with other clock sources on the board. It is even +possible to "hack" a ring oscillator by injecting chosen frequencies +on the power supply rails to force the oscillation into a predictable +waveform (see this paper for an example). +It is very important that the output of this class be whitened with +\link RNGClass RNG\endlink before it is used for cryptography and that +the device is isolated from attacker-controlled sources of power. +Unless you have a very good reason to use a ring oscillator, +TransistorNoiseSource is usually a better option. + +\section ring_osc_theory Ring oscillator theory + +A ring oscillator is formed out of an odd number of inverter gates. +A 1 value on the input to the first gate will be inverted several times, +resulting in a 0 value being fed back into the first gate. In turn that +0 is inverted several times to generate another 1. And so on. +In schematic form, a 3-stage ring oscillator looks like this: + +\image html ring_oscillator_basic.png + +Because electronic circuits are not instanteous devices it can take some +time for the values to propagate down the inverter chain. The longer the +chain (5-stage, 7-stage, 9-stage, or more) the longer the propagation delay. +The important thing is that the delay is not fixed: differences in +components, ambient temperature, and other factors combine to introduce a +little bit of random jitter in the output waveform. + +For our purposes, the jitter is what we are after. The timing differences +from one rising edge to the the next gives us the random bits. + +The triangular-shaped output from the final inverter isn't very friendly to +microprocessors. So it is common to select out the jitter using a +D flip-flop and a periodic clock signal: + +\image html ring_oscillator_sampled.png + +Practical designs inside CPU's often use multiple ring oscillators XOR'ed +together: + +\image html ring_oscillator_multi.png + +Even after all that the output won't be uniformly random. It is necessary +to whiten the output with a secure hash function before using the data +for cryptography. Fortunately for us, \link RNGClass::stir() RNG.stir()\endlink +has built-in support for whitening so we just need to collect the raw bits. + +\section ring_osc_ours Our ring oscillator + +To keep things simple, we are going to use a single 5-stage ring oscillator +with a sampling clock provided by a 555 timer: + +\image html ring_oscillator.png + +The components were deliberately chosen to be commonly available. The only +special one is the 555. I recommend using the CMOS LM7555 variant (or +something equivalent) instead because it can operate at higher frequencies +than a garden variety 555. The 56 ohm resistor on the output of U2 inhibits +ringing on the clock line: we want the noise to come from U1 not U2. + +The frequency output from U1 will depend upon the properties of your 4069 +chip. A cheap bargain bin chip is actually better than a high quality chip. +Some inverter datasheets I have read proudly advertise reduced jitter +but the jitter is what we are after here. My 4069 was generating about +1.7MHz with a 5-stage ring oscillator. Other chips I tried were able +to exceed 12MHz with a 3-stage ring oscillator. Because the Arduino isn't +fast enough to sample high frequency signals, lower is actually better +for our needs. + +To further lower the frequency to something the Arduino can measure, +the 555 timer should be set to between 100kHz and 200kHz (it's ok to be +a little over 200kHz). Start with an R1 value of about 2.2K and adjust +it up or down to get the frequency into the target range. Also measure +the output frequency from U3A and try to target between 20kHz and 50kHz. +The Arduino can easily sample that without putting too much burden +on the CPU. The signal should be very jittery at this point. + +This design can of course be improved by using multiple ring oscillators +and an XOR gate, but I wanted to keep the component count low for the +basic design. + +\section ring_osc_parts Parts list + +\li 1 x 4069 CMOS Hex Inverter +\li 1 x 4013 Dual D Flip-Flop +\li 1 x LM7555 CMOS Timer +\li 1 x 10uF electrolytic capacitor (25V or better) +\li 1 x 100nF ceramic capacitor +\li 1 x 10nF ceramic capacitor +\li 1 x 1nF ceramic capacitor +\li 1 x 56 ohm resistor +\li 1 x 1.2k ohm resistor +\li 1 x 2.2k ohm resistor (or some other value for R1) + +\section ring_osc_connecting Connecting to the Arduino + +The RingOscillatorNoiseSource class uses the input capture feature of +the AVR microcontroller to measure the time between successive rising +edges. Input capture is only possible on certain pins and the output +of the circuit above needs to be connected to the correct pin: + + + + + + +
VariantArduino Pin / AVR PinTimer
Arduino UnoD8 / PB0Timer 1
Arduino LeonardoD4 / PD4Timer 1
Arduino Mega or Mega 2560D49 / PL0Timer 4
+ +If your board is not pin-compatible with one of the above, then the +source for the RingOscillatorNoiseSource class will need to be modified +to use a different pin/timer combination. Also, when the timer is in +use by this class it cannot be used for other application tasks. + +The timer is set up in free-running mode to count as fast as possible. +Whenever a rising edge occurs on the input signal, the timer's current +value is written to a special register and an interrupt occurs. +Within the interrupt service routine, the previous register value is +subtracted from the current value to determine the amount of time that +has elapsed between the two rising edges. + +The jitter is extracted from the time difference in a very simple way: +the lowest bit of the difference is the jitter and all other bits +are discarded. The interrupt service routine collects up 16 bits of +jitter over successive input pulses and then passes them to the +higher level code in the RingOscillatorNoiseSource class. + +Within the higher level code, the input bits are first debiased using the +Von Neumann method to discard the parts of the signal that don't jitter +very much: + +\li Collect two input bits. +\li If they are the same, then discard both. +\li If they are different, then choose one as the output bit and discard + the other one. + +The debiased bits are collected up into a 256-bit buffer. Once the buffer +is full it is passed to \link RNGClass::stir() RNG.stir()\endlink to be +whitened and incorporated into the global random number pool. + +And that's it! + +As noted earlier, the output from a ring oscillator is not uniform. +To deal with this, the RingOscillatorNoiseSource class takes a fairly +conservative approach. It credits a very small amount of entropy to +each full buffer, forcing the system to collect more input data +to achieve full entropy. + +My investigations showed that at 20kHz it takes about a second to generate +256 bits of good random data after Von Neumann debiasing and whitening. +Two to three seconds after startup there should be enough entropy in the +random number pool to generate encryption keys and other secret material +safely. The \link RNGClass::available() RNG.available()\endlink function +can be used to determine when there is enough entropy in the pool +for the application's needs. + +*/ diff --git a/doc/crypto.dox b/doc/crypto.dox index 8ea74699..1cd2fa74 100644 --- a/doc/crypto.dox +++ b/doc/crypto.dox @@ -31,7 +31,7 @@ \li Stream ciphers: ChaCha \li Hash algorithms: SHA1, SHA256, SHA512, SHA3_256, SHA3_512, BLAKE2s, BLAKE2b \li Public key algorithms: Curve25519 -\li Random number generation: \link RNGClass RNG\endlink, TransistorNoiseSource +\li Random number generation: \link RNGClass RNG\endlink, TransistorNoiseSource, RingOscillatorNoiseSource All cryptographic algorithms have been optimized for 8-bit Arduino platforms like the Uno. Memory usage is also reduced, particularly for SHA1, SHA256, diff --git a/doc/mainpage.dox b/doc/mainpage.dox index da34f98e..87cbf1d7 100644 --- a/doc/mainpage.dox +++ b/doc/mainpage.dox @@ -95,7 +95,7 @@ realtime clock and the LCD library to implement an alarm clock. \li Stream ciphers: ChaCha \li Hash algorithms: SHA1, SHA256, SHA512, SHA3_256, SHA3_512, BLAKE2s, BLAKE2b \li Public key algorithms: Curve25519 -\li Random number generation: \link RNGClass RNG\endlink, TransistorNoiseSource +\li Random number generation: \link RNGClass RNG\endlink, TransistorNoiseSource, RingOscillatorNoiseSource More information can be found on the \ref crypto "Cryptographic Library" page. diff --git a/libraries/Crypto/RingOscillatorNoiseSource.cpp b/libraries/Crypto/RingOscillatorNoiseSource.cpp new file mode 100644 index 00000000..2f986feb --- /dev/null +++ b/libraries/Crypto/RingOscillatorNoiseSource.cpp @@ -0,0 +1,263 @@ +/* + * Copyright (C) 2015 Southern Storm Software, Pty Ltd. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#include "RingOscillatorNoiseSource.h" +#include "Crypto.h" +#include "RNG.h" +#include + +/** + * \class RingOscillatorNoiseSource RingOscillatorNoiseSource.h + * \brief Processes the signal from a ring oscillator based noise source. + * + * This class processes input from a ring oscillator noise source, such as + * that described \ref crypto_rng_ring "here". + * + * \note The output from a ring oscillator is not generally as good as a + * "true" noise source. The oscillation can easily settle into regular + * patterns or sync up with other clock sources on the board. It is even + * possible to "hack" a ring oscillator by injecting chosen frequencies + * on the power supply rails to force the oscillation into a predictable + * waveform (see this paper for an example). + * It is very important that the output of this class be whitened with + * \link RNGClass RNG\endlink before it is used for cryptography and that + * the device is isolated from attacker-controlled sources of power. + * Unless you have a very good reason to use a ring oscillator, + * TransistorNoiseSource is usually a better option. + * + * The noise is read from an input capture pin on the Arduino and stirred + * into the random number pool on a regular basis. The following pins are + * used on different Arduino variants: + * + * + * + * + * + * + *
VariantArduino Pin / AVR PinTimer
Arduino UnoD8 / PB0Timer 1
Arduino LeonardoD4 / PD4Timer 1
Arduino Mega or Mega 2560D49 / PL0Timer 4
+ * + * If your board is not pin-compatible with one of the above, then the + * source for the RingOscillatorNoiseSource class will need to be modified + * to use a different pin/timer combination. Also, when the timer is in + * use by this class it cannot be used for other application tasks. + * + * The example below shows how to initialize a ring oscillator based noise + * source and use it with \link RNGClass RNG\endlink: + * + * \code + * #include + * #include + * #include + * + * // Noise source to seed the random number generator. + * RingOscillatorNoiseSource noise; + * + * void setup() { + * // Initialize the random number generator with the application tag + * // "MyApp 1.0" and load the previous seed from EEPROM address 500. + * RNG.begin("MyApp 1.0", 500); + * + * // ... + * } + * + * void loop() { + * // ... + * + * // If the noise source has accumulated new entropy, then stir it in. + * RNG.stir(noise); + * + * // Perform regular housekeeping on the random number generator. + * RNG.loop(); + * + * // ... + * } + * \endcode + * + * For more information, see the documentation for \link RNGClass RNG\endlink. + * + * \sa \link RNGClass RNG\endlink, NoiseSource, TransistorNoiseSource + */ + +// Choose the input capture timer and pin to use for this board. +#if defined(__AVR_ATmega2560__) || defined(__AVR_ATmega1280__) +// Arduino Mega or Mega 2560 - input capture on TIMER4 and D49/PL0. +#define RING_TIMER 4 +#define RING_PIN 49 +#define RING_CAPT_vect TIMER4_CAPT_vect +#define RING_ICR ICR4 +#elif defined(__AVR_ATmega32U4__) || defined(__AVR_ATmega16U4__) +// Arduino Leonardo - input capture on Timer1 and D4/PD4. +#define RING_TIMER 1 +#define RING_PIN 4 +#define RING_CAPT_vect TIMER1_CAPT_vect +#define RING_ICR ICR1 +#else +// Assuming Arduino Uno or equivalent - input capture on TIMER1 and D8/PB0. +#define RING_TIMER 1 +#define RING_PIN 8 +#define RING_CAPT_vect TIMER1_CAPT_vect +#define RING_ICR ICR1 +#endif + +// Calibration states. +#define NOISE_NOT_CALIBRATING 0 +#define NOISE_CALIBRATING 1 + +// If there is no capture event for this many milliseconds, +// then assume that the oscillator is stopped or disconnected. +#define RING_DISCONNECT_TIME 200 + +RingOscillatorNoiseSource::RingOscillatorNoiseSource() + : calState(NOISE_CALIBRATING) + , lastSignal(millis()) +{ + // Initialize the bit collection routines. + restart(); + + // Set up the capture pin as an input with no pull-ups. + pinMode(RING_PIN, INPUT); + digitalWrite(RING_PIN, LOW); + +#if RING_TIMER == 1 + // Set up TIMER1 to perform input capture on PB8/D8. + TCCR1B = 0; // Turn off TIMER1. + TIMSK1 = 0; // Turn off TIMER1 interrupts. + TCNT1 = 0; // Zero the timer. + TCCR1A = 0; // Turn off output compare. + TCCR1B |= (1 << ICES1); // Input capture on rising edge. + TIMSK1 |= (1 << ICIE1); // Input capture interrupts enabled. + + // Start TIMER1 at the highest frequency with no prescaling. + TCCR1B |= (1 << CS10); +#elif RING_TIMER == 4 + // Set up TIMER4 to perform input capture on PL0/D49. + TCCR4B = 0; // Turn off TIMER4. + TIMSK4 = 0; // Turn off TIMER4 interrupts. + TCNT4 = 0; // Zero the timer. + TCCR4A = 0; // Turn off output compare. + TCCR4B |= (1 << ICES4); // Input capture on rising edge. + TIMSK4 |= (1 << ICIE4); // Input capture interrupts enabled. + + // Start TIMER4 at the highest frequency with no prescaling. + TCCR4B |= (1 << CS10); +#endif +} + +RingOscillatorNoiseSource::~RingOscillatorNoiseSource() +{ + // Turn off the capture timer. +#if RING_TIMER == 1 + TCCR1B = 0; +#elif RING_TIMER == 4 + TCCR4B = 0; +#endif + + // Clean up. + clean(buffer); +} + +bool RingOscillatorNoiseSource::calibrating() const +{ + return calState == NOISE_CALIBRATING; +} + +static uint16_t volatile out = 0; +static uint8_t volatile outBits = 0; + +// Interrupt service routine for the timer's input capture interrupt. +ISR(RING_CAPT_vect) +{ + // We are interested in the jitter; that is the difference in + // time between one rising edge and the next in the signal. + // Extract a single bit from the jitter and add it to the + // rolling "out" buffer for the main code to process later. + // If the buffer overflows, we discard bits and keep going. + static uint16_t prev = 0; + uint16_t next = RING_ICR; + out = (out << 1) | ((next - prev) & 1); + prev = next; + ++outBits; +} + +void RingOscillatorNoiseSource::stir() +{ + // If the "out" buffer is full, then convert the bits. Turn off + // interrupts while we read the "out" buffer and reset "outBits". + unsigned long now = millis(); + cli(); + if (outBits >= 16) { + uint16_t bits = out; + outBits = 0; + sei(); + for (uint8_t index = 0; index < 8; ++index) { + // Collect two bits of input and remove bias using the Von Neumann + // method. If both bits are the same, then discard both. + // Otherwise choose one of the bits and output that one. + // We have to do this carefully so that instruction timing does + // not reveal the value of the bit that is chosen. + if ((bits ^ (bits << 1)) & 0x8000) { + // The bits are different: add the top-most to the buffer. + if (posn < sizeof(buffer)) { + buffer[posn] = (buffer[posn] >> 1) | + (((uint8_t)(bits >> 8)) & (uint8_t)0x80); + if (++bitNum >= 8) { + ++posn; + bitNum = 0; + } + } + } + bits = bits << 2; + } + } else { + // The "out" buffer isn't full yet. Re-enable interrupts. + sei(); + + // If it has been too long since the last useful block, + // then go back to calibrating. The oscillator may be + // stopped or disconnected. + if (calState == NOISE_NOT_CALIBRATING) { + if ((now - lastSignal) >= RING_DISCONNECT_TIME) { + restart(); + calState = NOISE_CALIBRATING; + } + } + } + + // If the buffer is full, then stir it into the random number pool. + // We credit 1 bit of entropy for every 8 bits of output because + // ring oscillators aren't quite as good as a true noise source. + // We have to collect a lot more data to get something random enough. + if (posn >= sizeof(buffer)) { + output(buffer, posn, posn); + restart(); + calState = NOISE_NOT_CALIBRATING; + lastSignal = now; + } +} + +void RingOscillatorNoiseSource::restart() +{ + clean(buffer); + prevBit = 0; + posn = 0; + bitNum = 0; +} diff --git a/libraries/Crypto/RingOscillatorNoiseSource.h b/libraries/Crypto/RingOscillatorNoiseSource.h new file mode 100644 index 00000000..33a6d115 --- /dev/null +++ b/libraries/Crypto/RingOscillatorNoiseSource.h @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2015 Southern Storm Software, Pty Ltd. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +#ifndef CRYPTO_RINGOSCILLATORNOISESOURCE_H +#define CRYPTO_RINGOSCILLATORNOISESOURCE_H + +#include +#include "NoiseSource.h" + +class RingOscillatorNoiseSource : public NoiseSource +{ +public: + RingOscillatorNoiseSource(); + virtual ~RingOscillatorNoiseSource(); + + bool calibrating() const; + + void stir(); + +private: + uint8_t prevBit; + uint8_t posn; + uint8_t bitNum; + uint8_t calState; + uint8_t buffer[32]; + unsigned long lastSignal; + + void restart(); +}; + +#endif diff --git a/libraries/Crypto/TransistorNoiseSource.cpp b/libraries/Crypto/TransistorNoiseSource.cpp index 9ce6c9cf..c8048184 100644 --- a/libraries/Crypto/TransistorNoiseSource.cpp +++ b/libraries/Crypto/TransistorNoiseSource.cpp @@ -72,7 +72,7 @@ * } * \endcode * - * \sa \link RNGClass RNG\endlink, NoiseSource + * \sa \link RNGClass RNG\endlink, NoiseSource, RingOscillatorNoiseSource */ /* diff --git a/libraries/Crypto/examples/TestRNG/TestRNG.ino b/libraries/Crypto/examples/TestRNG/TestRNG.ino index d0df122e..32ab5c2a 100644 --- a/libraries/Crypto/examples/TestRNG/TestRNG.ino +++ b/libraries/Crypto/examples/TestRNG/TestRNG.ino @@ -4,6 +4,7 @@ #include #include #include +#include // Change "MyApp 1.0" to some other tag for your application // so that different applications will generate different results @@ -15,6 +16,7 @@ // Noise source to seed the random number generator. TransistorNoiseSource noise(A1); +//RingOscillatorNoiseSource noise; bool calibrating = false; byte data[32]; diff --git a/libraries/Crypto/examples/TestRingOscillatorNoise/TestRingOscillatorNoise.ino b/libraries/Crypto/examples/TestRingOscillatorNoise/TestRingOscillatorNoise.ino new file mode 100644 index 00000000..056e9fe5 --- /dev/null +++ b/libraries/Crypto/examples/TestRingOscillatorNoise/TestRingOscillatorNoise.ino @@ -0,0 +1,44 @@ + +// This example dumps the raw data from a ring oscillator noise source +// without any of the whitening normally performed by the RNG class. + +#include +#include + +char const hexchars[] = "0123456789ABCDEF"; + +class RawNoiseSource : public RingOscillatorNoiseSource +{ +public: + RawNoiseSource() : RingOscillatorNoiseSource() {} + +protected: + void output(const uint8_t *data, size_t len, unsigned int credit) + { + for (size_t posn = 0; posn < len; ++posn) { + uint8_t value = data[posn]; + Serial.print(hexchars[(value >> 4) & 0x0F]); + Serial.print(hexchars[value & 0x0F]); + } + Serial.println(); + } +}; + +RawNoiseSource noise; +bool calibrating = true; + +void setup() { + Serial.begin(9600); + Serial.println(); + Serial.println("calibrating"); +} + +void loop() { + noise.stir(); + bool nowCalibrating = noise.calibrating(); + if (nowCalibrating != calibrating) { + calibrating = nowCalibrating; + if (calibrating) + Serial.println("calibrating"); + } +} diff --git a/libraries/Crypto/examples/TestNoise/TestNoise.ino b/libraries/Crypto/examples/TestTransistorNoise/TestTransistorNoise.ino similarity index 100% rename from libraries/Crypto/examples/TestNoise/TestNoise.ino rename to libraries/Crypto/examples/TestTransistorNoise/TestTransistorNoise.ino diff --git a/libraries/Crypto/keywords.txt b/libraries/Crypto/keywords.txt index f61b941b..db77a8ac 100644 --- a/libraries/Crypto/keywords.txt +++ b/libraries/Crypto/keywords.txt @@ -17,6 +17,7 @@ CFB KEYWORD1 CTR KEYWORD1 OFB KEYWORD1 +RingOscillatorNoiseSource KEYWORD1 RNG KEYWORD1 TransistorNoiseSource KEYWORD1 diff --git a/libraries/Crypto/ring_oscillator.fig b/libraries/Crypto/ring_oscillator.fig new file mode 100644 index 00000000..20cb6b2d --- /dev/null +++ b/libraries/Crypto/ring_oscillator.fig @@ -0,0 +1,441 @@ +#FIG 3.2 Produced by xfig version 3.2.5c +Landscape +Center +Metric +A4 +100.00 +Single +-2 +1200 2 +6 9135 2025 9315 2295 +2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2 + 9210 2295 9240 2295 +2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2 + 9175 2250 9275 2250 +2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2 + 9135 2205 9315 2205 +2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2 + 9225 2025 9225 2205 +-6 +6 10485 2700 10665 2970 +2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2 + 10560 2970 10590 2970 +2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2 + 10525 2925 10625 2925 +2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2 + 10485 2880 10665 2880 +2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2 + 10575 2700 10575 2880 +-6 +6 8820 1530 8910 1620 +1 3 0 1 0 -1 0 0 20 0.000 1 0.0000 8865 1575 30 30 8865 1575 8865 1605 +-6 +6 9180 1980 9270 2070 +1 3 0 1 0 -1 0 0 20 0.000 1 0.0000 9225 2025 30 30 9225 2025 9225 2055 +-6 +6 7785 1125 8865 1755 +6 7785 1395 8865 1755 +1 3 0 1 0 7 0 0 -1 0.000 1 0.0000 8550 1575 45 45 8550 1575 8550 1620 +2 1 0 1 0 7 0 0 -1 0.000 0 0 -1 0 0 4 + 8145 1395 8145 1755 8505 1575 8145 1395 +2 1 0 1 0 7 0 0 -1 0.000 0 0 -1 0 0 2 + 8145 1575 7785 1575 +2 1 0 1 0 7 0 0 -1 0.000 0 0 -1 0 0 2 + 8595 1575 8865 1575 +4 0 0 0 -1 16 6 0.0000 4 75 120 7875 1530 11\001 +4 0 0 0 -1 16 6 0.0000 4 75 120 8685 1530 10\001 +-6 +4 0 0 50 -1 0 12 0.0000 4 135 360 8190 1260 U1E\001 +-6 +6 6705 1125 7785 1755 +6 6705 1395 7785 1755 +1 3 0 1 0 7 0 0 -1 0.000 1 0.0000 7470 1575 45 45 7470 1575 7470 1620 +2 1 0 1 0 7 0 0 -1 0.000 0 0 -1 0 0 4 + 7065 1395 7065 1755 7425 1575 7065 1395 +2 1 0 1 0 7 0 0 -1 0.000 0 0 -1 0 0 2 + 7065 1575 6705 1575 +2 1 0 1 0 7 0 0 -1 0.000 0 0 -1 0 0 2 + 7515 1575 7785 1575 +4 0 0 0 -1 16 6 0.0000 4 75 120 6795 1530 13\001 +4 0 0 0 -1 16 6 0.0000 4 75 120 7605 1530 12\001 +-6 +4 0 0 50 -1 0 12 0.0000 4 135 345 7110 1260 U1F\001 +-6 +6 3375 630 6705 1980 +6 3465 1395 4545 1755 +1 3 0 1 0 7 0 0 -1 0.000 1 0.0000 4230 1575 45 45 4230 1575 4230 1620 +2 1 0 1 0 7 0 0 -1 0.000 0 0 -1 0 0 4 + 3825 1395 3825 1755 4185 1575 3825 1395 +2 1 0 1 0 7 0 0 -1 0.000 0 0 -1 0 0 2 + 3825 1575 3465 1575 +2 1 0 1 0 7 0 0 -1 0.000 0 0 -1 0 0 2 + 4275 1575 4545 1575 +4 0 0 0 -1 16 6 0.0000 4 75 60 3600 1530 1\001 +4 0 0 0 -1 16 6 0.0000 4 75 60 4365 1530 2\001 +-6 +6 4545 1395 5625 1755 +1 3 0 1 0 7 0 0 -1 0.000 1 0.0000 5310 1575 45 45 5310 1575 5310 1620 +2 1 0 1 0 7 0 0 -1 0.000 0 0 -1 0 0 4 + 4905 1395 4905 1755 5265 1575 4905 1395 +2 1 0 1 0 7 0 0 -1 0.000 0 0 -1 0 0 2 + 4905 1575 4545 1575 +2 1 0 1 0 7 0 0 -1 0.000 0 0 -1 0 0 2 + 5355 1575 5625 1575 +4 0 0 0 -1 16 6 0.0000 4 75 60 4680 1530 3\001 +4 0 0 0 -1 16 6 0.0000 4 75 60 5445 1530 4\001 +-6 +6 5625 1395 6705 1755 +1 3 0 1 0 7 0 0 -1 0.000 1 0.0000 6390 1575 45 45 6390 1575 6390 1620 +2 1 0 1 0 7 0 0 -1 0.000 0 0 -1 0 0 4 + 5985 1395 5985 1755 6345 1575 5985 1395 +2 1 0 1 0 7 0 0 -1 0.000 0 0 -1 0 0 2 + 5985 1575 5625 1575 +2 1 0 1 0 7 0 0 -1 0.000 0 0 -1 0 0 2 + 6435 1575 6705 1575 +4 0 0 0 -1 16 6 0.0000 4 75 60 5760 1530 5\001 +4 0 0 0 -1 16 6 0.0000 4 75 60 6525 1530 6\001 +-6 +6 3870 1710 4050 1980 +2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2 + 3945 1980 3975 1980 +2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2 + 3910 1935 4010 1935 +2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2 + 3870 1890 4050 1890 +2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2 + 3960 1710 3960 1890 +-6 +2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 1 0 2 + 1 1 1.00 60.00 120.00 + 3960 1485 3960 900 +4 0 0 10 -1 16 6 0.0000 4 75 60 4050 1800 7\001 +4 0 0 7 -1 16 6 0.0000 4 75 120 4005 1305 14\001 +4 0 0 50 -1 0 12 0.0000 4 135 240 3870 765 5V\001 +4 0 0 50 -1 0 12 0.0000 4 135 375 3375 1260 U1A\001 +4 0 0 50 -1 0 12 0.0000 4 135 375 4950 1260 U1B\001 +4 0 0 50 -1 0 12 0.0000 4 135 375 6030 1260 U1C\001 +-6 +6 1215 1575 1440 1890 +5 1 0 1 0 -1 0 0 -1 0.000 1 0 0 0 1350.000 1900.000 1260 1780 1350 1750 1440 1780 +2 1 0 1 0 -1 0 0 -1 0.000 0 1 -1 0 0 2 + 1350 1750 1350 1890 +2 1 0 1 0 -1 0 0 -1 0.000 0 1 -1 0 0 2 + 1260 1710 1440 1710 +2 1 0 1 0 -1 0 0 -1 0.000 0 1 -1 0 0 2 + 1350 1710 1350 1575 +2 1 0 1 0 -1 0 0 -1 0.000 0 1 -1 0 0 2 + 1286 1604 1286 1674 +2 1 0 1 0 -1 0 0 -1 0.000 0 1 -1 0 0 2 + 1256 1639 1316 1639 +-6 +6 1935 1575 2115 1890 +2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2 + 2025 1710 2025 1575 +2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2 + 2025 1755 2025 1890 +2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2 + 1935 1710 2115 1710 +2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2 + 1935 1755 2115 1755 +-6 +6 1620 2070 1800 2340 +2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2 + 1695 2340 1725 2340 +2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2 + 1660 2295 1760 2295 +2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2 + 1620 2250 1800 2250 +2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2 + 1710 2070 1710 2250 +-6 +6 1665 2025 1755 2115 +1 3 0 1 0 -1 0 0 20 0.000 1 0.0000 1710 2070 30 30 1710 2070 1710 2100 +-6 +6 1665 1305 1755 1395 +1 3 0 1 0 -1 0 0 20 0.000 1 0.0000 1710 1350 30 30 1710 1350 1710 1380 +-6 +6 3555 3690 3645 4140 +2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2 + 3600 4045 3600 4140 +2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 7 + 3600 3780 3560 3807 3640 3861 3560 3915 3640 3969 3560 4023 + 3600 4050 +2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2 + 3600 3690 3600 3785 +-6 +6 3555 4365 3645 4815 +2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2 + 3600 4720 3600 4815 +2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 7 + 3600 4455 3560 4482 3640 4536 3560 4590 3640 4644 3560 4698 + 3600 4725 +2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2 + 3600 4365 3600 4460 +-6 +6 3510 5175 3690 5490 +2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2 + 3600 5310 3600 5175 +2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2 + 3600 5355 3600 5490 +2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2 + 3510 5310 3690 5310 +2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2 + 3510 5355 3690 5355 +-6 +6 3555 3330 3645 3420 +1 3 0 1 0 -1 0 0 20 0.000 1 0.0000 3600 3375 30 30 3600 3375 3600 3405 +-6 +6 3555 4230 3645 4320 +1 3 0 1 0 -1 0 0 20 0.000 1 0.0000 3600 4275 30 30 3600 4275 3600 4305 +-6 +6 3825 4905 3915 4995 +1 3 0 1 0 -1 0 0 20 0.000 1 0.0000 3870 4950 30 30 3870 4950 3870 4980 +-6 +6 3555 4905 3645 4995 +1 3 0 1 0 -1 0 0 20 0.000 1 0.0000 3600 4950 30 30 3600 4950 3600 4980 +-6 +6 4545 3330 4635 3420 +1 3 0 1 0 -1 0 0 20 0.000 1 0.0000 4590 3375 30 30 4590 3375 4590 3405 +-6 +6 10035 3330 12600 4905 +5 1 0 1 0 7 50 -1 -1 0.000 0 0 0 0 10575.000 4050.000 10530 4050 10575 4005 10620 4050 +6 10485 4635 10665 4905 +2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2 + 10560 4905 10590 4905 +2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2 + 10525 4860 10625 4860 +2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2 + 10485 4815 10665 4815 +2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2 + 10575 4635 10575 4815 +-6 +6 10530 3780 10620 3870 +1 3 0 1 0 -1 0 0 20 0.000 1 0.0000 10575 3825 30 30 10575 3825 10575 3855 +-6 +6 10530 4230 10620 4320 +1 3 0 1 0 -1 0 0 20 0.000 1 0.0000 10575 4275 30 30 10575 4275 10575 4305 +-6 +1 3 0 1 0 7 0 0 -1 0.000 1 0.0000 11970 4275 45 45 11970 4275 12015 4275 +2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5 + 11025 3375 11925 3375 11925 4500 11025 4500 11025 3375 +2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 3 + 11025 4185 11115 4275 11025 4365 +2 1 0 1 0 0 20 0 -1 0.000 0 0 0 0 0 2 + 11865 4230 11790 4230 +2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 3 + 11025 3600 10575 3600 10575 4635 +2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2 + 11025 3825 10575 3825 +2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2 + 11025 4275 10575 4275 +2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2 + 11925 3600 12285 3600 +2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2 + 12015 4275 12285 4275 +2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2 + 11025 4050 10620 4050 +2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 1 0 3 + 1 1 1.00 60.00 120.00 + 10530 4050 10125 4050 10125 3600 +4 0 0 20 -1 16 6 0.0000 4 75 90 11790 3645 Q\001 +4 0 0 20 -1 16 6 0.0000 4 75 90 11790 4320 Q\001 +4 0 0 20 -1 16 6 0.0000 4 75 360 11070 4095 RESET\001 +4 0 0 20 -1 16 6 0.0000 4 75 210 11070 3870 SET\001 +4 0 0 20 -1 16 6 0.0000 4 75 75 11070 3645 D\001 +4 0 0 20 -1 16 6 0.0000 4 75 210 11160 4320 CLK\001 +4 0 0 0 -1 16 6 0.0000 4 75 120 11970 3555 13\001 +4 0 0 0 -1 16 6 0.0000 4 75 120 11970 4185 12\001 +4 0 0 0 -1 16 6 0.0000 4 75 60 10935 3555 9\001 +4 0 0 0 -1 16 6 0.0000 4 75 120 10890 4230 11\001 +4 0 0 0 -1 16 6 0.0000 4 75 60 10935 3780 8\001 +4 0 0 0 -1 16 6 0.0000 4 75 120 10890 4005 10\001 +4 0 0 50 -1 0 12 0.0000 4 135 240 10035 3465 5V\001 +4 0 0 50 -1 0 12 0.0000 4 135 375 12195 4005 U3B\001 +-6 +6 4500 6030 4680 6300 +2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2 + 4575 6300 4605 6300 +2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2 + 4540 6255 4640 6255 +2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2 + 4500 6210 4680 6210 +2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2 + 4590 6030 4590 6210 +-6 +6 4995 6030 5175 6300 +2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2 + 5070 6300 5100 6300 +2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2 + 5035 6255 5135 6255 +2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2 + 4995 6210 5175 6210 +2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2 + 5085 6030 5085 6210 +-6 +6 4995 5715 5175 6030 +2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2 + 5085 5850 5085 5715 +2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2 + 5085 5895 5085 6030 +2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2 + 4995 5850 5175 5850 +2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2 + 4995 5895 5175 5895 +-6 +6 3510 5490 3690 5760 +2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2 + 3585 5760 3615 5760 +2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2 + 3550 5715 3650 5715 +2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2 + 3510 5670 3690 5670 +2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2 + 3600 5490 3600 5670 +-6 +6 7695 2700 8865 3285 +6 7785 2700 8865 3060 +1 3 0 1 0 7 0 0 -1 0.000 1 0.0000 8550 2880 45 45 8550 2880 8550 2925 +2 1 0 1 0 7 0 0 -1 0.000 0 0 -1 0 0 4 + 8145 2700 8145 3060 8505 2880 8145 2700 +2 1 0 1 0 7 0 0 -1 0.000 0 0 -1 0 0 2 + 8145 2880 7785 2880 +2 1 0 1 0 7 0 0 -1 0.000 0 0 -1 0 0 2 + 8595 2880 8865 2880 +4 0 0 0 -1 16 6 0.0000 4 75 60 7920 2835 9\001 +4 0 0 0 -1 16 6 0.0000 4 75 60 8685 2835 8\001 +-6 +6 7695 2880 7875 3150 +2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2 + 7770 3150 7800 3150 +2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2 + 7735 3105 7835 3105 +2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2 + 7695 3060 7875 3060 +2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2 + 7785 2880 7785 3060 +-6 +4 0 0 50 -1 0 12 0.0000 4 135 375 8190 3285 U1D\001 +-6 +6 7155 4590 7605 4680 +2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2 + 7250 4635 7155 4635 +2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 7 + 7515 4635 7488 4595 7434 4675 7380 4595 7326 4675 7272 4595 + 7245 4635 +2 1 0 1 0 -1 0 0 -1 0.000 0 0 -1 0 0 2 + 7605 4635 7510 4635 +-6 +1 3 0 1 0 7 0 0 -1 0.000 1 0.0000 11070 2250 45 45 11070 2250 11115 2250 +2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2 + 8865 1575 10125 1575 +2 1 0 1 0 0 0 0 -1 4.000 0 0 0 0 0 2 + 11385 2250 11115 2250 +2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 3 + 10125 1800 9225 1800 9225 2115 +2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2 + 10125 2025 9225 2025 +2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 1 0 2 + 1 1 1.00 60.00 120.00 + 10575 1350 10575 900 +2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2 + 10575 2475 10575 2700 +2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5 + 10125 1350 11025 1350 11025 2475 10125 2475 10125 1350 +2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 3 + 10125 2160 10215 2250 10125 2340 +2 1 0 1 0 0 20 0 -1 0.000 0 0 0 0 0 2 + 10965 2205 10890 2205 +2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 4 + 8865 1575 8865 2250 3465 2250 3465 1575 +2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 4 + 1350 1620 1350 1350 2025 1350 2025 1620 +2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 4 + 1350 1890 1350 2070 2025 2070 2025 1845 +2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 1 0 2 + 1 1 1.00 60.00 120.00 + 1710 1350 1710 900 +2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 1 0 4 + 1 1 1.00 60.00 120.00 + 5085 3825 5085 3375 3600 3375 3600 2925 +2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2 + 3600 3735 3600 3330 +2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2 + 3600 4410 3600 4140 +2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2 + 4275 4275 3600 4275 +2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2 + 4275 4950 3600 4950 +2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 3 + 4275 4635 3870 4635 3870 4950 +2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2 + 3600 4725 3600 5220 +2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2 + 4590 5400 4590 6075 +2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2 + 5085 5760 5085 5400 +2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5 + 4275 3825 5400 3825 5400 5400 4275 5400 4275 3825 +2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2 + 4590 3825 4590 3375 +2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 1 0 2 + 1 1 1.00 60.00 120.00 + 11025 1575 11925 1575 +2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 4 + 10125 2250 9675 2250 9675 4635 7605 4635 +2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2 + 7155 4635 5400 4635 +4 0 0 50 -1 0 12 0.0000 4 135 240 10485 765 5V\001 +4 0 0 20 -1 16 6 0.0000 4 75 90 10890 1620 Q\001 +4 0 0 20 -1 16 6 0.0000 4 75 90 10890 2295 Q\001 +4 0 0 0 -1 16 6 0.0000 4 75 60 11115 1530 1\001 +4 0 0 0 -1 16 6 0.0000 4 75 60 11115 2160 2\001 +4 0 0 0 -1 16 6 0.0000 4 75 60 9990 1530 5\001 +4 0 0 0 -1 16 6 0.0000 4 75 60 9990 2205 3\001 +4 0 0 20 -1 16 6 0.0000 4 75 360 10170 2070 RESET\001 +4 0 0 0 -1 16 6 0.0000 4 75 60 9990 1755 6\001 +4 0 0 0 -1 16 6 0.0000 4 75 60 9990 1980 4\001 +4 0 0 20 -1 16 6 0.0000 4 75 210 10170 1845 SET\001 +4 0 0 20 -1 16 6 0.0000 4 75 75 10170 1620 D\001 +4 0 0 20 -1 16 6 0.0000 4 75 210 10260 2295 CLK\001 +4 0 0 10 -1 16 6 0.0000 4 75 60 10665 2610 7\001 +4 0 0 7 -1 16 6 0.0000 4 75 120 10620 1260 14\001 +4 0 0 50 -1 0 12 0.0000 4 135 375 11295 1980 U3A\001 +4 0 0 7 -1 16 6 0.0000 4 75 195 10485 1485 Vdd\001 +4 0 0 10 -1 16 6 0.0000 4 75 195 10485 2430 Vss\001 +4 0 0 50 -1 0 12 0.0000 4 135 240 1620 855 5V\001 +4 0 0 50 -1 0 12 0.0000 4 135 525 2205 1800 100nF\001 +4 0 0 50 -1 0 12 0.0000 4 135 420 720 1800 10uF\001 +4 0 0 50 -1 0 12 0.0000 4 135 2070 5130 2655 4069 CMOS Hex Inverter\001 +4 0 0 0 -1 16 6 0.0000 4 75 60 4635 3780 4\001 +4 0 0 10 -1 16 6 0.0000 4 75 60 5130 3780 8\001 +4 0 0 50 -1 0 12 0.0000 4 135 240 4725 4635 U2\001 +4 0 0 50 -1 0 12 0.0000 4 135 240 3510 2790 5V\001 +4 0 0 0 -1 16 6 0.0000 4 75 60 4140 4185 7\001 +4 0 0 0 -1 16 6 0.0000 4 75 60 4140 4590 6\001 +4 0 0 0 -1 16 6 0.0000 4 75 60 4140 4905 2\001 +4 0 0 7 -1 16 6 0.0000 4 75 60 4635 5535 1\001 +4 0 0 0 -1 16 6 0.0000 4 75 60 5130 5535 5\001 +4 0 0 50 -1 0 12 0.0000 4 135 1845 5670 5130 LM7555 CMOS Timer\001 +4 0 0 50 -1 0 12 0.0000 4 180 1845 11025 2970 4013 Dual D Flip-Flop\001 +4 0 0 50 -1 0 12 0.0000 4 135 420 5265 5940 10nF\001 +4 0 0 20 -1 16 6 0.0000 4 75 180 4365 4320 DIS\001 +4 0 0 20 -1 16 6 0.0000 4 75 210 4365 4680 THR\001 +4 0 0 20 -1 16 6 0.0000 4 75 255 4365 4995 TRIG\001 +4 0 0 20 -1 16 6 0.0000 4 75 270 4950 5310 CTRL\001 +4 0 0 20 -1 16 6 0.0000 4 75 240 4455 5310 GND\001 +4 0 0 20 -1 16 6 0.0000 4 75 360 4410 4005 RESET\001 +4 0 0 20 -1 16 6 0.0000 4 75 195 4995 4005 Vcc\001 +4 0 0 0 -1 16 6 0.0000 4 75 60 5490 4545 3\001 +4 0 0 20 -1 16 6 0.0000 4 75 225 5130 4680 OUT\001 +4 0 0 50 -1 0 12 0.0000 4 180 570 12105 1620 Output\001 +4 0 0 50 -1 0 12 0.0000 4 135 315 3105 5400 1nF\001 +4 0 0 50 -1 0 12 0.0000 4 135 390 3060 4680 1.2K\001 +4 0 0 50 -1 0 12 0.0000 4 135 240 3150 4005 R1\001 +4 0 0 50 -1 0 12 0.0000 4 135 1890 945 3870 Choose R1 for between\001 +4 0 0 50 -1 0 12 0.0000 4 135 345 7200 4500 56R\001 +4 0 0 50 -1 0 12 0.0000 4 180 1980 900 4140 100 and 200 kHz output\001 +4 0 0 50 -1 0 12 0.0000 4 135 660 1485 4410 from U2\001 +4 0 0 50 -1 0 12 0.0000 4 180 3315 8280 5895 Place U1 and U2 on opposite sides of the\001 +4 0 0 50 -1 0 12 0.0000 4 180 3540 8280 6120 PCB layout to avoid the regular signal from\001 +# or +4 0 0 50 -1 0 12 0.0000 4 180 3465 8280 6345 U2 affecting the ring oscillator's behaviour\001 diff --git a/libraries/Crypto/ring_oscillator.png b/libraries/Crypto/ring_oscillator.png new file mode 100644 index 00000000..c0939bc3 Binary files /dev/null and b/libraries/Crypto/ring_oscillator.png differ diff --git a/libraries/Crypto/ring_oscillator_basic.fig b/libraries/Crypto/ring_oscillator_basic.fig new file mode 100644 index 00000000..f3fdc41e --- /dev/null +++ b/libraries/Crypto/ring_oscillator_basic.fig @@ -0,0 +1,39 @@ +#FIG 3.2 Produced by xfig version 3.2.5c +Landscape +Center +Metric +A4 +100.00 +Single +-2 +1200 2 +6 7155 1710 7245 1800 +1 3 0 1 0 -1 0 0 20 0.000 1 0.0000 7200 1755 30 30 7200 1755 7200 1785 +-6 +1 3 0 1 0 7 0 0 -1 0.000 1 0.0000 4590 1755 45 45 4590 1755 4635 1755 +1 3 0 1 0 7 0 0 -1 0.000 1 0.0000 5715 1755 45 45 5715 1755 5760 1755 +1 3 0 1 0 7 0 0 -1 0.000 1 0.0000 6840 1755 45 45 6840 1755 6885 1755 +2 1 0 1 0 7 0 0 -1 0.000 0 0 -1 0 0 2 + 4185 1755 3825 1755 +2 1 0 1 0 7 0 0 -1 0.000 0 0 -1 0 0 2 + 4635 1755 4950 1755 +2 1 0 1 0 7 0 0 -1 0.000 0 0 -1 0 0 4 + 4185 1575 4185 1935 4545 1755 4185 1575 +2 1 0 1 0 7 0 0 -1 0.000 0 0 -1 0 0 2 + 5310 1755 4950 1755 +2 1 0 1 0 7 0 0 -1 0.000 0 0 -1 0 0 2 + 5760 1755 6075 1755 +2 1 0 1 0 7 0 0 -1 0.000 0 0 -1 0 0 4 + 5310 1575 5310 1935 5670 1755 5310 1575 +2 1 0 1 0 7 0 0 -1 0.000 0 0 -1 0 0 2 + 6435 1755 6075 1755 +2 1 0 1 0 7 0 0 -1 0.000 0 0 -1 0 0 2 + 6885 1755 7200 1755 +2 1 0 1 0 7 0 0 -1 0.000 0 0 -1 0 0 4 + 6435 1575 6435 1935 6795 1755 6435 1575 +2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 1 0 2 + 1 1 1.00 60.00 120.00 + 7200 1755 7875 1755 +2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 4 + 7200 1755 7200 1350 3825 1350 3825 1755 +4 0 0 50 -1 0 12 0.0000 4 180 570 8010 1800 Output\001 diff --git a/libraries/Crypto/ring_oscillator_basic.png b/libraries/Crypto/ring_oscillator_basic.png new file mode 100644 index 00000000..896fe0ac Binary files /dev/null and b/libraries/Crypto/ring_oscillator_basic.png differ diff --git a/libraries/Crypto/ring_oscillator_multi.fig b/libraries/Crypto/ring_oscillator_multi.fig new file mode 100644 index 00000000..ecb2425c --- /dev/null +++ b/libraries/Crypto/ring_oscillator_multi.fig @@ -0,0 +1,146 @@ +#FIG 3.2 Produced by xfig version 3.2.5c +Landscape +Center +Metric +A4 +100.00 +Single +-2 +1200 2 +5 1 0 1 0 7 0 0 -1 0.000 0 0 0 0 5671.500 1807.500 6221 1515 6294 1808 6221 2100 +5 1 0 1 0 7 0 0 -1 0.000 0 0 0 0 5532.919 1807.500 6074 1515 6148 1808 6074 2100 +6 1125 1170 4995 4050 +6 1125 1170 4995 1755 +6 4185 1395 4635 1755 +1 3 0 1 0 7 0 0 -1 0.000 1 0.0000 4590 1575 45 45 4590 1575 4635 1575 +2 1 0 1 0 7 0 0 -1 0.000 0 0 -1 0 0 4 + 4185 1395 4185 1755 4545 1575 4185 1395 +-6 +6 4905 1530 4995 1620 +1 3 0 1 0 -1 0 0 20 0.000 1 0.0000 4950 1575 30 30 4950 1575 4950 1605 +-6 +1 3 0 1 0 7 0 0 -1 0.000 1 0.0000 1890 1575 45 45 1890 1575 1935 1575 +1 3 0 1 0 7 0 0 -1 0.000 1 0.0000 3015 1575 45 45 3015 1575 3060 1575 +2 1 0 1 0 7 0 0 -1 0.000 0 0 -1 0 0 2 + 1485 1575 1125 1575 +2 1 0 1 0 7 0 0 -1 0.000 0 0 -1 0 0 2 + 1935 1575 2250 1575 +2 1 0 1 0 7 0 0 -1 0.000 0 0 -1 0 0 4 + 1485 1395 1485 1755 1845 1575 1485 1395 +2 1 0 1 0 7 0 0 -1 0.000 0 0 -1 0 0 2 + 2610 1575 2250 1575 +2 1 0 1 0 7 0 0 -1 0.000 0 0 -1 0 0 2 + 3060 1575 3375 1575 +2 1 0 1 0 7 0 0 -1 0.000 0 0 -1 0 0 4 + 2610 1395 2610 1755 2970 1575 2610 1395 +2 1 0 1 0 7 0 0 -1 0.000 0 0 -1 0 0 2 + 4185 1575 3825 1575 +2 1 2 1 0 7 50 -1 -1 3.000 0 0 -1 0 0 2 + 3375 1575 3825 1575 +2 1 0 1 0 7 0 0 -1 0.000 0 0 -1 0 0 2 + 4635 1575 4950 1575 +2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 4 + 4950 1575 4950 1170 1125 1170 1125 1575 +-6 +6 1125 2070 4995 2655 +6 4185 2295 4635 2655 +1 3 0 1 0 7 0 0 -1 0.000 1 0.0000 4590 2475 45 45 4590 2475 4635 2475 +2 1 0 1 0 7 0 0 -1 0.000 0 0 -1 0 0 4 + 4185 2295 4185 2655 4545 2475 4185 2295 +-6 +6 4905 2430 4995 2520 +1 3 0 1 0 -1 0 0 20 0.000 1 0.0000 4950 2475 30 30 4950 2475 4950 2505 +-6 +1 3 0 1 0 7 0 0 -1 0.000 1 0.0000 1890 2475 45 45 1890 2475 1935 2475 +1 3 0 1 0 7 0 0 -1 0.000 1 0.0000 3015 2475 45 45 3015 2475 3060 2475 +2 1 0 1 0 7 0 0 -1 0.000 0 0 -1 0 0 2 + 1485 2475 1125 2475 +2 1 0 1 0 7 0 0 -1 0.000 0 0 -1 0 0 2 + 1935 2475 2250 2475 +2 1 0 1 0 7 0 0 -1 0.000 0 0 -1 0 0 4 + 1485 2295 1485 2655 1845 2475 1485 2295 +2 1 0 1 0 7 0 0 -1 0.000 0 0 -1 0 0 2 + 2610 2475 2250 2475 +2 1 0 1 0 7 0 0 -1 0.000 0 0 -1 0 0 2 + 3060 2475 3375 2475 +2 1 0 1 0 7 0 0 -1 0.000 0 0 -1 0 0 4 + 2610 2295 2610 2655 2970 2475 2610 2295 +2 1 0 1 0 7 0 0 -1 0.000 0 0 -1 0 0 2 + 4185 2475 3825 2475 +2 1 2 1 0 7 50 -1 -1 3.000 0 0 -1 0 0 2 + 3375 2475 3825 2475 +2 1 0 1 0 7 0 0 -1 0.000 0 0 -1 0 0 2 + 4635 2475 4950 2475 +2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 4 + 4950 2475 4950 2070 1125 2070 1125 2475 +-6 +6 1125 3465 4995 4050 +6 4185 3690 4635 4050 +1 3 0 1 0 7 0 0 -1 0.000 1 0.0000 4590 3870 45 45 4590 3870 4635 3870 +2 1 0 1 0 7 0 0 -1 0.000 0 0 -1 0 0 4 + 4185 3690 4185 4050 4545 3870 4185 3690 +-6 +6 4905 3825 4995 3915 +1 3 0 1 0 -1 0 0 20 0.000 1 0.0000 4950 3870 30 30 4950 3870 4950 3900 +-6 +1 3 0 1 0 7 0 0 -1 0.000 1 0.0000 1890 3870 45 45 1890 3870 1935 3870 +1 3 0 1 0 7 0 0 -1 0.000 1 0.0000 3015 3870 45 45 3015 3870 3060 3870 +2 1 0 1 0 7 0 0 -1 0.000 0 0 -1 0 0 2 + 1485 3870 1125 3870 +2 1 0 1 0 7 0 0 -1 0.000 0 0 -1 0 0 2 + 1935 3870 2250 3870 +2 1 0 1 0 7 0 0 -1 0.000 0 0 -1 0 0 4 + 1485 3690 1485 4050 1845 3870 1485 3690 +2 1 0 1 0 7 0 0 -1 0.000 0 0 -1 0 0 2 + 2610 3870 2250 3870 +2 1 0 1 0 7 0 0 -1 0.000 0 0 -1 0 0 2 + 3060 3870 3375 3870 +2 1 0 1 0 7 0 0 -1 0.000 0 0 -1 0 0 4 + 2610 3690 2610 4050 2970 3870 2610 3690 +2 1 0 1 0 7 0 0 -1 0.000 0 0 -1 0 0 2 + 4185 3870 3825 3870 +2 1 2 1 0 7 50 -1 -1 3.000 0 0 -1 0 0 2 + 3375 3870 3825 3870 +2 1 0 1 0 7 0 0 -1 0.000 0 0 -1 0 0 2 + 4635 3870 4950 3870 +2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 4 + 4950 3870 4950 3465 1125 3465 1125 3870 +-6 +2 1 2 1 0 7 50 -1 -1 3.000 0 0 -1 0 0 2 + 2880 2700 2880 3330 +-6 +2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5 + 7875 1575 8775 1575 8775 2700 7875 2700 7875 1575 +2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 3 + 7875 2385 7965 2475 7875 2565 +2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 1 0 2 + 1 1 1.00 60.00 120.00 + 8775 1800 9450 1800 +2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 1 3 + 8 1 1.00 60.00 120.00 + 6975 3150 6975 2475 7875 2475 +2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2 + 6210 1575 4905 1575 +2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 4 + 4950 3870 5670 3870 5670 2025 5805 2025 +2 1 0 1 0 7 0 0 -1 0.000 0 0 -1 0 0 2 + 6951 1808 7875 1800 +2 1 0 1 0 7 0 0 -1 0.000 0 0 -1 0 0 2 + 6221 2027 5709 2027 +2 1 0 1 0 7 0 0 -1 0.000 0 0 -1 0 0 2 + 6221 1515 6586 1515 +2 1 0 1 0 7 0 0 -1 0.000 0 0 -1 0 0 2 + 6586 2100 6221 2100 +2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 4 + 4950 2475 5310 2475 5310 1800 6255 1800 +3 2 0 1 0 7 0 0 -1 0.000 0 0 0 3 + 6951 1808 6805 1588 6586 1515 + 0.000 -1.000 0.000 +3 2 0 1 0 7 0 0 -1 0.000 0 0 0 3 + 6951 1808 6805 2027 6586 2100 + 0.000 -1.000 0.000 +4 0 0 50 -1 0 12 0.0000 4 135 135 7920 1845 D\001 +4 0 0 50 -1 0 12 0.0000 4 165 135 8595 1845 Q\001 +4 0 0 50 -1 0 12 0.0000 4 135 390 8010 2520 CLK\001 +4 0 0 50 -1 0 12 0.0000 4 180 570 9540 1845 Output\001 +4 0 0 50 -1 0 12 0.0000 4 180 1320 6435 3375 Sampling Clock\001 diff --git a/libraries/Crypto/ring_oscillator_multi.png b/libraries/Crypto/ring_oscillator_multi.png new file mode 100644 index 00000000..d8324d6f Binary files /dev/null and b/libraries/Crypto/ring_oscillator_multi.png differ diff --git a/libraries/Crypto/ring_oscillator_sampled.fig b/libraries/Crypto/ring_oscillator_sampled.fig new file mode 100644 index 00000000..8fa85d31 --- /dev/null +++ b/libraries/Crypto/ring_oscillator_sampled.fig @@ -0,0 +1,54 @@ +#FIG 3.2 Produced by xfig version 3.2.5c +Landscape +Center +Metric +A4 +100.00 +Single +-2 +1200 2 +6 3825 1395 7875 1980 +6 7155 1755 7245 1845 +1 3 0 1 0 -1 0 0 20 0.000 1 0.0000 7200 1800 30 30 7200 1800 7200 1830 +-6 +1 3 0 1 0 7 0 0 -1 0.000 1 0.0000 4590 1800 45 45 4590 1800 4635 1800 +1 3 0 1 0 7 0 0 -1 0.000 1 0.0000 5715 1800 45 45 5715 1800 5760 1800 +1 3 0 1 0 7 0 0 -1 0.000 1 0.0000 6840 1800 45 45 6840 1800 6885 1800 +2 1 0 1 0 7 0 0 -1 0.000 0 0 -1 0 0 2 + 4185 1800 3825 1800 +2 1 0 1 0 7 0 0 -1 0.000 0 0 -1 0 0 2 + 4635 1800 4950 1800 +2 1 0 1 0 7 0 0 -1 0.000 0 0 -1 0 0 4 + 4185 1620 4185 1980 4545 1800 4185 1620 +2 1 0 1 0 7 0 0 -1 0.000 0 0 -1 0 0 2 + 5310 1800 4950 1800 +2 1 0 1 0 7 0 0 -1 0.000 0 0 -1 0 0 2 + 5760 1800 6075 1800 +2 1 0 1 0 7 0 0 -1 0.000 0 0 -1 0 0 4 + 5310 1620 5310 1980 5670 1800 5310 1620 +2 1 0 1 0 7 0 0 -1 0.000 0 0 -1 0 0 2 + 6435 1800 6075 1800 +2 1 0 1 0 7 0 0 -1 0.000 0 0 -1 0 0 2 + 6885 1800 7200 1800 +2 1 0 1 0 7 0 0 -1 0.000 0 0 -1 0 0 4 + 6435 1620 6435 1980 6795 1800 6435 1620 +2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 4 + 7200 1800 7200 1395 3825 1395 3825 1800 +2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2 + 7200 1800 7875 1800 +-6 +2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5 + 7875 1575 8775 1575 8775 2700 7875 2700 7875 1575 +2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 3 + 7875 2385 7965 2475 7875 2565 +2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 1 0 2 + 1 1 1.00 60.00 120.00 + 8775 1800 9450 1800 +2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 1 3 + 8 1 1.00 60.00 120.00 + 6975 3150 6975 2475 7875 2475 +4 0 0 50 -1 0 12 0.0000 4 135 135 7920 1845 D\001 +4 0 0 50 -1 0 12 0.0000 4 165 135 8595 1845 Q\001 +4 0 0 50 -1 0 12 0.0000 4 135 390 8010 2520 CLK\001 +4 0 0 50 -1 0 12 0.0000 4 180 570 9540 1845 Output\001 +4 0 0 50 -1 0 12 0.0000 4 180 1320 6435 3375 Sampling Clock\001 diff --git a/libraries/Crypto/ring_oscillator_sampled.png b/libraries/Crypto/ring_oscillator_sampled.png new file mode 100644 index 00000000..0cd3d071 Binary files /dev/null and b/libraries/Crypto/ring_oscillator_sampled.png differ