From e923155962c53c0fa10930bf13ea3e70f9977a55 Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Fri, 3 Nov 2017 10:49:30 +1000 Subject: [PATCH] Update docs --- AES128_8cpp_source.html | 2 +- AES192_8cpp_source.html | 2 +- AES256_8cpp_source.html | 2 +- AESCommon_8cpp_source.html | 2 +- AES_8h_source.html | 2 +- AuthenticatedCipher_8cpp_source.html | 2 +- AuthenticatedCipher_8h_source.html | 2 +- BLAKE2b_8cpp_source.html | 2 +- BLAKE2b_8h_source.html | 2 +- BLAKE2s_8cpp_source.html | 2 +- BLAKE2s_8h_source.html | 2 +- BigNumberUtil_8cpp_source.html | 2 +- BigNumberUtil_8h_source.html | 2 +- Bitmap_8cpp_source.html | 2 +- Bitmap_8h_source.html | 2 +- BlinkLED_8cpp_source.html | 2 +- BlinkLED_8h_source.html | 2 +- BlockCipher_8cpp_source.html | 2 +- BlockCipher_8h_source.html | 2 +- BoolField_8cpp_source.html | 2 +- BoolField_8h_source.html | 2 +- CBC_8cpp_source.html | 2 +- CBC_8h_source.html | 2 +- CFB_8cpp_source.html | 2 +- CFB_8h_source.html | 2 +- CTR_8cpp_source.html | 2 +- CTR_8h_source.html | 2 +- ChaChaPoly_8cpp_source.html | 2 +- ChaChaPoly_8h_source.html | 2 +- ChaCha_8cpp_source.html | 2 +- ChaCha_8h_source.html | 2 +- Charlieplex_8cpp_source.html | 2 +- Charlieplex_8h_source.html | 2 +- ChaseLEDs_8cpp_source.html | 2 +- ChaseLEDs_8h_source.html | 2 +- Cipher_8cpp_source.html | 2 +- Cipher_8h_source.html | 2 +- Crypto_8cpp_source.html | 2 +- Crypto_8h_source.html | 2 +- Curve25519_8cpp_source.html | 2659 ++++++++++--------- Curve25519_8h_source.html | 8 +- DMD_8cpp_source.html | 2 +- DMD_8h_source.html | 2 +- DS1307RTC_8cpp_source.html | 2 +- DS1307RTC_8h_source.html | 2 +- DS3231RTC_8cpp_source.html | 2 +- DS3231RTC_8h_source.html | 2 +- DS3232RTC_8cpp_source.html | 2 +- DS3232RTC_8h_source.html | 2 +- DejaVuSans9_8h_source.html | 2 +- DejaVuSansBold9_8h_source.html | 2 +- DejaVuSansItalic9_8h_source.html | 2 +- EAX_8cpp_source.html | 2 +- EAX_8h_source.html | 2 +- EEPROM24_8cpp_source.html | 2 +- EEPROM24_8h_source.html | 2 +- Ed25519_8cpp_source.html | 2 +- Ed25519_8h_source.html | 2 +- Field_8cpp_source.html | 2 +- Field_8h_source.html | 2 +- Form_8cpp_source.html | 2 +- Form_8h_source.html | 2 +- GCM_8cpp_source.html | 2 +- GCM_8h_source.html | 2 +- GF128_8cpp_source.html | 2 +- GF128_8h_source.html | 2 +- GHASH_8cpp_source.html | 2 +- GHASH_8h_source.html | 2 +- Hash_8cpp_source.html | 2 +- Hash_8h_source.html | 2 +- I2CMaster_8cpp_source.html | 2 +- I2CMaster_8h_source.html | 2 +- IRreceiver_8cpp_source.html | 2 +- IRreceiver_8h_source.html | 2 +- IntField_8cpp_source.html | 2 +- IntField_8h_source.html | 2 +- KeccakCore_8cpp_source.html | 2 +- KeccakCore_8h_source.html | 2 +- LCD_8cpp_source.html | 2 +- LCD_8h_source.html | 2 +- ListField_8cpp_source.html | 2 +- ListField_8h_source.html | 2 +- LoginShell_8cpp_source.html | 2 +- LoginShell_8h_source.html | 2 +- Melody_8cpp_source.html | 2 +- Melody_8h_source.html | 2 +- Mono5x7_8h_source.html | 2 +- NewHope_8cpp_source.html | 2 +- NewHope_8h_source.html | 2 +- NoiseSource_8cpp_source.html | 2 +- NoiseSource_8h_source.html | 2 +- OFB_8cpp_source.html | 2 +- OFB_8h_source.html | 2 +- OMAC_8cpp_source.html | 2 +- OMAC_8h_source.html | 2 +- P521_8cpp_source.html | 2 +- P521_8h_source.html | 2 +- Poly1305_8cpp_source.html | 2 +- Poly1305_8h_source.html | 2 +- PowerSave_8cpp_source.html | 2 +- PowerSave_8h_source.html | 2 +- RC5_8h_source.html | 2 +- RNG_8cpp_source.html | 2 +- RNG_8h_source.html | 2 +- RTC_8cpp_source.html | 2 +- RTC_8h_source.html | 2 +- RingOscillatorNoiseSource_8cpp_source.html | 2 +- RingOscillatorNoiseSource_8h_source.html | 2 +- SHA256_8cpp_source.html | 2 +- SHA256_8h_source.html | 2 +- SHA3_8cpp_source.html | 2 +- SHA3_8h_source.html | 2 +- SHA512_8cpp_source.html | 2 +- SHA512_8h_source.html | 2 +- SHAKE_8cpp_source.html | 2 +- SHAKE_8h_source.html | 2 +- Shell_8cpp_source.html | 2 +- Shell_8h_source.html | 2 +- SoftI2C_8cpp_source.html | 2 +- SoftI2C_8h_source.html | 2 +- SpeckSmall_8cpp_source.html | 716 +++-- SpeckSmall_8h_source.html | 4 +- SpeckTiny_8cpp_source.html | 679 +++-- SpeckTiny_8h_source.html | 6 +- Speck_8cpp_source.html | 961 ++++--- Speck_8h_source.html | 8 +- TelnetDefs_8h_source.html | 2 +- Terminal_8cpp_source.html | 2 +- Terminal_8h_source.html | 2 +- TextField_8cpp_source.html | 2 +- TextField_8h_source.html | 2 +- TimeField_8cpp_source.html | 2 +- TimeField_8h_source.html | 2 +- TransistorNoiseSource_8cpp_source.html | 2 +- TransistorNoiseSource_8h_source.html | 2 +- USBKeysExtra_8h_source.html | 2 +- XOF_8cpp_source.html | 2 +- XOF_8h_source.html | 2 +- XTS_8cpp_source.html | 2 +- XTS_8h_source.html | 2 +- alarm-clock_8dox.html | 2 +- alarm_clock.html | 2 +- annotated.html | 2 +- blink-blink_8dox.html | 2 +- blink-charlieplex_8dox.html | 2 +- blink-cylon_8dox.html | 2 +- blink-startrek_8dox.html | 2 +- blink_blink.html | 2 +- blink_charlieplex.html | 2 +- blink_cylon.html | 2 +- blink_startrek.html | 2 +- classAES128-members.html | 2 +- classAES128.html | 2 +- classAES192-members.html | 2 +- classAES192.html | 2 +- classAES256-members.html | 2 +- classAES256.html | 2 +- classAESCommon-members.html | 2 +- classAESCommon.html | 2 +- classAuthenticatedCipher-members.html | 2 +- classAuthenticatedCipher.html | 2 +- classBLAKE2b-members.html | 2 +- classBLAKE2b.html | 2 +- classBLAKE2s-members.html | 2 +- classBLAKE2s.html | 2 +- classBigNumberUtil-members.html | 2 +- classBigNumberUtil.html | 2 +- classBitmap-members.html | 2 +- classBitmap.html | 2 +- classBlinkLED-members.html | 2 +- classBlinkLED.html | 2 +- classBlockCipher-members.html | 2 +- classBlockCipher.html | 2 +- classBoolField-members.html | 2 +- classBoolField.html | 2 +- classCBC-members.html | 2 +- classCBC.html | 2 +- classCBCCommon-members.html | 2 +- classCBCCommon.html | 2 +- classCFB-members.html | 2 +- classCFB.html | 2 +- classCFBCommon-members.html | 2 +- classCFBCommon.html | 2 +- classCTR-members.html | 2 +- classCTR.html | 2 +- classCTRCommon-members.html | 2 +- classCTRCommon.html | 2 +- classChaCha-members.html | 2 +- classChaCha.html | 2 +- classChaChaPoly-members.html | 2 +- classChaChaPoly.html | 2 +- classCharlieplex-members.html | 2 +- classCharlieplex.html | 2 +- classChaseLEDs-members.html | 2 +- classChaseLEDs.html | 2 +- classCipher-members.html | 2 +- classCipher.html | 2 +- classCurve25519-members.html | 2 +- classCurve25519.html | 8 +- classDMD-members.html | 2 +- classDMD.html | 2 +- classDS1307RTC-members.html | 2 +- classDS1307RTC.html | 2 +- classDS3231RTC-members.html | 2 +- classDS3231RTC.html | 2 +- classDS3232RTC-members.html | 2 +- classDS3232RTC.html | 2 +- classEAX-members.html | 2 +- classEAX.html | 2 +- classEAXCommon-members.html | 2 +- classEAXCommon.html | 2 +- classEEPROM24-members.html | 2 +- classEEPROM24.html | 2 +- classEd25519-members.html | 2 +- classEd25519.html | 2 +- classField-members.html | 2 +- classField.html | 2 +- classForm-members.html | 2 +- classForm.html | 2 +- classGCM-members.html | 2 +- classGCM.html | 2 +- classGCMCommon-members.html | 2 +- classGCMCommon.html | 2 +- classGF128-members.html | 2 +- classGF128.html | 2 +- classGHASH-members.html | 2 +- classGHASH.html | 2 +- classHash-members.html | 2 +- classHash.html | 2 +- classI2CMaster-members.html | 2 +- classI2CMaster.html | 2 +- classIRreceiver-members.html | 2 +- classIRreceiver.html | 2 +- classIntField-members.html | 2 +- classIntField.html | 2 +- classKeccakCore-members.html | 2 +- classKeccakCore.html | 2 +- classLCD-members.html | 2 +- classLCD.html | 2 +- classListField-members.html | 2 +- classListField.html | 2 +- classLoginShell-members.html | 2 +- classLoginShell.html | 2 +- classMelody-members.html | 2 +- classMelody.html | 2 +- classNewHope-members.html | 2 +- classNewHope.html | 2 +- classNoiseSource-members.html | 2 +- classNoiseSource.html | 2 +- classOFB-members.html | 2 +- classOFB.html | 2 +- classOFBCommon-members.html | 2 +- classOFBCommon.html | 2 +- classOMAC-members.html | 2 +- classOMAC.html | 2 +- classP521-members.html | 2 +- classP521.html | 2 +- classPoly1305-members.html | 2 +- classPoly1305.html | 2 +- classRNGClass-members.html | 2 +- classRNGClass.html | 2 +- classRTC-members.html | 2 +- classRTC.html | 2 +- classRTCAlarm-members.html | 2 +- classRTCDate-members.html | 2 +- classRTCTime-members.html | 2 +- classRingOscillatorNoiseSource-members.html | 2 +- classRingOscillatorNoiseSource.html | 2 +- classSHA256-members.html | 2 +- classSHA256.html | 2 +- classSHA3__256-members.html | 2 +- classSHA3__256.html | 2 +- classSHA3__512-members.html | 2 +- classSHA3__512.html | 2 +- classSHA512-members.html | 2 +- classSHA512.html | 2 +- classSHAKE-members.html | 2 +- classSHAKE.html | 2 +- classSHAKE128-members.html | 2 +- classSHAKE128.html | 2 +- classSHAKE256-members.html | 2 +- classSHAKE256.html | 2 +- classShell-members.html | 2 +- classShell.html | 2 +- classShellArguments-members.html | 2 +- classShellArguments.html | 2 +- classSoftI2C-members.html | 2 +- classSoftI2C.html | 2 +- classSpeck-members.html | 2 +- classSpeck.html | 8 +- classSpeckSmall-members.html | 2 +- classSpeckSmall.html | 4 +- classSpeckTiny-members.html | 2 +- classSpeckTiny.html | 6 +- classTerminal-members.html | 2 +- classTerminal.html | 2 +- classTextField-members.html | 2 +- classTextField.html | 2 +- classTimeField-members.html | 2 +- classTimeField.html | 2 +- classTransistorNoiseSource-members.html | 2 +- classTransistorNoiseSource.html | 2 +- classXOF-members.html | 2 +- classXOF.html | 2 +- classXTS-members.html | 2 +- classXTS.html | 2 +- classXTSCommon-members.html | 2 +- classXTSCommon.html | 2 +- classXTSSingleKey-members.html | 2 +- classXTSSingleKey.html | 2 +- classXTSSingleKeyCommon-members.html | 2 +- classXTSSingleKeyCommon.html | 2 +- classes.html | 2 +- crypto-rng-ring_8dox.html | 2 +- crypto-rng_8dox.html | 2 +- crypto.html | 28 +- crypto_8dox.html | 2 +- crypto_rng.html | 2 +- crypto_rng_ring.html | 2 +- dir_1586d320a3b1e622174530fde769cda9.html | 2 +- dir_1de32c476debcefedf4aa8bb43bea551.html | 2 +- dir_3dd03323535933fb3f714c41ff7a94da.html | 2 +- dir_470c03f38356b1f63943514897cb198b.html | 2 +- dir_48f64e79f12bd77ba047e9e436ec978c.html | 2 +- dir_5e87a7229a108582288ef7eda1233dc3.html | 2 +- dir_6591a2127a29f6cea3994dcb5b0596d1.html | 2 +- dir_7e6ab9b017486261fe80629d442521f0.html | 2 +- dir_9a34040863d1190c0e01b23e6b44de01.html | 2 +- dir_bc0718b08fb2015b8e59c47b2805f60c.html | 2 +- dir_be059bf9978ae156837504b1b8a7568c.html | 2 +- dir_e2ce51835550ba18edf07a8311722290.html | 2 +- dir_f34881fcf60f680b800190d5274dfaea.html | 2 +- dir_f9b96888882c2691b8eeaeafd1b9501d.html | 2 +- dmd-demo_8dox.html | 2 +- dmd-running-figure_8dox.html | 2 +- dmd_demo.html | 2 +- dmd_running_figure.html | 2 +- files.html | 2 +- functions.html | 2 +- functions_b.html | 2 +- functions_c.html | 2 +- functions_d.html | 2 +- functions_e.html | 2 +- functions_enum.html | 2 +- functions_eval.html | 2 +- functions_f.html | 2 +- functions_func.html | 2 +- functions_func_b.html | 2 +- functions_func_c.html | 2 +- functions_func_d.html | 2 +- functions_func_e.html | 2 +- functions_func_f.html | 2 +- functions_func_g.html | 2 +- functions_func_h.html | 2 +- functions_func_i.html | 2 +- functions_func_k.html | 2 +- functions_func_l.html | 2 +- functions_func_m.html | 2 +- functions_func_n.html | 2 +- functions_func_o.html | 2 +- functions_func_p.html | 2 +- functions_func_r.html | 2 +- functions_func_s.html | 2 +- functions_func_t.html | 2 +- functions_func_u.html | 2 +- functions_func_v.html | 2 +- functions_func_w.html | 2 +- functions_func_x.html | 2 +- functions_func_~.html | 2 +- functions_g.html | 2 +- functions_h.html | 2 +- functions_i.html | 2 +- functions_k.html | 2 +- functions_l.html | 2 +- functions_m.html | 2 +- functions_n.html | 2 +- functions_o.html | 2 +- functions_p.html | 2 +- functions_r.html | 2 +- functions_rela.html | 2 +- functions_s.html | 2 +- functions_t.html | 2 +- functions_type.html | 2 +- functions_u.html | 2 +- functions_v.html | 2 +- functions_vars.html | 2 +- functions_w.html | 2 +- functions_x.html | 2 +- functions_y.html | 2 +- functions_~.html | 2 +- group__power__save.html | 2 +- hierarchy.html | 2 +- index.html | 2 +- ir-dumpir_8dox.html | 2 +- ir-snake_8dox.html | 2 +- ir_dumpir.html | 2 +- ir_snake.html | 2 +- lcd-form_8dox.html | 2 +- lcd-helloworld_8dox.html | 2 +- lcd_form.html | 2 +- lcd_hello_world.html | 2 +- mainpage_8dox.html | 2 +- modules.html | 2 +- newhope-small_8dox.html | 2 +- newhope_small.html | 2 +- pages.html | 2 +- shell-serial_8dox.html | 2 +- shell-telnet_8dox.html | 2 +- shell_serial.html | 2 +- shell_telnet.html | 2 +- structNewHopePrivateKey.html | 2 +- structRTCAlarm.html | 2 +- structRTCDate.html | 2 +- structRTCTime.html | 2 +- 414 files changed, 2846 insertions(+), 3051 deletions(-) diff --git a/AES128_8cpp_source.html b/AES128_8cpp_source.html index cee8d34b..9bc0b6ed 100644 --- a/AES128_8cpp_source.html +++ b/AES128_8cpp_source.html @@ -175,7 +175,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/AES192_8cpp_source.html b/AES192_8cpp_source.html index aa5b28f3..ca2b3d13 100644 --- a/AES192_8cpp_source.html +++ b/AES192_8cpp_source.html @@ -175,7 +175,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/AES256_8cpp_source.html b/AES256_8cpp_source.html index 39d94062..01e98e6c 100644 --- a/AES256_8cpp_source.html +++ b/AES256_8cpp_source.html @@ -182,7 +182,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/AESCommon_8cpp_source.html b/AESCommon_8cpp_source.html index a0d3de3d..26dfbdcc 100644 --- a/AESCommon_8cpp_source.html +++ b/AESCommon_8cpp_source.html @@ -415,7 +415,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/AES_8h_source.html b/AES_8h_source.html index 655e2117..f8ec2aaf 100644 --- a/AES_8h_source.html +++ b/AES_8h_source.html @@ -203,7 +203,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/AuthenticatedCipher_8cpp_source.html b/AuthenticatedCipher_8cpp_source.html index 7989cdf1..f2799e3a 100644 --- a/AuthenticatedCipher_8cpp_source.html +++ b/AuthenticatedCipher_8cpp_source.html @@ -125,7 +125,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/AuthenticatedCipher_8h_source.html b/AuthenticatedCipher_8h_source.html index 92dd9600..b6e7d30c 100644 --- a/AuthenticatedCipher_8h_source.html +++ b/AuthenticatedCipher_8h_source.html @@ -141,7 +141,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/BLAKE2b_8cpp_source.html b/BLAKE2b_8cpp_source.html index 3f96a53a..35e61732 100644 --- a/BLAKE2b_8cpp_source.html +++ b/BLAKE2b_8cpp_source.html @@ -365,7 +365,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/BLAKE2b_8h_source.html b/BLAKE2b_8h_source.html index d4b4f891..4d757b3b 100644 --- a/BLAKE2b_8h_source.html +++ b/BLAKE2b_8h_source.html @@ -164,7 +164,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/BLAKE2s_8cpp_source.html b/BLAKE2s_8cpp_source.html index d9c4a642..ad5441ab 100644 --- a/BLAKE2s_8cpp_source.html +++ b/BLAKE2s_8cpp_source.html @@ -356,7 +356,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/BLAKE2s_8h_source.html b/BLAKE2s_8h_source.html index 706529ae..3305324c 100644 --- a/BLAKE2s_8h_source.html +++ b/BLAKE2s_8h_source.html @@ -163,7 +163,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/BigNumberUtil_8cpp_source.html b/BigNumberUtil_8cpp_source.html index 2b8cf073..9fbf18d5 100644 --- a/BigNumberUtil_8cpp_source.html +++ b/BigNumberUtil_8cpp_source.html @@ -682,7 +682,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/BigNumberUtil_8h_source.html b/BigNumberUtil_8h_source.html index bb83e832..8522a2d9 100644 --- a/BigNumberUtil_8h_source.html +++ b/BigNumberUtil_8h_source.html @@ -214,7 +214,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/Bitmap_8cpp_source.html b/Bitmap_8cpp_source.html index 6224ce00..375846cf 100644 --- a/Bitmap_8cpp_source.html +++ b/Bitmap_8cpp_source.html @@ -694,7 +694,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/Bitmap_8h_source.html b/Bitmap_8h_source.html index 16f2c32b..6f46984c 100644 --- a/Bitmap_8h_source.html +++ b/Bitmap_8h_source.html @@ -271,7 +271,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/BlinkLED_8cpp_source.html b/BlinkLED_8cpp_source.html index d265ef39..e33d3fd5 100644 --- a/BlinkLED_8cpp_source.html +++ b/BlinkLED_8cpp_source.html @@ -196,7 +196,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/BlinkLED_8h_source.html b/BlinkLED_8h_source.html index a1291142..8e469a9f 100644 --- a/BlinkLED_8h_source.html +++ b/BlinkLED_8h_source.html @@ -157,7 +157,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/BlockCipher_8cpp_source.html b/BlockCipher_8cpp_source.html index 71457f26..3b30cf96 100644 --- a/BlockCipher_8cpp_source.html +++ b/BlockCipher_8cpp_source.html @@ -125,7 +125,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/BlockCipher_8h_source.html b/BlockCipher_8h_source.html index 4e978250..3003850a 100644 --- a/BlockCipher_8h_source.html +++ b/BlockCipher_8h_source.html @@ -146,7 +146,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/BoolField_8cpp_source.html b/BoolField_8cpp_source.html index 084a496b..ecb33407 100644 --- a/BoolField_8cpp_source.html +++ b/BoolField_8cpp_source.html @@ -202,7 +202,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/BoolField_8h_source.html b/BoolField_8h_source.html index 3a999791..5a491970 100644 --- a/BoolField_8h_source.html +++ b/BoolField_8h_source.html @@ -160,7 +160,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/CBC_8cpp_source.html b/CBC_8cpp_source.html index b02524ce..898e349d 100644 --- a/CBC_8cpp_source.html +++ b/CBC_8cpp_source.html @@ -208,7 +208,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/CBC_8h_source.html b/CBC_8h_source.html index 89afb4c4..7a110e78 100644 --- a/CBC_8h_source.html +++ b/CBC_8h_source.html @@ -172,7 +172,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/CFB_8cpp_source.html b/CFB_8cpp_source.html index 2ec112fb..512c3002 100644 --- a/CFB_8cpp_source.html +++ b/CFB_8cpp_source.html @@ -233,7 +233,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/CFB_8h_source.html b/CFB_8h_source.html index 89911f69..d17d1e59 100644 --- a/CFB_8h_source.html +++ b/CFB_8h_source.html @@ -171,7 +171,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/CTR_8cpp_source.html b/CTR_8cpp_source.html index f692c1ad..81efd47d 100644 --- a/CTR_8cpp_source.html +++ b/CTR_8cpp_source.html @@ -228,7 +228,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/CTR_8h_source.html b/CTR_8h_source.html index 7b9183ab..4e44d9a8 100644 --- a/CTR_8h_source.html +++ b/CTR_8h_source.html @@ -175,7 +175,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/ChaChaPoly_8cpp_source.html b/ChaChaPoly_8cpp_source.html index 99e6caa0..42a0559c 100644 --- a/ChaChaPoly_8cpp_source.html +++ b/ChaChaPoly_8cpp_source.html @@ -263,7 +263,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/ChaChaPoly_8h_source.html b/ChaChaPoly_8h_source.html index 40a1491b..0e925c4f 100644 --- a/ChaChaPoly_8h_source.html +++ b/ChaChaPoly_8h_source.html @@ -173,7 +173,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/ChaCha_8cpp_source.html b/ChaCha_8cpp_source.html index 41c12b59..c69511da 100644 --- a/ChaCha_8cpp_source.html +++ b/ChaCha_8cpp_source.html @@ -311,7 +311,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/ChaCha_8h_source.html b/ChaCha_8h_source.html index f5adf39e..d78f80d2 100644 --- a/ChaCha_8h_source.html +++ b/ChaCha_8h_source.html @@ -170,7 +170,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/Charlieplex_8cpp_source.html b/Charlieplex_8cpp_source.html index 58c87903..a6eb6e81 100644 --- a/Charlieplex_8cpp_source.html +++ b/Charlieplex_8cpp_source.html @@ -232,7 +232,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/Charlieplex_8h_source.html b/Charlieplex_8h_source.html index 8c5e3bac..ba8a0dd7 100644 --- a/Charlieplex_8h_source.html +++ b/Charlieplex_8h_source.html @@ -162,7 +162,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/ChaseLEDs_8cpp_source.html b/ChaseLEDs_8cpp_source.html index a6c86104..87d811f9 100644 --- a/ChaseLEDs_8cpp_source.html +++ b/ChaseLEDs_8cpp_source.html @@ -160,7 +160,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/ChaseLEDs_8h_source.html b/ChaseLEDs_8h_source.html index e04351e6..adf129d3 100644 --- a/ChaseLEDs_8h_source.html +++ b/ChaseLEDs_8h_source.html @@ -149,7 +149,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/Cipher_8cpp_source.html b/Cipher_8cpp_source.html index dcb01cae..e22713eb 100644 --- a/Cipher_8cpp_source.html +++ b/Cipher_8cpp_source.html @@ -125,7 +125,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/Cipher_8h_source.html b/Cipher_8h_source.html index 258ca000..cc916724 100644 --- a/Cipher_8h_source.html +++ b/Cipher_8h_source.html @@ -148,7 +148,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/Crypto_8cpp_source.html b/Crypto_8cpp_source.html index 88b68db1..2166efe1 100644 --- a/Crypto_8cpp_source.html +++ b/Crypto_8cpp_source.html @@ -138,7 +138,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/Crypto_8h_source.html b/Crypto_8h_source.html index 7d6c092b..ca34904f 100644 --- a/Crypto_8h_source.html +++ b/Crypto_8h_source.html @@ -130,7 +130,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/Curve25519_8cpp_source.html b/Curve25519_8cpp_source.html index 5e8f697a..f9b010bd 100644 --- a/Curve25519_8cpp_source.html +++ b/Curve25519_8cpp_source.html @@ -118,1346 +118,1347 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
28 
44 // Global switch to enable/disable AVR inline assembly optimizations.
45 #if defined(__AVR__)
-
46 #define CURVE25519_ASM_AVR 1
-
47 #endif
-
48 
-
49 // The overhead of clean() calls in mul(), reduceQuick(), etc can
-
50 // add up to a lot of processing time during eval(). Only do such
-
51 // cleanups if strict mode has been enabled. Other implementations
-
52 // like curve25519-donna don't do any cleaning at all so the value
-
53 // of cleaning up the stack is dubious at best anyway.
-
54 #if defined(CURVE25519_STRICT_CLEAN)
-
55 #define strict_clean(x) clean(x)
-
56 #else
-
57 #define strict_clean(x) do { ; } while (0)
-
58 #endif
-
59 
-
79 bool Curve25519::eval(uint8_t result[32], const uint8_t s[32], const uint8_t x[32])
-
80 {
-
81  limb_t x_1[NUM_LIMBS_256BIT];
-
82  limb_t x_2[NUM_LIMBS_256BIT];
-
83  limb_t x_3[NUM_LIMBS_256BIT];
-
84  limb_t z_2[NUM_LIMBS_256BIT];
-
85  limb_t z_3[NUM_LIMBS_256BIT];
-
86  limb_t A[NUM_LIMBS_256BIT];
-
87  limb_t B[NUM_LIMBS_256BIT];
-
88  limb_t C[NUM_LIMBS_256BIT];
-
89  limb_t D[NUM_LIMBS_256BIT];
-
90  limb_t E[NUM_LIMBS_256BIT];
-
91  limb_t AA[NUM_LIMBS_256BIT];
-
92  limb_t BB[NUM_LIMBS_256BIT];
-
93  limb_t DA[NUM_LIMBS_256BIT];
-
94  limb_t CB[NUM_LIMBS_256BIT];
-
95  uint8_t mask;
-
96  uint8_t sposn;
-
97  uint8_t select;
-
98  uint8_t swap;
-
99  bool retval;
-
100 
-
101  // Unpack the "x" argument into the limb representation
-
102  // which also masks off the high bit. NULL means 9.
-
103  if (x) {
-
104  // x1 = x
-
105  BigNumberUtil::unpackLE(x_1, NUM_LIMBS_256BIT, x, 32);
-
106  x_1[NUM_LIMBS_256BIT - 1] &= ((((limb_t)1) << (LIMB_BITS - 1)) - 1);
-
107  } else {
-
108  memset(x_1, 0, sizeof(x_1)); // x_1 = 9
-
109  x_1[0] = 9;
-
110  }
-
111 
-
112  // Check that "x" is within the range of the modulo field.
-
113  // We can do this with a reduction - if there was no borrow
-
114  // then the value of "x" was out of range. Timing is sensitive
-
115  // here so that we don't reveal anything about the value of "x".
-
116  // If there was a reduction, then continue executing the rest
-
117  // of this function with the (now) in-range "x" value and
-
118  // report the failure at the end.
-
119  retval = (bool)(reduceQuick(x_1) & 0x01);
-
120 
-
121  // Initialize the other temporary variables.
-
122  memset(x_2, 0, sizeof(x_2)); // x_2 = 1
-
123  x_2[0] = 1;
-
124  memset(z_2, 0, sizeof(z_2)); // z_2 = 0
-
125  memcpy(x_3, x_1, sizeof(x_1)); // x_3 = x
-
126  memcpy(z_3, x_2, sizeof(x_2)); // z_3 = 1
-
127 
-
128  // Iterate over all 255 bits of "s" from the highest to the lowest.
-
129  // We ignore the high bit of the 256-bit representation of "s".
-
130  mask = 0x40;
-
131  sposn = 31;
-
132  swap = 0;
-
133  for (uint8_t t = 255; t > 0; --t) {
-
134  // Conditional swaps on entry to this bit but only if we
-
135  // didn't swap on the previous bit.
-
136  select = s[sposn] & mask;
-
137  swap ^= select;
-
138  cswap(swap, x_2, x_3);
-
139  cswap(swap, z_2, z_3);
-
140 
-
141  // Evaluate the curve.
-
142  add(A, x_2, z_2); // A = x_2 + z_2
-
143  square(AA, A); // AA = A^2
-
144  sub(B, x_2, z_2); // B = x_2 - z_2
-
145  square(BB, B); // BB = B^2
-
146  sub(E, AA, BB); // E = AA - BB
-
147  add(C, x_3, z_3); // C = x_3 + z_3
-
148  sub(D, x_3, z_3); // D = x_3 - z_3
-
149  mul(DA, D, A); // DA = D * A
-
150  mul(CB, C, B); // CB = C * B
-
151  add(x_3, DA, CB); // x_3 = (DA + CB)^2
-
152  square(x_3, x_3);
-
153  sub(z_3, DA, CB); // z_3 = x_1 * (DA - CB)^2
-
154  square(z_3, z_3);
-
155  mul(z_3, z_3, x_1);
-
156  mul(x_2, AA, BB); // x_2 = AA * BB
-
157  mulA24(z_2, E); // z_2 = E * (AA + a24 * E)
-
158  add(z_2, z_2, AA);
-
159  mul(z_2, z_2, E);
-
160 
-
161  // Move onto the next lower bit of "s".
-
162  mask >>= 1;
-
163  if (!mask) {
-
164  --sposn;
-
165  mask = 0x80;
-
166  swap = select << 7;
-
167  } else {
-
168  swap = select >> 1;
-
169  }
-
170  }
-
171 
-
172  // Final conditional swaps.
-
173  cswap(swap, x_2, x_3);
-
174  cswap(swap, z_2, z_3);
-
175 
-
176  // Compute x_2 * (z_2 ^ (p - 2)) where p = 2^255 - 19.
-
177  recip(z_3, z_2);
-
178  mul(x_2, x_2, z_3);
-
179 
-
180  // Pack the result into the return array.
-
181  BigNumberUtil::packLE(result, 32, x_2, NUM_LIMBS_256BIT);
-
182 
-
183  // Clean up and exit.
-
184  clean(x_1);
-
185  clean(x_2);
-
186  clean(x_3);
-
187  clean(z_2);
-
188  clean(z_3);
-
189  clean(A);
-
190  clean(B);
-
191  clean(C);
-
192  clean(D);
-
193  clean(E);
-
194  clean(AA);
-
195  clean(BB);
-
196  clean(DA);
-
197  clean(CB);
-
198  return retval;
-
199 }
-
200 
-
244 void Curve25519::dh1(uint8_t k[32], uint8_t f[32])
-
245 {
-
246  do {
-
247  // Generate a random "f" value and then adjust the value to make
-
248  // it valid as an "s" value for eval(). According to the specification
-
249  // we need to mask off the 3 right-most bits of f[0], mask off the
-
250  // left-most bit of f[31], and set the second to left-most bit of f[31].
-
251  RNG.rand(f, 32);
-
252  f[0] &= 0xF8;
-
253  f[31] = (f[31] & 0x7F) | 0x40;
-
254 
-
255  // Evaluate the curve function: k = Curve25519::eval(f, 9).
-
256  // We pass NULL to eval() to indicate the value 9. There is no
-
257  // need to check the return value from eval() because we know
-
258  // that 9 is a valid field element.
-
259  eval(k, f, 0);
-
260 
-
261  // If "k" is weak for contributory behaviour then reject it,
-
262  // generate another "f" value, and try again. This case is
-
263  // highly unlikely but we still perform the check just in case.
-
264  } while (isWeakPoint(k));
-
265 }
-
266 
-
282 bool Curve25519::dh2(uint8_t k[32], uint8_t f[32])
-
283 {
-
284  uint8_t weak;
-
285 
-
286  // Evaluate the curve function: k = Curve25519::eval(f, k).
-
287  // If "k" is weak for contributory behaviour before or after
-
288  // the curve evaluation, then fail the exchange. For safety
-
289  // we perform every phase of the weak checks even if we could
-
290  // bail out earlier so that the execution takes the same
-
291  // amount of time for weak and non-weak "k" values.
-
292  weak = isWeakPoint(k); // Is "k" weak before?
-
293  weak |= ((eval(k, f, k) ^ 0x01) & 0x01); // Is "k" weak during?
-
294  weak |= isWeakPoint(k); // Is "k" weak after?
-
295  clean(f, 32);
-
296  return (bool)((weak ^ 0x01) & 0x01);
-
297 }
-
298 
-
306 uint8_t Curve25519::isWeakPoint(const uint8_t k[32])
-
307 {
-
308  // List of weak points from http://cr.yp.to/ecdh.html
-
309  // That page lists some others but they are variants on these
-
310  // of the form "point + i * (2^255 - 19)" for i = 0, 1, 2.
-
311  // Here we mask off the high bit and eval() catches the rest.
-
312  static const uint8_t points[5][32] PROGMEM = {
-
313  {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-
314  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+
46 // Disabled for now - there are issues with newer Arduino compilers. FIXME
+
47 //#define CURVE25519_ASM_AVR 1
+
48 #endif
+
49 
+
50 // The overhead of clean() calls in mul(), reduceQuick(), etc can
+
51 // add up to a lot of processing time during eval(). Only do such
+
52 // cleanups if strict mode has been enabled. Other implementations
+
53 // like curve25519-donna don't do any cleaning at all so the value
+
54 // of cleaning up the stack is dubious at best anyway.
+
55 #if defined(CURVE25519_STRICT_CLEAN)
+
56 #define strict_clean(x) clean(x)
+
57 #else
+
58 #define strict_clean(x) do { ; } while (0)
+
59 #endif
+
60 
+
80 bool Curve25519::eval(uint8_t result[32], const uint8_t s[32], const uint8_t x[32])
+
81 {
+
82  limb_t x_1[NUM_LIMBS_256BIT];
+
83  limb_t x_2[NUM_LIMBS_256BIT];
+
84  limb_t x_3[NUM_LIMBS_256BIT];
+
85  limb_t z_2[NUM_LIMBS_256BIT];
+
86  limb_t z_3[NUM_LIMBS_256BIT];
+
87  limb_t A[NUM_LIMBS_256BIT];
+
88  limb_t B[NUM_LIMBS_256BIT];
+
89  limb_t C[NUM_LIMBS_256BIT];
+
90  limb_t D[NUM_LIMBS_256BIT];
+
91  limb_t E[NUM_LIMBS_256BIT];
+
92  limb_t AA[NUM_LIMBS_256BIT];
+
93  limb_t BB[NUM_LIMBS_256BIT];
+
94  limb_t DA[NUM_LIMBS_256BIT];
+
95  limb_t CB[NUM_LIMBS_256BIT];
+
96  uint8_t mask;
+
97  uint8_t sposn;
+
98  uint8_t select;
+
99  uint8_t swap;
+
100  bool retval;
+
101 
+
102  // Unpack the "x" argument into the limb representation
+
103  // which also masks off the high bit. NULL means 9.
+
104  if (x) {
+
105  // x1 = x
+
106  BigNumberUtil::unpackLE(x_1, NUM_LIMBS_256BIT, x, 32);
+
107  x_1[NUM_LIMBS_256BIT - 1] &= ((((limb_t)1) << (LIMB_BITS - 1)) - 1);
+
108  } else {
+
109  memset(x_1, 0, sizeof(x_1)); // x_1 = 9
+
110  x_1[0] = 9;
+
111  }
+
112 
+
113  // Check that "x" is within the range of the modulo field.
+
114  // We can do this with a reduction - if there was no borrow
+
115  // then the value of "x" was out of range. Timing is sensitive
+
116  // here so that we don't reveal anything about the value of "x".
+
117  // If there was a reduction, then continue executing the rest
+
118  // of this function with the (now) in-range "x" value and
+
119  // report the failure at the end.
+
120  retval = (bool)(reduceQuick(x_1) & 0x01);
+
121 
+
122  // Initialize the other temporary variables.
+
123  memset(x_2, 0, sizeof(x_2)); // x_2 = 1
+
124  x_2[0] = 1;
+
125  memset(z_2, 0, sizeof(z_2)); // z_2 = 0
+
126  memcpy(x_3, x_1, sizeof(x_1)); // x_3 = x
+
127  memcpy(z_3, x_2, sizeof(x_2)); // z_3 = 1
+
128 
+
129  // Iterate over all 255 bits of "s" from the highest to the lowest.
+
130  // We ignore the high bit of the 256-bit representation of "s".
+
131  mask = 0x40;
+
132  sposn = 31;
+
133  swap = 0;
+
134  for (uint8_t t = 255; t > 0; --t) {
+
135  // Conditional swaps on entry to this bit but only if we
+
136  // didn't swap on the previous bit.
+
137  select = s[sposn] & mask;
+
138  swap ^= select;
+
139  cswap(swap, x_2, x_3);
+
140  cswap(swap, z_2, z_3);
+
141 
+
142  // Evaluate the curve.
+
143  add(A, x_2, z_2); // A = x_2 + z_2
+
144  square(AA, A); // AA = A^2
+
145  sub(B, x_2, z_2); // B = x_2 - z_2
+
146  square(BB, B); // BB = B^2
+
147  sub(E, AA, BB); // E = AA - BB
+
148  add(C, x_3, z_3); // C = x_3 + z_3
+
149  sub(D, x_3, z_3); // D = x_3 - z_3
+
150  mul(DA, D, A); // DA = D * A
+
151  mul(CB, C, B); // CB = C * B
+
152  add(x_3, DA, CB); // x_3 = (DA + CB)^2
+
153  square(x_3, x_3);
+
154  sub(z_3, DA, CB); // z_3 = x_1 * (DA - CB)^2
+
155  square(z_3, z_3);
+
156  mul(z_3, z_3, x_1);
+
157  mul(x_2, AA, BB); // x_2 = AA * BB
+
158  mulA24(z_2, E); // z_2 = E * (AA + a24 * E)
+
159  add(z_2, z_2, AA);
+
160  mul(z_2, z_2, E);
+
161 
+
162  // Move onto the next lower bit of "s".
+
163  mask >>= 1;
+
164  if (!mask) {
+
165  --sposn;
+
166  mask = 0x80;
+
167  swap = select << 7;
+
168  } else {
+
169  swap = select >> 1;
+
170  }
+
171  }
+
172 
+
173  // Final conditional swaps.
+
174  cswap(swap, x_2, x_3);
+
175  cswap(swap, z_2, z_3);
+
176 
+
177  // Compute x_2 * (z_2 ^ (p - 2)) where p = 2^255 - 19.
+
178  recip(z_3, z_2);
+
179  mul(x_2, x_2, z_3);
+
180 
+
181  // Pack the result into the return array.
+
182  BigNumberUtil::packLE(result, 32, x_2, NUM_LIMBS_256BIT);
+
183 
+
184  // Clean up and exit.
+
185  clean(x_1);
+
186  clean(x_2);
+
187  clean(x_3);
+
188  clean(z_2);
+
189  clean(z_3);
+
190  clean(A);
+
191  clean(B);
+
192  clean(C);
+
193  clean(D);
+
194  clean(E);
+
195  clean(AA);
+
196  clean(BB);
+
197  clean(DA);
+
198  clean(CB);
+
199  return retval;
+
200 }
+
201 
+
245 void Curve25519::dh1(uint8_t k[32], uint8_t f[32])
+
246 {
+
247  do {
+
248  // Generate a random "f" value and then adjust the value to make
+
249  // it valid as an "s" value for eval(). According to the specification
+
250  // we need to mask off the 3 right-most bits of f[0], mask off the
+
251  // left-most bit of f[31], and set the second to left-most bit of f[31].
+
252  RNG.rand(f, 32);
+
253  f[0] &= 0xF8;
+
254  f[31] = (f[31] & 0x7F) | 0x40;
+
255 
+
256  // Evaluate the curve function: k = Curve25519::eval(f, 9).
+
257  // We pass NULL to eval() to indicate the value 9. There is no
+
258  // need to check the return value from eval() because we know
+
259  // that 9 is a valid field element.
+
260  eval(k, f, 0);
+
261 
+
262  // If "k" is weak for contributory behaviour then reject it,
+
263  // generate another "f" value, and try again. This case is
+
264  // highly unlikely but we still perform the check just in case.
+
265  } while (isWeakPoint(k));
+
266 }
+
267 
+
283 bool Curve25519::dh2(uint8_t k[32], uint8_t f[32])
+
284 {
+
285  uint8_t weak;
+
286 
+
287  // Evaluate the curve function: k = Curve25519::eval(f, k).
+
288  // If "k" is weak for contributory behaviour before or after
+
289  // the curve evaluation, then fail the exchange. For safety
+
290  // we perform every phase of the weak checks even if we could
+
291  // bail out earlier so that the execution takes the same
+
292  // amount of time for weak and non-weak "k" values.
+
293  weak = isWeakPoint(k); // Is "k" weak before?
+
294  weak |= ((eval(k, f, k) ^ 0x01) & 0x01); // Is "k" weak during?
+
295  weak |= isWeakPoint(k); // Is "k" weak after?
+
296  clean(f, 32);
+
297  return (bool)((weak ^ 0x01) & 0x01);
+
298 }
+
299 
+
307 uint8_t Curve25519::isWeakPoint(const uint8_t k[32])
+
308 {
+
309  // List of weak points from http://cr.yp.to/ecdh.html
+
310  // That page lists some others but they are variants on these
+
311  // of the form "point + i * (2^255 - 19)" for i = 0, 1, 2.
+
312  // Here we mask off the high bit and eval() catches the rest.
+
313  static const uint8_t points[5][32] PROGMEM = {
+
314  {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
315  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-
316  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-
317  {0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-
318  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+
316  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+
317  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
+
318  {0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
319  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-
320  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
-
321  {0xE0, 0xEB, 0x7A, 0x7C, 0x3B, 0x41, 0xB8, 0xAE,
-
322  0x16, 0x56, 0xE3, 0xFA, 0xF1, 0x9F, 0xC4, 0x6A,
-
323  0xDA, 0x09, 0x8D, 0xEB, 0x9C, 0x32, 0xB1, 0xFD,
-
324  0x86, 0x62, 0x05, 0x16, 0x5F, 0x49, 0xB8, 0x00},
-
325  {0x5F, 0x9C, 0x95, 0xBC, 0xA3, 0x50, 0x8C, 0x24,
-
326  0xB1, 0xD0, 0xB1, 0x55, 0x9C, 0x83, 0xEF, 0x5B,
-
327  0x04, 0x44, 0x5C, 0xC4, 0x58, 0x1C, 0x8E, 0x86,
-
328  0xD8, 0x22, 0x4E, 0xDD, 0xD0, 0x9F, 0x11, 0x57},
-
329  {0xEC, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
-
330  0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+
320  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+
321  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
+
322  {0xE0, 0xEB, 0x7A, 0x7C, 0x3B, 0x41, 0xB8, 0xAE,
+
323  0x16, 0x56, 0xE3, 0xFA, 0xF1, 0x9F, 0xC4, 0x6A,
+
324  0xDA, 0x09, 0x8D, 0xEB, 0x9C, 0x32, 0xB1, 0xFD,
+
325  0x86, 0x62, 0x05, 0x16, 0x5F, 0x49, 0xB8, 0x00},
+
326  {0x5F, 0x9C, 0x95, 0xBC, 0xA3, 0x50, 0x8C, 0x24,
+
327  0xB1, 0xD0, 0xB1, 0x55, 0x9C, 0x83, 0xEF, 0x5B,
+
328  0x04, 0x44, 0x5C, 0xC4, 0x58, 0x1C, 0x8E, 0x86,
+
329  0xD8, 0x22, 0x4E, 0xDD, 0xD0, 0x9F, 0x11, 0x57},
+
330  {0xEC, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
331  0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
-
332  0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F}
-
333  };
-
334 
-
335  // Check each of the weak points in turn. We perform the
-
336  // comparisons carefully so as not to reveal the value of "k"
-
337  // in the instruction timing. If "k" is indeed weak then
-
338  // we still check everything so as not to reveal which
-
339  // weak point it is.
-
340  uint8_t result = 0;
-
341  for (uint8_t posn = 0; posn < 5; ++posn) {
-
342  const uint8_t *point = points[posn];
-
343  uint8_t check = (pgm_read_byte(point + 31) ^ k[31]) & 0x7F;
-
344  for (uint8_t index = 31; index > 0; --index)
-
345  check |= (pgm_read_byte(point + index - 1) ^ k[index - 1]);
-
346  result |= (uint8_t)((((uint16_t)0x0100) - check) >> 8);
-
347  }
-
348 
-
349  // The "result" variable will be non-zero if there was a match.
-
350  return result;
-
351 }
-
352 
-
365 void Curve25519::reduce(limb_t *result, limb_t *x, uint8_t size)
-
366 {
-
367  /*
-
368  Note: This explaination is best viewed with a UTF-8 text viewer.
-
369 
-
370  To help explain what this function is doing, the following describes
-
371  how to efficiently compute reductions modulo a base of the form (2ⁿ - b)
-
372  where b is greater than zero and (b + 1)² <= 2ⁿ.
-
373 
-
374  Here we are interested in reducing the result of multiplying two
-
375  numbers that are less than or equal to (2ⁿ - b - 1). That is,
-
376  multiplying numbers that have already been reduced.
-
377 
-
378  Given some x less than or equal to (2ⁿ - b - 1)², we want to find a
-
379  y less than (2ⁿ - b) such that:
-
380 
-
381  y ≡ x mod (2ⁿ - b)
-
382 
-
383  We know that for all integer values of k >= 0:
-
384 
-
385  y ≡ x - k * (2ⁿ - b)
-
386  ≡ x - k * 2ⁿ + k * b
-
387 
-
388  In our case we choose k = ⌊x / 2ⁿ⌋ and then let:
-
389 
-
390  w = (x mod 2ⁿ) + ⌊x / 2ⁿ⌋ * b
-
391 
-
392  The value w will either be the answer y or y can be obtained by
-
393  repeatedly subtracting (2ⁿ - b) from w until it is less than (2ⁿ - b).
-
394  At most b subtractions will be required.
-
395 
-
396  In our case b is 19 which is more subtractions than we would like to do,
-
397  but we can handle that by performing the above reduction twice and then
-
398  performing a single trial subtraction:
-
399 
-
400  w = (x mod 2ⁿ) + ⌊x / 2ⁿ⌋ * b
-
401  y = (w mod 2ⁿ) + ⌊w / 2ⁿ⌋ * b
-
402  if y >= (2ⁿ - b)
-
403  y -= (2ⁿ - b)
-
404 
-
405  The value y is the answer we want for reducing x modulo (2ⁿ - b).
-
406  */
-
407 
-
408 #if !defined(CURVE25519_ASM_AVR)
-
409  dlimb_t carry;
-
410  uint8_t posn;
-
411 
-
412  // Calculate (x mod 2^255) + ((x / 2^255) * 19) which will
-
413  // either produce the answer we want or it will produce a
-
414  // value of the form "answer + j * (2^255 - 19)".
-
415  carry = ((dlimb_t)(x[NUM_LIMBS_256BIT - 1] >> (LIMB_BITS - 1))) * 19U;
-
416  x[NUM_LIMBS_256BIT - 1] &= ((((limb_t)1) << (LIMB_BITS - 1)) - 1);
-
417  for (posn = 0; posn < size; ++posn) {
-
418  carry += ((dlimb_t)(x[posn + NUM_LIMBS_256BIT])) * 38U;
-
419  carry += x[posn];
-
420  x[posn] = (limb_t)carry;
-
421  carry >>= LIMB_BITS;
-
422  }
-
423  if (size < NUM_LIMBS_256BIT) {
-
424  // The high order half of the number is short; e.g. for mulA24().
-
425  // Propagate the carry through the rest of the low order part.
-
426  for (posn = size; posn < NUM_LIMBS_256BIT; ++posn) {
-
427  carry += x[posn];
-
428  x[posn] = (limb_t)carry;
-
429  carry >>= LIMB_BITS;
-
430  }
-
431  }
-
432 
-
433  // The "j" value may still be too large due to the final carry-out.
-
434  // We must repeat the reduction. If we already have the answer,
-
435  // then this won't do any harm but we must still do the calculation
-
436  // to preserve the overall timing.
-
437  carry *= 38U;
-
438  carry += ((dlimb_t)(x[NUM_LIMBS_256BIT - 1] >> (LIMB_BITS - 1))) * 19U;
-
439  x[NUM_LIMBS_256BIT - 1] &= ((((limb_t)1) << (LIMB_BITS - 1)) - 1);
-
440  for (posn = 0; posn < NUM_LIMBS_256BIT; ++posn) {
-
441  carry += x[posn];
-
442  x[posn] = (limb_t)carry;
-
443  carry >>= LIMB_BITS;
-
444  }
-
445 
-
446  // At this point "x" will either be the answer or it will be the
-
447  // answer plus (2^255 - 19). Perform a trial subtraction which
-
448  // is equivalent to adding 19 and subtracting 2^255. We put the
-
449  // trial answer into the top-most limbs of the original "x" array.
-
450  // We add 19 here; the subtraction of 2^255 occurs in the next step.
-
451  carry = 19U;
-
452  for (posn = 0; posn < NUM_LIMBS_256BIT; ++posn) {
-
453  carry += x[posn];
-
454  x[posn + NUM_LIMBS_256BIT] = (limb_t)carry;
-
455  carry >>= LIMB_BITS;
-
456  }
-
457 
-
458  // If there was a borrow, then the bottom-most limbs of "x" are the
-
459  // correct answer. If there was no borrow, then the top-most limbs
-
460  // of "x" are the correct answer. Select the correct answer but do
-
461  // it in a way that instruction timing will not reveal which value
-
462  // was selected. Borrow will occur if the high bit of the previous
-
463  // result is 0: turn the high bit into a selection mask.
-
464  limb_t mask = (limb_t)(((slimb_t)(x[NUM_LIMBS_512BIT - 1])) >> (LIMB_BITS - 1));
-
465  limb_t nmask = ~mask;
-
466  x[NUM_LIMBS_512BIT - 1] &= ((((limb_t)1) << (LIMB_BITS - 1)) - 1);
-
467  for (posn = 0; posn < NUM_LIMBS_256BIT; ++posn) {
-
468  result[posn] = (x[posn] & nmask) | (x[posn + NUM_LIMBS_256BIT] & mask);
-
469  }
-
470 #else
-
471  __asm__ __volatile__ (
-
472  // Calculate (x mod 2^255) + ((x / 2^255) * 19) which will
-
473  // either produce the answer we want or it will produce a
-
474  // value of the form "answer + j * (2^255 - 19)".
-
475  "ldd r24,Z+31\n" // Extract the high bit of x[31]
-
476  "mov r25,r24\n" // and mask it off
-
477  "andi r25,0x7F\n"
-
478  "std Z+31,r25\n"
-
479  "lsl r24\n" // carry = high bit * 19
-
480  "mov r24,__zero_reg__\n"
-
481  "sbc r24,__zero_reg__\n"
-
482  "andi r24,19\n"
-
483 
-
484  "mov r25,%1\n" // load "size" into r25
-
485  "ldi r23,38\n" // r23 = 38
-
486  "mov r22,__zero_reg__\n" // r22 = 0 (we're about to destroy r1)
-
487  "1:\n"
-
488  "ld r16,Z\n" // r16 = x[0]
-
489  "ldd r17,Z+32\n" // r17 = x[32]
-
490  "mul r17,r23\n" // r0:r1 = r17 * 38
-
491  "add r0,r24\n" // r0:r1 += carry
-
492  "adc r1,r22\n"
-
493  "add r0,r16\n" // r0:r1 += r16
-
494  "adc r1,r22\n"
-
495  "st Z+,r0\n" // *x++ = r0
-
496  "mov r24,r1\n" // carry = r1
-
497  "dec r25\n" // if (--r25 != 0) loop
-
498  "brne 1b\n"
-
499 
-
500  // If the size is short, then we need to continue propagating carries.
-
501  "ldi r25,32\n"
-
502  "cp %1,r25\n"
-
503  "breq 3f\n"
-
504  "sub r25,%1\n"
-
505  "ld __tmp_reg__,Z\n"
-
506  "add __tmp_reg__,r24\n"
-
507  "st Z+,__tmp_reg__\n"
-
508  "dec r25\n"
-
509  "2:\n"
-
510  "ld __tmp_reg__,Z\n" // *x++ += carry
-
511  "adc __tmp_reg__,r22\n"
-
512  "st Z+,__tmp_reg__\n"
-
513  "dec r25\n"
-
514  "brne 2b\n"
-
515  "mov r24,r22\n" // put the carry back into r24
-
516  "adc r24,r22\n"
-
517  "3:\n"
-
518  "sbiw r30,32\n" // Point Z back to the start of "x"
-
519 
-
520  // The "j" value may still be too large due to the final carry-out.
-
521  // We must repeat the reduction. If we already have the answer,
-
522  // then this won't do any harm but we must still do the calculation
-
523  // to preserve the overall timing.
-
524  "mul r24,r23\n" // carry *= 38
-
525  "ldd r24,Z+31\n" // Extract the high bit of x[31]
-
526  "mov r25,r24\n" // and mask it off
-
527  "andi r25,0x7F\n"
-
528  "std Z+31,r25\n"
-
529  "lsl r24\n" // carry += high bit * 19
-
530  "mov r24,r22\n"
-
531  "sbc r24,r22\n"
-
532  "andi r24,19\n"
-
533  "add r0,r24\n"
-
534  "adc r1,r22\n" // 9-bit carry is now in r0:r1
-
535 
-
536  // Propagate the carry through the rest of x.
-
537  "ld r24,Z\n" // x[0]
-
538  "add r0,r24\n"
-
539  "adc r1,r22\n"
-
540  "st Z+,r0\n"
-
541  "ld r24,Z\n" // x[1]
-
542  "add r1,r24\n"
-
543  "st Z+,r1\n"
-
544  "ldi r25,30\n" // x[2..31]
-
545  "4:\n"
-
546  "ld r24,Z\n"
-
547  "adc r24,r22\n"
-
548  "st Z+,r24\n"
-
549  "dec r25\n"
-
550  "brne 4b\n"
-
551  "sbiw r30,32\n" // Point Z back to the start of "x"
-
552 
-
553  // We destroyed __zero_reg__ (r1) above, so restore its zero value.
-
554  "mov __zero_reg__,r22\n"
-
555 
-
556  // At this point "x" will either be the answer or it will be the
-
557  // answer plus (2^255 - 19). Perform a trial subtraction which
-
558  // is equivalent to adding 19 and subtracting 2^255. We put the
-
559  // trial answer into the top-most limbs of the original "x" array.
-
560  // We add 19 here; the subtraction of 2^255 occurs in the next step.
-
561  "ldi r24,8\n" // Loop counter.
-
562  "ldi r25,19\n" // carry = 19
-
563  "5:\n"
-
564  "ld r16,Z+\n" // r16:r19:carry = *xx++ + carry
-
565  "ld r17,Z+\n"
-
566  "ld r18,Z+\n"
-
567  "ld r19,Z+\n"
-
568  "add r16,r25\n" // r16:r19:carry += carry
-
569  "adc r17,__zero_reg__\n"
-
570  "adc r18,__zero_reg__\n"
-
571  "adc r19,__zero_reg__\n"
-
572  "mov r25,__zero_reg__\n"
-
573  "adc r25,r25\n"
-
574  "std Z+28,r16\n" // *tt++ = r16:r19
-
575  "std Z+29,r17\n"
-
576  "std Z+30,r18\n"
-
577  "std Z+31,r19\n"
-
578  "dec r24\n"
-
579  "brne 5b\n"
-
580 
-
581  // Subtract 2^255 from x[32..63] which is equivalent to extracting
-
582  // the top bit and then masking it off. If the top bit is zero
-
583  // then a borrow has occurred and this isn't the answer we want.
-
584  "mov r25,r19\n"
-
585  "andi r19,0x7F\n"
-
586  "std Z+31,r19\n"
-
587  "lsl r25\n"
-
588  "mov r25,__zero_reg__\n"
-
589  "sbc r25,__zero_reg__\n"
-
590 
-
591  // At this point, r25 is 0 if the original x[0..31] is the answer
-
592  // we want, or 0xFF if x[32..63] is the answer we want. Essentially
-
593  // we need to do a conditional move of either x[0..31] or x[32..63]
-
594  // into "result".
-
595  "sbiw r30,32\n" // Point Z back to x[0].
-
596  "ldi r24,8\n"
-
597  "6:\n"
-
598  "ldd r16,Z+32\n"
-
599  "ldd r17,Z+33\n"
-
600  "ldd r18,Z+34\n"
-
601  "ldd r19,Z+35\n"
-
602  "ld r20,Z+\n"
-
603  "ld r21,Z+\n"
-
604  "ld r22,Z+\n"
-
605  "ld r23,Z+\n"
-
606  "eor r16,r20\n"
-
607  "eor r17,r21\n"
-
608  "eor r18,r22\n"
-
609  "eor r19,r23\n"
-
610  "and r16,r25\n"
-
611  "and r17,r25\n"
-
612  "and r18,r25\n"
-
613  "and r19,r25\n"
-
614  "eor r20,r16\n"
-
615  "eor r21,r17\n"
-
616  "eor r22,r18\n"
-
617  "eor r23,r19\n"
-
618  "st X+,r20\n"
-
619  "st X+,r21\n"
-
620  "st X+,r22\n"
-
621  "st X+,r23\n"
-
622  "dec r24\n"
-
623  "brne 6b\n"
-
624 
-
625  : : "z"(x), "r"((uint8_t)(size * sizeof(limb_t))), "x"(result)
-
626  : "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23",
-
627  "r24", "r25"
-
628  );
-
629 #endif
-
630 }
-
631 
-
645 limb_t Curve25519::reduceQuick(limb_t *x)
-
646 {
-
647 #if !defined(CURVE25519_ASM_AVR)
-
648  limb_t temp[NUM_LIMBS_256BIT];
-
649  dlimb_t carry;
-
650  uint8_t posn;
-
651  limb_t *xx;
-
652  limb_t *tt;
-
653 
-
654  // Perform a trial subtraction of (2^255 - 19) from "x" which is
-
655  // equivalent to adding 19 and subtracting 2^255. We add 19 here;
-
656  // the subtraction of 2^255 occurs in the next step.
-
657  carry = 19U;
-
658  xx = x;
-
659  tt = temp;
-
660  for (posn = 0; posn < NUM_LIMBS_256BIT; ++posn) {
-
661  carry += *xx++;
-
662  *tt++ = (limb_t)carry;
-
663  carry >>= LIMB_BITS;
-
664  }
-
665 
-
666  // If there was a borrow, then the original "x" is the correct answer.
-
667  // If there was no borrow, then "temp" is the correct answer. Select the
-
668  // correct answer but do it in a way that instruction timing will not
-
669  // reveal which value was selected. Borrow will occur if the high bit
-
670  // of "temp" is 0: turn the high bit into a selection mask.
-
671  limb_t mask = (limb_t)(((slimb_t)(temp[NUM_LIMBS_256BIT - 1])) >> (LIMB_BITS - 1));
-
672  limb_t nmask = ~mask;
-
673  temp[NUM_LIMBS_256BIT - 1] &= ((((limb_t)1) << (LIMB_BITS - 1)) - 1);
-
674  xx = x;
-
675  tt = temp;
-
676  for (posn = 0; posn < NUM_LIMBS_256BIT; ++posn) {
-
677  *xx = ((*xx) & nmask) | ((*tt++) & mask);
-
678  ++xx;
-
679  }
-
680 
-
681  // Clean up "temp".
-
682  strict_clean(temp);
-
683 
-
684  // Return a zero value if we actually subtracted (2^255 - 19) from "x".
-
685  return nmask;
-
686 #else // CURVE25519_ASM_AVR
-
687  limb_t temp[NUM_LIMBS_256BIT];
-
688  uint8_t result;
-
689  __asm__ __volatile__ (
-
690  // Subtract (2^255 - 19) from "x", which is the same as adding 19
-
691  // and then subtracting 2^255.
-
692  "ldi r24,8\n" // Loop counter.
-
693  "ldi r25,19\n" // carry = 19
-
694  "1:\n"
-
695  "ld r16,Z+\n" // r16:r19:carry = *xx++ + carry
-
696  "ld r17,Z+\n"
-
697  "ld r18,Z+\n"
-
698  "ld r19,Z+\n"
-
699  "add r16,r25\n" // r16:r19:carry += carry
-
700  "adc r17,__zero_reg__\n"
-
701  "adc r18,__zero_reg__\n"
-
702  "adc r19,__zero_reg__\n"
-
703  "mov r25,__zero_reg__\n"
-
704  "adc r25,r25\n"
-
705  "st X+,r16\n" // *tt++ = r16:r19
-
706  "st X+,r17\n"
-
707  "st X+,r18\n"
-
708  "st X+,r19\n"
-
709  "dec r24\n"
-
710  "brne 1b\n"
-
711 
-
712  // Subtract 2^255 from "temp" which is equivalent to extracting
-
713  // the top bit and then masking it off. If the top bit is zero
-
714  // then a borrow has occurred and this isn't the answer we want.
-
715  "mov r25,r19\n"
-
716  "andi r19,0x7F\n"
-
717  "st -X,r19\n"
-
718  "lsl r25\n"
-
719  "mov r25,__zero_reg__\n"
-
720  "sbc r25,__zero_reg__\n"
-
721 
-
722  // At this point, r25 is 0 if the original "x" is the answer
-
723  // we want, or 0xFF if "temp" is the answer we want. Essentially
-
724  // we need to do a conditional move of "temp" into "x".
-
725  "sbiw r26,31\n" // Point X back to the start of "temp".
-
726  "sbiw r30,32\n" // Point Z back to the start of "x".
-
727  "ldi r24,8\n"
-
728  "2:\n"
-
729  "ld r16,X+\n"
-
730  "ld r17,X+\n"
-
731  "ld r18,X+\n"
-
732  "ld r19,X+\n"
-
733  "ld r20,Z\n"
-
734  "ldd r21,Z+1\n"
-
735  "ldd r22,Z+2\n"
-
736  "ldd r23,Z+3\n"
-
737  "eor r16,r20\n"
-
738  "eor r17,r21\n"
-
739  "eor r18,r22\n"
-
740  "eor r19,r23\n"
-
741  "and r16,r25\n"
-
742  "and r17,r25\n"
-
743  "and r18,r25\n"
-
744  "and r19,r25\n"
-
745  "eor r20,r16\n"
-
746  "eor r21,r17\n"
-
747  "eor r22,r18\n"
-
748  "eor r23,r19\n"
-
749  "st Z+,r20\n"
-
750  "st Z+,r21\n"
-
751  "st Z+,r22\n"
-
752  "st Z+,r23\n"
-
753  "dec r24\n"
-
754  "brne 2b\n"
-
755  "mov %0,r25\n"
-
756  : "=r"(result)
-
757  : "x"(temp), "z"(x)
-
758  : "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23",
-
759  "r24", "r25"
-
760  );
-
761  strict_clean(temp);
-
762  return result;
-
763 #endif // CURVE25519_ASM_AVR
-
764 }
-
765 
-
778 void Curve25519::mulNoReduce(limb_t *result, const limb_t *x, const limb_t *y)
-
779 {
-
780 #if !defined(CURVE25519_ASM_AVR)
-
781  uint8_t i, j;
-
782  dlimb_t carry;
-
783  limb_t word;
-
784  const limb_t *yy;
-
785  limb_t *rr;
-
786 
-
787  // Multiply the lowest word of x by y.
-
788  carry = 0;
-
789  word = x[0];
-
790  yy = y;
-
791  rr = result;
-
792  for (i = 0; i < NUM_LIMBS_256BIT; ++i) {
-
793  carry += ((dlimb_t)(*yy++)) * word;
-
794  *rr++ = (limb_t)carry;
-
795  carry >>= LIMB_BITS;
-
796  }
-
797  *rr = (limb_t)carry;
-
798 
-
799  // Multiply and add the remaining words of x by y.
-
800  for (i = 1; i < NUM_LIMBS_256BIT; ++i) {
-
801  word = x[i];
-
802  carry = 0;
-
803  yy = y;
-
804  rr = result + i;
-
805  for (j = 0; j < NUM_LIMBS_256BIT; ++j) {
-
806  carry += ((dlimb_t)(*yy++)) * word;
-
807  carry += *rr;
-
808  *rr++ = (limb_t)carry;
-
809  carry >>= LIMB_BITS;
-
810  }
-
811  *rr = (limb_t)carry;
-
812  }
-
813 #else
-
814  __asm__ __volatile__ (
-
815  // Save Y and copy the "result" pointer into it.
-
816  "push r28\n"
-
817  "push r29\n"
-
818  "mov r28,%A2\n"
-
819  "mov r29,%B2\n"
-
820 
-
821  // Multiply the first byte of "x" by y[0..31].
-
822  "ldi r25,8\n" // loop 8 times: 4 bytes of y each time
-
823  "clr r24\n" // carry = 0
-
824  "clr r22\n" // r22 = 0 to replace __zero_reg__
-
825  "ld r23,X+\n" // r23 = *x++
-
826  "1:\n"
-
827  "ld r16,Z\n" // r16 = y[0]
-
828  "mul r16,r23\n" // r8:r9 = y[0] * r23
-
829  "movw r8,r0\n"
-
830  "ldd r16,Z+2\n" // r16 = y[2]
-
831  "mul r16,r23\n" // r10:r11 = y[2] * r23
-
832  "movw r10,r0\n"
-
833  "ldd r16,Z+1\n" // r16 = y[1]
-
834  "mul r16,r23\n" // r9:r10:r11 += y[1] * r23
-
835  "add r9,r0\n"
-
836  "adc r10,r1\n"
-
837  "adc r11,r22\n"
-
838  "ldd r16,Z+3\n" // r16 = y[3]
-
839  "mul r16,r23\n" // r11:r1 += y[3] * r23
-
840  "add r11,r0\n"
-
841  "adc r1,r22\n"
-
842  "add r8,r24\n" // r8:r9:r10:r11:r1 += carry
-
843  "adc r9,r22\n"
-
844  "adc r10,r22\n"
-
845  "adc r11,r22\n"
-
846  "adc r1,r22\n"
-
847  "mov r24,r1\n" // carry = r1
-
848  "st Y+,r8\n" // *rr++ = r8:r9:r10:r11
-
849  "st Y+,r9\n"
-
850  "st Y+,r10\n"
-
851  "st Y+,r11\n"
-
852  "adiw r30,4\n"
-
853  "dec r25\n"
-
854  "brne 1b\n"
-
855  "st Y+,r24\n" // *rr++ = carry
-
856  "sbiw r28,32\n" // rr -= 32
-
857  "sbiw r30,32\n" // Point Z back to the start of y
-
858 
-
859  // Multiply and add the remaining bytes of "x" by y[0..31].
-
860  "ldi r21,31\n" // 31 more bytes of x to go.
-
861  "2:\n"
-
862  "ldi r25,8\n" // loop 8 times: 4 bytes of y each time
-
863  "clr r24\n" // carry = 0
-
864  "ld r23,X+\n" // r23 = *x++
-
865  "3:\n"
-
866  "ld r16,Z\n" // r16 = y[0]
-
867  "mul r16,r23\n" // r8:r9 = y[0] * r23
-
868  "movw r8,r0\n"
-
869  "ldd r16,Z+2\n" // r16 = y[2]
-
870  "mul r16,r23\n" // r10:r11 = y[2] * r23
-
871  "movw r10,r0\n"
-
872  "ldd r16,Z+1\n" // r16 = y[1]
-
873  "mul r16,r23\n" // r9:r10:r11 += y[1] * r23
-
874  "add r9,r0\n"
-
875  "adc r10,r1\n"
-
876  "adc r11,r22\n"
-
877  "ldd r16,Z+3\n" // r16 = y[3]
-
878  "mul r16,r23\n" // r11:r1 += y[3] * r23
-
879  "add r11,r0\n"
-
880  "adc r1,r22\n"
-
881  "add r8,r24\n" // r8:r9:r10:r11:r1 += carry
-
882  "adc r9,r22\n"
-
883  "adc r10,r22\n"
-
884  "adc r11,r22\n"
-
885  "adc r1,r22\n"
-
886  "ld r16,Y\n" // r8:r9:r10:r11:r1 += rr[0..3]
-
887  "add r8,r16\n"
-
888  "ldd r16,Y+1\n"
-
889  "adc r9,r16\n"
-
890  "ldd r16,Y+2\n"
-
891  "adc r10,r16\n"
-
892  "ldd r16,Y+3\n"
-
893  "adc r11,r16\n"
-
894  "adc r1,r22\n"
-
895  "mov r24,r1\n" // carry = r1
-
896  "st Y+,r8\n" // *rr++ = r8:r9:r10:r11
-
897  "st Y+,r9\n"
-
898  "st Y+,r10\n"
-
899  "st Y+,r11\n"
-
900  "adiw r30,4\n"
-
901  "dec r25\n"
-
902  "brne 3b\n"
-
903  "st Y+,r24\n" // *r++ = carry
-
904  "sbiw r28,32\n" // rr -= 32
-
905  "sbiw r30,32\n" // Point Z back to the start of y
-
906  "dec r21\n"
-
907  "brne 2b\n"
-
908 
-
909  // Restore Y and __zero_reg__.
-
910  "pop r29\n"
-
911  "pop r28\n"
-
912  "clr __zero_reg__\n"
-
913  : : "x"(x), "z"(y), "r"(result)
-
914  : "r8", "r9", "r10", "r11", "r16", "r20", "r21", "r22",
-
915  "r23", "r24", "r25"
-
916  );
-
917 #endif
-
918 }
-
919 
-
930 void Curve25519::mul(limb_t *result, const limb_t *x, const limb_t *y)
-
931 {
-
932  limb_t temp[NUM_LIMBS_512BIT];
-
933  mulNoReduce(temp, x, y);
-
934  reduce(result, temp, NUM_LIMBS_256BIT);
-
935  strict_clean(temp);
-
936 }
-
937 
-
957 void Curve25519::mulA24(limb_t *result, const limb_t *x)
-
958 {
-
959 #if !defined(CURVE25519_ASM_AVR)
-
960  // The constant a24 = 121665 (0x1DB41) as a limb array.
-
961 #if BIGNUMBER_LIMB_8BIT
-
962  static limb_t const a24[3] PROGMEM = {0x41, 0xDB, 0x01};
-
963 #elif BIGNUMBER_LIMB_16BIT
-
964  static limb_t const a24[2] PROGMEM = {0xDB41, 0x0001};
-
965 #elif BIGNUMBER_LIMB_32BIT || BIGNUMBER_LIMB_64BIT
-
966  static limb_t const a24[1] PROGMEM = {0x0001DB41};
-
967 #else
-
968  #error "limb_t must be 8, 16, 32, or 64 bits in size"
-
969 #endif
-
970  #define NUM_A24_LIMBS (sizeof(a24) / sizeof(limb_t))
-
971 
-
972  // Multiply the lowest limb of a24 by x and zero-extend into the result.
-
973  limb_t temp[NUM_LIMBS_512BIT];
-
974  uint8_t i, j;
-
975  dlimb_t carry = 0;
-
976  limb_t word = pgm_read_limb(&(a24[0]));
-
977  const limb_t *xx = x;
-
978  limb_t *tt = temp;
-
979  for (i = 0; i < NUM_LIMBS_256BIT; ++i) {
-
980  carry += ((dlimb_t)(*xx++)) * word;
-
981  *tt++ = (limb_t)carry;
-
982  carry >>= LIMB_BITS;
-
983  }
-
984  *tt = (limb_t)carry;
-
985 
-
986  // Multiply and add the remaining limbs of a24.
-
987  for (i = 1; i < NUM_A24_LIMBS; ++i) {
-
988  word = pgm_read_limb(&(a24[i]));
-
989  carry = 0;
-
990  xx = x;
-
991  tt = temp + i;
-
992  for (j = 0; j < NUM_LIMBS_256BIT; ++j) {
-
993  carry += ((dlimb_t)(*xx++)) * word;
-
994  carry += *tt;
-
995  *tt++ = (limb_t)carry;
-
996  carry >>= LIMB_BITS;
-
997  }
-
998  *tt = (limb_t)carry;
-
999  }
-
1000 #else
-
1001  limb_t temp[NUM_LIMBS_512BIT];
-
1002  #define NUM_A24_LIMBS ((3 + sizeof(limb_t) - 1) / sizeof(limb_t))
-
1003  __asm__ __volatile__ (
-
1004  // Load the two low bytes of a24 into r16 and r17.
-
1005  // The third byte is 0x01 which we can deal with implicitly.
-
1006  "ldi r16,0x41\n"
-
1007  "ldi r17,0xDB\n"
-
1008 
-
1009  // Iterate over the bytes of "x" and multiply each with a24.
-
1010  "ldi r25,32\n" // 32 bytes in "x"
-
1011  "clr r22\n" // r22 = 0
-
1012  "clr r18\n" // r18:r19:r11 = 0 (carry)
-
1013  "clr r19\n"
-
1014  "clr r11\n"
-
1015  "1:\n"
-
1016  "ld r21,X+\n" // r21 = *x++
-
1017  "mul r21,r16\n" // r8:r9 = r21 * a24[0]
-
1018  "movw r8,r0\n"
-
1019  "mul r21,r17\n" // r9:r1 += r21 * a24[1]
-
1020  "add r9,r0\n"
-
1021  "adc r1,r21\n" // r1:r10 += r21 * a24[2] (implicitly 1)
-
1022  "mov r10,r22\n"
-
1023  "adc r10,r22\n"
-
1024  "add r8,r18\n" // r8:r9:r1:r10 += carry
-
1025  "adc r9,r19\n"
-
1026  "adc r1,r11\n"
-
1027  "adc r10,r22\n"
-
1028  "st Z+,r8\n" // *tt++ = r8
-
1029  "mov r18,r9\n" // carry = r9:r1:r10
-
1030  "mov r19,r1\n"
-
1031  "mov r11,r10\n"
-
1032  "dec r25\n"
-
1033  "brne 1b\n"
-
1034  "st Z,r18\n" // *tt = carry
-
1035  "std Z+1,r19\n"
-
1036  "std Z+2,r11\n"
-
1037 #if BIGNUMBER_LIMB_16BIT || BIGNUMBER_LIMB_32BIT
-
1038  "std Z+3,r22\n" // Zero pad to a limb boundary
-
1039 #endif
-
1040 
-
1041  // Restore __zero_reg__
-
1042  "clr __zero_reg__\n"
-
1043 
-
1044  : : "x"(x), "z"(temp)
-
1045  : "r8", "r9", "r10", "r11", "r16", "r17", "r18", "r19",
-
1046  "r20", "r21", "r22", "r25"
-
1047  );
-
1048 #endif
-
1049 
-
1050  // Reduce the intermediate result modulo 2^255 - 19.
-
1051  reduce(result, temp, NUM_A24_LIMBS);
-
1052  strict_clean(temp);
-
1053 }
-
1054 
-
1066 void Curve25519::mul_P(limb_t *result, const limb_t *x, const limb_t *y)
-
1067 {
-
1068  limb_t temp[NUM_LIMBS_512BIT];
-
1069  uint8_t i, j;
-
1070  dlimb_t carry;
-
1071  limb_t word;
-
1072  const limb_t *xx;
-
1073  limb_t *tt;
-
1074 
-
1075  // Multiply the lowest word of y by x.
-
1076  carry = 0;
-
1077  word = pgm_read_limb(&(y[0]));
-
1078  xx = x;
-
1079  tt = temp;
-
1080  for (i = 0; i < NUM_LIMBS_256BIT; ++i) {
-
1081  carry += ((dlimb_t)(*xx++)) * word;
-
1082  *tt++ = (limb_t)carry;
-
1083  carry >>= LIMB_BITS;
-
1084  }
-
1085  *tt = (limb_t)carry;
-
1086 
-
1087  // Multiply and add the remaining words of y by x.
-
1088  for (i = 1; i < NUM_LIMBS_256BIT; ++i) {
-
1089  word = pgm_read_limb(&(y[i]));
-
1090  carry = 0;
-
1091  xx = x;
-
1092  tt = temp + i;
-
1093  for (j = 0; j < NUM_LIMBS_256BIT; ++j) {
-
1094  carry += ((dlimb_t)(*xx++)) * word;
-
1095  carry += *tt;
-
1096  *tt++ = (limb_t)carry;
-
1097  carry >>= LIMB_BITS;
-
1098  }
-
1099  *tt = (limb_t)carry;
-
1100  }
-
1101 
-
1102  // Reduce the intermediate result modulo 2^255 - 19.
-
1103  reduce(result, temp, NUM_LIMBS_256BIT);
-
1104  strict_clean(temp);
-
1105 }
-
1106 
-
1117 void Curve25519::add(limb_t *result, const limb_t *x, const limb_t *y)
-
1118 {
-
1119 #if !defined(CURVE25519_ASM_AVR)
-
1120  dlimb_t carry = 0;
-
1121  uint8_t posn;
-
1122  limb_t *rr = result;
-
1123 
-
1124  // Add the two arrays to obtain the intermediate result.
-
1125  for (posn = 0; posn < NUM_LIMBS_256BIT; ++posn) {
-
1126  carry += *x++;
-
1127  carry += *y++;
-
1128  *rr++ = (limb_t)carry;
-
1129  carry >>= LIMB_BITS;
-
1130  }
-
1131 #else // CURVE25519_ASM_AVR
-
1132  __asm__ __volatile__ (
-
1133  // Save Y and copy the "result" pointer into it.
-
1134  "push r28\n"
-
1135  "push r29\n"
-
1136  "mov r28,%A2\n"
-
1137  "mov r29,%B2\n"
-
1138 
-
1139  // Unroll the loop to operate on 4 bytes at a time (8 iterations).
-
1140  "ldi r24,8\n" // Loop counter.
-
1141  "clr r25\n" // carry = 0
-
1142  "1:\n"
-
1143  "ld r16,X+\n" // r16:r19 = *x++
-
1144  "ld r17,X+\n"
-
1145  "ld r18,X+\n"
-
1146  "ld r19,X+\n"
-
1147  "ld r20,Z+\n" // r20:r23 = *y++
-
1148  "ld r21,Z+\n"
-
1149  "ld r22,Z+\n"
-
1150  "ld r23,Z+\n"
-
1151  "add r16,r25\n" // r16:r19:carry += carry
-
1152  "adc r17,__zero_reg__\n"
-
1153  "adc r18,__zero_reg__\n"
-
1154  "adc r19,__zero_reg__\n"
-
1155  "mov r25,__zero_reg__\n"
-
1156  "adc r25,r25\n"
-
1157  "add r16,r20\n" // r16:r19:carry += r20:r23
-
1158  "adc r17,r21\n"
-
1159  "adc r18,r22\n"
-
1160  "adc r19,r23\n"
-
1161  "adc r25,__zero_reg__\n"
-
1162  "st Y+,r16\n" // *rr++ = r16:r23
-
1163  "st Y+,r17\n"
-
1164  "st Y+,r18\n"
-
1165  "st Y+,r19\n"
-
1166  "dec r24\n"
-
1167  "brne 1b\n"
-
1168 
-
1169  // Restore Y.
-
1170  "pop r29\n"
-
1171  "pop r28\n"
-
1172  : : "x"(x), "z"(y), "r"(result)
-
1173  : "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23",
-
1174  "r24", "r25"
-
1175  );
-
1176 #endif // CURVE25519_ASM_AVR
-
1177 
-
1178  // Reduce the result using the quick trial subtraction method.
-
1179  reduceQuick(result);
-
1180 }
-
1181 
-
1192 void Curve25519::sub(limb_t *result, const limb_t *x, const limb_t *y)
-
1193 {
-
1194 #if !defined(CURVE25519_ASM_AVR)
-
1195  dlimb_t borrow;
-
1196  uint8_t posn;
-
1197  limb_t *rr = result;
-
1198 
-
1199  // Subtract y from x to generate the intermediate result.
-
1200  borrow = 0;
-
1201  for (posn = 0; posn < NUM_LIMBS_256BIT; ++posn) {
-
1202  borrow = ((dlimb_t)(*x++)) - (*y++) - ((borrow >> LIMB_BITS) & 0x01);
-
1203  *rr++ = (limb_t)borrow;
-
1204  }
-
1205 
-
1206  // If we had a borrow, then the result has gone negative and we
-
1207  // have to add 2^255 - 19 to the result to make it positive again.
-
1208  // The top bits of "borrow" will be all 1's if there is a borrow
-
1209  // or it will be all 0's if there was no borrow. Easiest is to
-
1210  // conditionally subtract 19 and then mask off the high bit.
-
1211  rr = result;
-
1212  borrow = (borrow >> LIMB_BITS) & 19U;
-
1213  borrow = ((dlimb_t)(*rr)) - borrow;
-
1214  *rr++ = (limb_t)borrow;
-
1215  for (posn = 1; posn < NUM_LIMBS_256BIT; ++posn) {
-
1216  borrow = ((dlimb_t)(*rr)) - ((borrow >> LIMB_BITS) & 0x01);
-
1217  *rr++ = (limb_t)borrow;
-
1218  }
-
1219  *(--rr) &= ((((limb_t)1) << (LIMB_BITS - 1)) - 1);
-
1220 #else // CURVE25519_ASM_AVR
-
1221  __asm__ __volatile__ (
-
1222  // Save Y and copy the "result" pointer into it.
-
1223  "push r28\n"
-
1224  "push r29\n"
-
1225  "mov r28,%A2\n"
-
1226  "mov r29,%B2\n"
-
1227 
-
1228  // Unroll the sub loop to operate on 4 bytes at a time (8 iterations).
-
1229  "ldi r24,8\n" // Loop counter.
-
1230  "clr r25\n" // borrow = 0
-
1231  "1:\n"
-
1232  "ld r16,X+\n" // r16:r19 = *x++
-
1233  "ld r17,X+\n"
-
1234  "ld r18,X+\n"
-
1235  "ld r19,X+\n"
-
1236  "ld r20,Z+\n" // r20:r23 = *y++
-
1237  "ld r21,Z+\n"
-
1238  "ld r22,Z+\n"
-
1239  "ld r23,Z+\n"
-
1240  "sub r16,r25\n" // r16:r19:borrow -= borrow
-
1241  "sbc r17,__zero_reg__\n"
-
1242  "sbc r18,__zero_reg__\n"
-
1243  "sbc r19,__zero_reg__\n"
-
1244  "mov r25,__zero_reg__\n"
-
1245  "sbc r25,__zero_reg__\n"
-
1246  "sub r16,r20\n" // r16:r19:borrow -= r20:r23
-
1247  "sbc r17,r21\n"
-
1248  "sbc r18,r22\n"
-
1249  "sbc r19,r23\n"
-
1250  "sbc r25,__zero_reg__\n"
-
1251  "st Y+,r16\n" // *rr++ = r16:r23
-
1252  "st Y+,r17\n"
-
1253  "st Y+,r18\n"
-
1254  "st Y+,r19\n"
-
1255  "andi r25,1\n" // Only need the bottom bit of the borrow
-
1256  "dec r24\n"
-
1257  "brne 1b\n"
-
1258 
-
1259  // If there was a borrow, then we need to add 2^255 - 19 back.
-
1260  // We conditionally subtract 19 and then mask off the high bit.
-
1261  "neg r25\n" // borrow = mask(borrow) & 19
-
1262  "andi r25,19\n"
-
1263  "sbiw r28,32\n" // Point Y back to the start of "result"
-
1264  "ldi r24,8\n"
-
1265  "2:\n"
-
1266  "ld r16,Y\n" // r16:r19 = *rr
-
1267  "ldd r17,Y+1\n"
-
1268  "ldd r18,Y+2\n"
-
1269  "ldd r19,Y+3\n"
-
1270  "sub r16,r25\n"
-
1271  "sbc r17,__zero_reg__\n" // r16:r19:borrow -= borrow
-
1272  "sbc r18,__zero_reg__\n"
-
1273  "sbc r19,__zero_reg__\n"
-
1274  "mov r25,__zero_reg__\n"
-
1275  "sbc r25,__zero_reg__\n"
-
1276  "andi r25,1\n"
-
1277  "st Y+,r16\n" // *r++ = r16:r19
-
1278  "st Y+,r17\n"
-
1279  "st Y+,r18\n"
-
1280  "st Y+,r19\n"
-
1281  "dec r24\n"
-
1282  "brne 2b\n"
-
1283  "andi r19,0x7F\n" // Mask off the high bit in the last byte
-
1284  "sbiw r28,1\n"
-
1285  "st Y,r19\n"
-
1286 
-
1287  // Restore Y.
-
1288  "pop r29\n"
-
1289  "pop r28\n"
-
1290  : : "x"(x), "z"(y), "r"(result)
-
1291  : "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23",
-
1292  "r24", "r25"
-
1293  );
-
1294 #endif // CURVE25519_ASM_AVR
-
1295 }
-
1296 
-
1309 void Curve25519::cswap(limb_t select, limb_t *x, limb_t *y)
-
1310 {
-
1311 #if !defined(CURVE25519_ASM_AVR)
-
1312  uint8_t posn;
-
1313  limb_t dummy;
-
1314  limb_t sel;
-
1315 
-
1316  // Turn "select" into an all-zeroes or all-ones mask. We don't care
-
1317  // which bit or bits is set in the original "select" value.
-
1318  sel = (limb_t)(((((dlimb_t)1) << LIMB_BITS) - select) >> LIMB_BITS);
-
1319  --sel;
-
1320 
-
1321  // Swap the two values based on "select". Algorithm from:
-
1322  // http://tools.ietf.org/html/rfc7748
-
1323  for (posn = 0; posn < NUM_LIMBS_256BIT; ++posn) {
-
1324  dummy = sel & (x[posn] ^ y[posn]);
-
1325  x[posn] ^= dummy;
-
1326  y[posn] ^= dummy;
-
1327  }
-
1328 #else // CURVE25519_ASM_AVR
-
1329  __asm__ __volatile__ (
-
1330  // Combine all bytes from "select" into one and then turn
-
1331  // that byte into the "sel" mask in r24.
-
1332  "clr r24\n"
-
1333 #if BIGNUMBER_LIMB_8BIT
-
1334  "sub r24,%2\n"
-
1335 #elif BIGNUMBER_LIMB_16BIT
-
1336  "or %A2,%B2\n"
-
1337  "sub r24,%A2\n"
-
1338 #elif BIGNUMBER_LIMB_32BIT
-
1339  "or %A2,%B2\n"
-
1340  "or %A2,%C2\n"
-
1341  "or %A2,%D2\n"
-
1342  "sub r24,%A2\n"
-
1343 #endif
-
1344  "mov r24,__zero_reg__\n"
-
1345  "sbc r24,r24\n"
-
1346 
-
1347  // Perform the conditional swap 4 bytes at a time.
-
1348  "ldi r25,8\n"
-
1349  "1:\n"
-
1350  "ld r16,X+\n" // r16:r19 = *x
-
1351  "ld r17,X+\n"
-
1352  "ld r18,X+\n"
-
1353  "ld r19,X\n"
-
1354  "ld r20,Z\n" // r20:r23 = *y
-
1355  "ldd r21,Z+1\n"
-
1356  "ldd r22,Z+2\n"
-
1357  "ldd r23,Z+3\n"
-
1358  "mov r12,r16\n" // r12:r15 = (r16:r19 ^ r20:r23) & sel
-
1359  "mov r13,r17\n"
-
1360  "mov r14,r18\n"
-
1361  "mov r15,r19\n"
-
1362  "eor r12,r20\n"
-
1363  "eor r13,r21\n"
-
1364  "eor r14,r22\n"
-
1365  "eor r15,r23\n"
-
1366  "and r12,r24\n"
-
1367  "and r13,r24\n"
-
1368  "and r14,r24\n"
-
1369  "and r15,r24\n"
-
1370  "eor r16,r12\n" // r16:r19 ^= r12:r15
-
1371  "eor r17,r13\n"
-
1372  "eor r18,r14\n"
-
1373  "eor r19,r15\n"
-
1374  "eor r20,r12\n" // r20:r23 ^= r12:r15
-
1375  "eor r21,r13\n"
-
1376  "eor r22,r14\n"
-
1377  "eor r23,r15\n"
-
1378  "st X,r19\n" // *x++ = r16:r19
-
1379  "st -X,r18\n"
-
1380  "st -X,r17\n"
-
1381  "st -X,r16\n"
-
1382  "adiw r26,4\n"
-
1383  "st Z+,r20\n" // *y++ = r20:r23
-
1384  "st Z+,r21\n"
-
1385  "st Z+,r22\n"
-
1386  "st Z+,r23\n"
-
1387  "dec r25\n"
-
1388  "brne 1b\n"
-
1389 
-
1390  : : "x"(x), "z"(y), "r"(select)
-
1391  : "r12", "r13", "r14", "r15", "r16", "r17", "r18", "r19",
-
1392  "r20", "r21", "r22", "r23", "r24", "r25"
-
1393  );
-
1394 #endif // CURVE25519_ASM_AVR
-
1395 }
-
1396 
-
1409 void Curve25519::cmove(limb_t select, limb_t *x, const limb_t *y)
-
1410 {
-
1411 #if !defined(CURVE25519_ASM_AVR)
-
1412  uint8_t posn;
-
1413  limb_t dummy;
-
1414  limb_t sel;
-
1415 
-
1416  // Turn "select" into an all-zeroes or all-ones mask. We don't care
-
1417  // which bit or bits is set in the original "select" value.
-
1418  sel = (limb_t)(((((dlimb_t)1) << LIMB_BITS) - select) >> LIMB_BITS);
-
1419  --sel;
-
1420 
-
1421  // Move y into x based on "select". Similar to conditional swap above.
-
1422  for (posn = 0; posn < NUM_LIMBS_256BIT; ++posn) {
-
1423  dummy = sel & (x[posn] ^ y[posn]);
-
1424  x[posn] ^= dummy;
-
1425  }
-
1426 #else // CURVE25519_ASM_AVR
-
1427  __asm__ __volatile__ (
-
1428  // Combine all bytes from "select" into one and then turn
-
1429  // that byte into the "sel" mask in r24.
-
1430  "clr r24\n"
-
1431 #if BIGNUMBER_LIMB_8BIT
-
1432  "sub r24,%2\n"
-
1433 #elif BIGNUMBER_LIMB_16BIT
-
1434  "or %A2,%B2\n"
-
1435  "sub r24,%A2\n"
-
1436 #elif BIGNUMBER_LIMB_32BIT
-
1437  "or %A2,%B2\n"
-
1438  "or %A2,%C2\n"
-
1439  "or %A2,%D2\n"
-
1440  "sub r24,%A2\n"
-
1441 #endif
-
1442  "mov r24,__zero_reg__\n"
-
1443  "sbc r24,r24\n"
-
1444 
-
1445  // Perform the conditional move 4 bytes at a time.
-
1446  "ldi r25,8\n"
-
1447  "1:\n"
-
1448  "ld r16,X+\n" // r16:r19 = *x
-
1449  "ld r17,X+\n"
-
1450  "ld r18,X+\n"
-
1451  "ld r19,X\n"
-
1452  "ld r20,Z+\n" // r20:r23 = *y++
-
1453  "ld r21,Z+\n"
-
1454  "ld r22,Z+\n"
-
1455  "ld r23,Z+\n"
-
1456  "eor r20,r16\n" // r20:r23 = (r16:r19 ^ r20:r23) & sel
-
1457  "eor r21,r17\n"
-
1458  "eor r22,r18\n"
-
1459  "eor r23,r19\n"
-
1460  "and r20,r24\n"
-
1461  "and r21,r24\n"
-
1462  "and r22,r24\n"
-
1463  "and r23,r24\n"
-
1464  "eor r16,r20\n" // r16:r19 ^= r20:r23
-
1465  "eor r17,r21\n"
-
1466  "eor r18,r22\n"
-
1467  "eor r19,r23\n"
-
1468  "st X,r19\n" // *x++ = r16:r19
-
1469  "st -X,r18\n"
-
1470  "st -X,r17\n"
-
1471  "st -X,r16\n"
-
1472  "adiw r26,4\n"
-
1473  "dec r25\n"
-
1474  "brne 1b\n"
-
1475 
-
1476  : : "x"(x), "z"(y), "r"(select)
-
1477  : "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23",
-
1478  "r24", "r25"
-
1479  );
-
1480 #endif // CURVE25519_ASM_AVR
-
1481 }
-
1482 
-
1489 void Curve25519::pow250(limb_t *result, const limb_t *x)
-
1490 {
-
1491  limb_t t1[NUM_LIMBS_256BIT];
-
1492  uint8_t i, j;
-
1493 
-
1494  // The big-endian hexadecimal expansion of (2^250 - 1) is:
-
1495  // 03FFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF
-
1496  //
-
1497  // The naive implementation needs to do 2 multiplications per 1 bit and
-
1498  // 1 multiplication per 0 bit. We can improve upon this by creating a
-
1499  // pattern 0000000001 ... 0000000001. If we square and multiply the
-
1500  // pattern by itself we can turn the pattern into the partial results
-
1501  // 0000000011 ... 0000000011, 0000000111 ... 0000000111, etc.
-
1502  // This averages out to about 1.1 multiplications per 1 bit instead of 2.
-
1503 
-
1504  // Build a pattern of 250 bits in length of repeated copies of 0000000001.
-
1505  #define RECIP_GROUP_SIZE 10
-
1506  #define RECIP_GROUP_BITS 250 // Must be a multiple of RECIP_GROUP_SIZE.
-
1507  square(t1, x);
-
1508  for (j = 0; j < (RECIP_GROUP_SIZE - 1); ++j)
-
1509  square(t1, t1);
-
1510  mul(result, t1, x);
-
1511  for (i = 0; i < ((RECIP_GROUP_BITS / RECIP_GROUP_SIZE) - 2); ++i) {
-
1512  for (j = 0; j < RECIP_GROUP_SIZE; ++j)
-
1513  square(t1, t1);
-
1514  mul(result, result, t1);
-
1515  }
-
1516 
-
1517  // Multiply bit-shifted versions of the 0000000001 pattern into
-
1518  // the result to "fill in" the gaps in the pattern.
-
1519  square(t1, result);
-
1520  mul(result, result, t1);
-
1521  for (j = 0; j < (RECIP_GROUP_SIZE - 2); ++j) {
-
1522  square(t1, t1);
-
1523  mul(result, result, t1);
-
1524  }
-
1525 
-
1526  // Clean up and exit.
-
1527  clean(t1);
-
1528 }
-
1529 
-
1537 void Curve25519::recip(limb_t *result, const limb_t *x)
-
1538 {
-
1539  // The reciprocal is the same as x ^ (p - 2) where p = 2^255 - 19.
-
1540  // The big-endian hexadecimal expansion of (p - 2) is:
-
1541  // 7FFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFEB
-
1542  // Start with the 250 upper bits of the expansion of (p - 2).
-
1543  pow250(result, x);
-
1544 
-
1545  // Deal with the 5 lowest bits of (p - 2), 01011, from highest to lowest.
-
1546  square(result, result);
+
332  0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+
333  0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F}
+
334  };
+
335 
+
336  // Check each of the weak points in turn. We perform the
+
337  // comparisons carefully so as not to reveal the value of "k"
+
338  // in the instruction timing. If "k" is indeed weak then
+
339  // we still check everything so as not to reveal which
+
340  // weak point it is.
+
341  uint8_t result = 0;
+
342  for (uint8_t posn = 0; posn < 5; ++posn) {
+
343  const uint8_t *point = points[posn];
+
344  uint8_t check = (pgm_read_byte(point + 31) ^ k[31]) & 0x7F;
+
345  for (uint8_t index = 31; index > 0; --index)
+
346  check |= (pgm_read_byte(point + index - 1) ^ k[index - 1]);
+
347  result |= (uint8_t)((((uint16_t)0x0100) - check) >> 8);
+
348  }
+
349 
+
350  // The "result" variable will be non-zero if there was a match.
+
351  return result;
+
352 }
+
353 
+
366 void Curve25519::reduce(limb_t *result, limb_t *x, uint8_t size)
+
367 {
+
368  /*
+
369  Note: This explaination is best viewed with a UTF-8 text viewer.
+
370 
+
371  To help explain what this function is doing, the following describes
+
372  how to efficiently compute reductions modulo a base of the form (2ⁿ - b)
+
373  where b is greater than zero and (b + 1)² <= 2ⁿ.
+
374 
+
375  Here we are interested in reducing the result of multiplying two
+
376  numbers that are less than or equal to (2ⁿ - b - 1). That is,
+
377  multiplying numbers that have already been reduced.
+
378 
+
379  Given some x less than or equal to (2ⁿ - b - 1)², we want to find a
+
380  y less than (2ⁿ - b) such that:
+
381 
+
382  y ≡ x mod (2ⁿ - b)
+
383 
+
384  We know that for all integer values of k >= 0:
+
385 
+
386  y ≡ x - k * (2ⁿ - b)
+
387  ≡ x - k * 2ⁿ + k * b
+
388 
+
389  In our case we choose k = ⌊x / 2ⁿ⌋ and then let:
+
390 
+
391  w = (x mod 2ⁿ) + ⌊x / 2ⁿ⌋ * b
+
392 
+
393  The value w will either be the answer y or y can be obtained by
+
394  repeatedly subtracting (2ⁿ - b) from w until it is less than (2ⁿ - b).
+
395  At most b subtractions will be required.
+
396 
+
397  In our case b is 19 which is more subtractions than we would like to do,
+
398  but we can handle that by performing the above reduction twice and then
+
399  performing a single trial subtraction:
+
400 
+
401  w = (x mod 2ⁿ) + ⌊x / 2ⁿ⌋ * b
+
402  y = (w mod 2ⁿ) + ⌊w / 2ⁿ⌋ * b
+
403  if y >= (2ⁿ - b)
+
404  y -= (2ⁿ - b)
+
405 
+
406  The value y is the answer we want for reducing x modulo (2ⁿ - b).
+
407  */
+
408 
+
409 #if !defined(CURVE25519_ASM_AVR)
+
410  dlimb_t carry;
+
411  uint8_t posn;
+
412 
+
413  // Calculate (x mod 2^255) + ((x / 2^255) * 19) which will
+
414  // either produce the answer we want or it will produce a
+
415  // value of the form "answer + j * (2^255 - 19)".
+
416  carry = ((dlimb_t)(x[NUM_LIMBS_256BIT - 1] >> (LIMB_BITS - 1))) * 19U;
+
417  x[NUM_LIMBS_256BIT - 1] &= ((((limb_t)1) << (LIMB_BITS - 1)) - 1);
+
418  for (posn = 0; posn < size; ++posn) {
+
419  carry += ((dlimb_t)(x[posn + NUM_LIMBS_256BIT])) * 38U;
+
420  carry += x[posn];
+
421  x[posn] = (limb_t)carry;
+
422  carry >>= LIMB_BITS;
+
423  }
+
424  if (size < NUM_LIMBS_256BIT) {
+
425  // The high order half of the number is short; e.g. for mulA24().
+
426  // Propagate the carry through the rest of the low order part.
+
427  for (posn = size; posn < NUM_LIMBS_256BIT; ++posn) {
+
428  carry += x[posn];
+
429  x[posn] = (limb_t)carry;
+
430  carry >>= LIMB_BITS;
+
431  }
+
432  }
+
433 
+
434  // The "j" value may still be too large due to the final carry-out.
+
435  // We must repeat the reduction. If we already have the answer,
+
436  // then this won't do any harm but we must still do the calculation
+
437  // to preserve the overall timing.
+
438  carry *= 38U;
+
439  carry += ((dlimb_t)(x[NUM_LIMBS_256BIT - 1] >> (LIMB_BITS - 1))) * 19U;
+
440  x[NUM_LIMBS_256BIT - 1] &= ((((limb_t)1) << (LIMB_BITS - 1)) - 1);
+
441  for (posn = 0; posn < NUM_LIMBS_256BIT; ++posn) {
+
442  carry += x[posn];
+
443  x[posn] = (limb_t)carry;
+
444  carry >>= LIMB_BITS;
+
445  }
+
446 
+
447  // At this point "x" will either be the answer or it will be the
+
448  // answer plus (2^255 - 19). Perform a trial subtraction which
+
449  // is equivalent to adding 19 and subtracting 2^255. We put the
+
450  // trial answer into the top-most limbs of the original "x" array.
+
451  // We add 19 here; the subtraction of 2^255 occurs in the next step.
+
452  carry = 19U;
+
453  for (posn = 0; posn < NUM_LIMBS_256BIT; ++posn) {
+
454  carry += x[posn];
+
455  x[posn + NUM_LIMBS_256BIT] = (limb_t)carry;
+
456  carry >>= LIMB_BITS;
+
457  }
+
458 
+
459  // If there was a borrow, then the bottom-most limbs of "x" are the
+
460  // correct answer. If there was no borrow, then the top-most limbs
+
461  // of "x" are the correct answer. Select the correct answer but do
+
462  // it in a way that instruction timing will not reveal which value
+
463  // was selected. Borrow will occur if the high bit of the previous
+
464  // result is 0: turn the high bit into a selection mask.
+
465  limb_t mask = (limb_t)(((slimb_t)(x[NUM_LIMBS_512BIT - 1])) >> (LIMB_BITS - 1));
+
466  limb_t nmask = ~mask;
+
467  x[NUM_LIMBS_512BIT - 1] &= ((((limb_t)1) << (LIMB_BITS - 1)) - 1);
+
468  for (posn = 0; posn < NUM_LIMBS_256BIT; ++posn) {
+
469  result[posn] = (x[posn] & nmask) | (x[posn + NUM_LIMBS_256BIT] & mask);
+
470  }
+
471 #else
+
472  __asm__ __volatile__ (
+
473  // Calculate (x mod 2^255) + ((x / 2^255) * 19) which will
+
474  // either produce the answer we want or it will produce a
+
475  // value of the form "answer + j * (2^255 - 19)".
+
476  "ldd r24,Z+31\n" // Extract the high bit of x[31]
+
477  "mov r25,r24\n" // and mask it off
+
478  "andi r25,0x7F\n"
+
479  "std Z+31,r25\n"
+
480  "lsl r24\n" // carry = high bit * 19
+
481  "mov r24,__zero_reg__\n"
+
482  "sbc r24,__zero_reg__\n"
+
483  "andi r24,19\n"
+
484 
+
485  "mov r25,%1\n" // load "size" into r25
+
486  "ldi r23,38\n" // r23 = 38
+
487  "mov r22,__zero_reg__\n" // r22 = 0 (we're about to destroy r1)
+
488  "1:\n"
+
489  "ld r16,Z\n" // r16 = x[0]
+
490  "ldd r17,Z+32\n" // r17 = x[32]
+
491  "mul r17,r23\n" // r0:r1 = r17 * 38
+
492  "add r0,r24\n" // r0:r1 += carry
+
493  "adc r1,r22\n"
+
494  "add r0,r16\n" // r0:r1 += r16
+
495  "adc r1,r22\n"
+
496  "st Z+,r0\n" // *x++ = r0
+
497  "mov r24,r1\n" // carry = r1
+
498  "dec r25\n" // if (--r25 != 0) loop
+
499  "brne 1b\n"
+
500 
+
501  // If the size is short, then we need to continue propagating carries.
+
502  "ldi r25,32\n"
+
503  "cp %1,r25\n"
+
504  "breq 3f\n"
+
505  "sub r25,%1\n"
+
506  "ld __tmp_reg__,Z\n"
+
507  "add __tmp_reg__,r24\n"
+
508  "st Z+,__tmp_reg__\n"
+
509  "dec r25\n"
+
510  "2:\n"
+
511  "ld __tmp_reg__,Z\n" // *x++ += carry
+
512  "adc __tmp_reg__,r22\n"
+
513  "st Z+,__tmp_reg__\n"
+
514  "dec r25\n"
+
515  "brne 2b\n"
+
516  "mov r24,r22\n" // put the carry back into r24
+
517  "adc r24,r22\n"
+
518  "3:\n"
+
519  "sbiw r30,32\n" // Point Z back to the start of "x"
+
520 
+
521  // The "j" value may still be too large due to the final carry-out.
+
522  // We must repeat the reduction. If we already have the answer,
+
523  // then this won't do any harm but we must still do the calculation
+
524  // to preserve the overall timing.
+
525  "mul r24,r23\n" // carry *= 38
+
526  "ldd r24,Z+31\n" // Extract the high bit of x[31]
+
527  "mov r25,r24\n" // and mask it off
+
528  "andi r25,0x7F\n"
+
529  "std Z+31,r25\n"
+
530  "lsl r24\n" // carry += high bit * 19
+
531  "mov r24,r22\n"
+
532  "sbc r24,r22\n"
+
533  "andi r24,19\n"
+
534  "add r0,r24\n"
+
535  "adc r1,r22\n" // 9-bit carry is now in r0:r1
+
536 
+
537  // Propagate the carry through the rest of x.
+
538  "ld r24,Z\n" // x[0]
+
539  "add r0,r24\n"
+
540  "adc r1,r22\n"
+
541  "st Z+,r0\n"
+
542  "ld r24,Z\n" // x[1]
+
543  "add r1,r24\n"
+
544  "st Z+,r1\n"
+
545  "ldi r25,30\n" // x[2..31]
+
546  "4:\n"
+
547  "ld r24,Z\n"
+
548  "adc r24,r22\n"
+
549  "st Z+,r24\n"
+
550  "dec r25\n"
+
551  "brne 4b\n"
+
552  "sbiw r30,32\n" // Point Z back to the start of "x"
+
553 
+
554  // We destroyed __zero_reg__ (r1) above, so restore its zero value.
+
555  "mov __zero_reg__,r22\n"
+
556 
+
557  // At this point "x" will either be the answer or it will be the
+
558  // answer plus (2^255 - 19). Perform a trial subtraction which
+
559  // is equivalent to adding 19 and subtracting 2^255. We put the
+
560  // trial answer into the top-most limbs of the original "x" array.
+
561  // We add 19 here; the subtraction of 2^255 occurs in the next step.
+
562  "ldi r24,8\n" // Loop counter.
+
563  "ldi r25,19\n" // carry = 19
+
564  "5:\n"
+
565  "ld r16,Z+\n" // r16:r19:carry = *xx++ + carry
+
566  "ld r17,Z+\n"
+
567  "ld r18,Z+\n"
+
568  "ld r19,Z+\n"
+
569  "add r16,r25\n" // r16:r19:carry += carry
+
570  "adc r17,__zero_reg__\n"
+
571  "adc r18,__zero_reg__\n"
+
572  "adc r19,__zero_reg__\n"
+
573  "mov r25,__zero_reg__\n"
+
574  "adc r25,r25\n"
+
575  "std Z+28,r16\n" // *tt++ = r16:r19
+
576  "std Z+29,r17\n"
+
577  "std Z+30,r18\n"
+
578  "std Z+31,r19\n"
+
579  "dec r24\n"
+
580  "brne 5b\n"
+
581 
+
582  // Subtract 2^255 from x[32..63] which is equivalent to extracting
+
583  // the top bit and then masking it off. If the top bit is zero
+
584  // then a borrow has occurred and this isn't the answer we want.
+
585  "mov r25,r19\n"
+
586  "andi r19,0x7F\n"
+
587  "std Z+31,r19\n"
+
588  "lsl r25\n"
+
589  "mov r25,__zero_reg__\n"
+
590  "sbc r25,__zero_reg__\n"
+
591 
+
592  // At this point, r25 is 0 if the original x[0..31] is the answer
+
593  // we want, or 0xFF if x[32..63] is the answer we want. Essentially
+
594  // we need to do a conditional move of either x[0..31] or x[32..63]
+
595  // into "result".
+
596  "sbiw r30,32\n" // Point Z back to x[0].
+
597  "ldi r24,8\n"
+
598  "6:\n"
+
599  "ldd r16,Z+32\n"
+
600  "ldd r17,Z+33\n"
+
601  "ldd r18,Z+34\n"
+
602  "ldd r19,Z+35\n"
+
603  "ld r20,Z+\n"
+
604  "ld r21,Z+\n"
+
605  "ld r22,Z+\n"
+
606  "ld r23,Z+\n"
+
607  "eor r16,r20\n"
+
608  "eor r17,r21\n"
+
609  "eor r18,r22\n"
+
610  "eor r19,r23\n"
+
611  "and r16,r25\n"
+
612  "and r17,r25\n"
+
613  "and r18,r25\n"
+
614  "and r19,r25\n"
+
615  "eor r20,r16\n"
+
616  "eor r21,r17\n"
+
617  "eor r22,r18\n"
+
618  "eor r23,r19\n"
+
619  "st X+,r20\n"
+
620  "st X+,r21\n"
+
621  "st X+,r22\n"
+
622  "st X+,r23\n"
+
623  "dec r24\n"
+
624  "brne 6b\n"
+
625 
+
626  : : "z"(x), "r"((uint8_t)(size * sizeof(limb_t))), "x"(result)
+
627  : "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23",
+
628  "r24", "r25"
+
629  );
+
630 #endif
+
631 }
+
632 
+
646 limb_t Curve25519::reduceQuick(limb_t *x)
+
647 {
+
648 #if !defined(CURVE25519_ASM_AVR)
+
649  limb_t temp[NUM_LIMBS_256BIT];
+
650  dlimb_t carry;
+
651  uint8_t posn;
+
652  limb_t *xx;
+
653  limb_t *tt;
+
654 
+
655  // Perform a trial subtraction of (2^255 - 19) from "x" which is
+
656  // equivalent to adding 19 and subtracting 2^255. We add 19 here;
+
657  // the subtraction of 2^255 occurs in the next step.
+
658  carry = 19U;
+
659  xx = x;
+
660  tt = temp;
+
661  for (posn = 0; posn < NUM_LIMBS_256BIT; ++posn) {
+
662  carry += *xx++;
+
663  *tt++ = (limb_t)carry;
+
664  carry >>= LIMB_BITS;
+
665  }
+
666 
+
667  // If there was a borrow, then the original "x" is the correct answer.
+
668  // If there was no borrow, then "temp" is the correct answer. Select the
+
669  // correct answer but do it in a way that instruction timing will not
+
670  // reveal which value was selected. Borrow will occur if the high bit
+
671  // of "temp" is 0: turn the high bit into a selection mask.
+
672  limb_t mask = (limb_t)(((slimb_t)(temp[NUM_LIMBS_256BIT - 1])) >> (LIMB_BITS - 1));
+
673  limb_t nmask = ~mask;
+
674  temp[NUM_LIMBS_256BIT - 1] &= ((((limb_t)1) << (LIMB_BITS - 1)) - 1);
+
675  xx = x;
+
676  tt = temp;
+
677  for (posn = 0; posn < NUM_LIMBS_256BIT; ++posn) {
+
678  *xx = ((*xx) & nmask) | ((*tt++) & mask);
+
679  ++xx;
+
680  }
+
681 
+
682  // Clean up "temp".
+
683  strict_clean(temp);
+
684 
+
685  // Return a zero value if we actually subtracted (2^255 - 19) from "x".
+
686  return nmask;
+
687 #else // CURVE25519_ASM_AVR
+
688  limb_t temp[NUM_LIMBS_256BIT];
+
689  uint8_t result;
+
690  __asm__ __volatile__ (
+
691  // Subtract (2^255 - 19) from "x", which is the same as adding 19
+
692  // and then subtracting 2^255.
+
693  "ldi r24,8\n" // Loop counter.
+
694  "ldi r25,19\n" // carry = 19
+
695  "1:\n"
+
696  "ld r16,Z+\n" // r16:r19:carry = *xx++ + carry
+
697  "ld r17,Z+\n"
+
698  "ld r18,Z+\n"
+
699  "ld r19,Z+\n"
+
700  "add r16,r25\n" // r16:r19:carry += carry
+
701  "adc r17,__zero_reg__\n"
+
702  "adc r18,__zero_reg__\n"
+
703  "adc r19,__zero_reg__\n"
+
704  "mov r25,__zero_reg__\n"
+
705  "adc r25,r25\n"
+
706  "st X+,r16\n" // *tt++ = r16:r19
+
707  "st X+,r17\n"
+
708  "st X+,r18\n"
+
709  "st X+,r19\n"
+
710  "dec r24\n"
+
711  "brne 1b\n"
+
712 
+
713  // Subtract 2^255 from "temp" which is equivalent to extracting
+
714  // the top bit and then masking it off. If the top bit is zero
+
715  // then a borrow has occurred and this isn't the answer we want.
+
716  "mov r25,r19\n"
+
717  "andi r19,0x7F\n"
+
718  "st -X,r19\n"
+
719  "lsl r25\n"
+
720  "mov r25,__zero_reg__\n"
+
721  "sbc r25,__zero_reg__\n"
+
722 
+
723  // At this point, r25 is 0 if the original "x" is the answer
+
724  // we want, or 0xFF if "temp" is the answer we want. Essentially
+
725  // we need to do a conditional move of "temp" into "x".
+
726  "sbiw r26,31\n" // Point X back to the start of "temp".
+
727  "sbiw r30,32\n" // Point Z back to the start of "x".
+
728  "ldi r24,8\n"
+
729  "2:\n"
+
730  "ld r16,X+\n"
+
731  "ld r17,X+\n"
+
732  "ld r18,X+\n"
+
733  "ld r19,X+\n"
+
734  "ld r20,Z\n"
+
735  "ldd r21,Z+1\n"
+
736  "ldd r22,Z+2\n"
+
737  "ldd r23,Z+3\n"
+
738  "eor r16,r20\n"
+
739  "eor r17,r21\n"
+
740  "eor r18,r22\n"
+
741  "eor r19,r23\n"
+
742  "and r16,r25\n"
+
743  "and r17,r25\n"
+
744  "and r18,r25\n"
+
745  "and r19,r25\n"
+
746  "eor r20,r16\n"
+
747  "eor r21,r17\n"
+
748  "eor r22,r18\n"
+
749  "eor r23,r19\n"
+
750  "st Z+,r20\n"
+
751  "st Z+,r21\n"
+
752  "st Z+,r22\n"
+
753  "st Z+,r23\n"
+
754  "dec r24\n"
+
755  "brne 2b\n"
+
756  "mov %0,r25\n"
+
757  : "=r"(result)
+
758  : "x"(temp), "z"(x)
+
759  : "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23",
+
760  "r24", "r25"
+
761  );
+
762  strict_clean(temp);
+
763  return result;
+
764 #endif // CURVE25519_ASM_AVR
+
765 }
+
766 
+
779 void Curve25519::mulNoReduce(limb_t *result, const limb_t *x, const limb_t *y)
+
780 {
+
781 #if !defined(CURVE25519_ASM_AVR)
+
782  uint8_t i, j;
+
783  dlimb_t carry;
+
784  limb_t word;
+
785  const limb_t *yy;
+
786  limb_t *rr;
+
787 
+
788  // Multiply the lowest word of x by y.
+
789  carry = 0;
+
790  word = x[0];
+
791  yy = y;
+
792  rr = result;
+
793  for (i = 0; i < NUM_LIMBS_256BIT; ++i) {
+
794  carry += ((dlimb_t)(*yy++)) * word;
+
795  *rr++ = (limb_t)carry;
+
796  carry >>= LIMB_BITS;
+
797  }
+
798  *rr = (limb_t)carry;
+
799 
+
800  // Multiply and add the remaining words of x by y.
+
801  for (i = 1; i < NUM_LIMBS_256BIT; ++i) {
+
802  word = x[i];
+
803  carry = 0;
+
804  yy = y;
+
805  rr = result + i;
+
806  for (j = 0; j < NUM_LIMBS_256BIT; ++j) {
+
807  carry += ((dlimb_t)(*yy++)) * word;
+
808  carry += *rr;
+
809  *rr++ = (limb_t)carry;
+
810  carry >>= LIMB_BITS;
+
811  }
+
812  *rr = (limb_t)carry;
+
813  }
+
814 #else
+
815  __asm__ __volatile__ (
+
816  // Save Y and copy the "result" pointer into it.
+
817  "push r28\n"
+
818  "push r29\n"
+
819  "mov r28,%A2\n"
+
820  "mov r29,%B2\n"
+
821 
+
822  // Multiply the first byte of "x" by y[0..31].
+
823  "ldi r25,8\n" // loop 8 times: 4 bytes of y each time
+
824  "clr r24\n" // carry = 0
+
825  "clr r22\n" // r22 = 0 to replace __zero_reg__
+
826  "ld r23,X+\n" // r23 = *x++
+
827  "1:\n"
+
828  "ld r16,Z\n" // r16 = y[0]
+
829  "mul r16,r23\n" // r8:r9 = y[0] * r23
+
830  "movw r8,r0\n"
+
831  "ldd r16,Z+2\n" // r16 = y[2]
+
832  "mul r16,r23\n" // r10:r11 = y[2] * r23
+
833  "movw r10,r0\n"
+
834  "ldd r16,Z+1\n" // r16 = y[1]
+
835  "mul r16,r23\n" // r9:r10:r11 += y[1] * r23
+
836  "add r9,r0\n"
+
837  "adc r10,r1\n"
+
838  "adc r11,r22\n"
+
839  "ldd r16,Z+3\n" // r16 = y[3]
+
840  "mul r16,r23\n" // r11:r1 += y[3] * r23
+
841  "add r11,r0\n"
+
842  "adc r1,r22\n"
+
843  "add r8,r24\n" // r8:r9:r10:r11:r1 += carry
+
844  "adc r9,r22\n"
+
845  "adc r10,r22\n"
+
846  "adc r11,r22\n"
+
847  "adc r1,r22\n"
+
848  "mov r24,r1\n" // carry = r1
+
849  "st Y+,r8\n" // *rr++ = r8:r9:r10:r11
+
850  "st Y+,r9\n"
+
851  "st Y+,r10\n"
+
852  "st Y+,r11\n"
+
853  "adiw r30,4\n"
+
854  "dec r25\n"
+
855  "brne 1b\n"
+
856  "st Y+,r24\n" // *rr++ = carry
+
857  "sbiw r28,32\n" // rr -= 32
+
858  "sbiw r30,32\n" // Point Z back to the start of y
+
859 
+
860  // Multiply and add the remaining bytes of "x" by y[0..31].
+
861  "ldi r21,31\n" // 31 more bytes of x to go.
+
862  "2:\n"
+
863  "ldi r25,8\n" // loop 8 times: 4 bytes of y each time
+
864  "clr r24\n" // carry = 0
+
865  "ld r23,X+\n" // r23 = *x++
+
866  "3:\n"
+
867  "ld r16,Z\n" // r16 = y[0]
+
868  "mul r16,r23\n" // r8:r9 = y[0] * r23
+
869  "movw r8,r0\n"
+
870  "ldd r16,Z+2\n" // r16 = y[2]
+
871  "mul r16,r23\n" // r10:r11 = y[2] * r23
+
872  "movw r10,r0\n"
+
873  "ldd r16,Z+1\n" // r16 = y[1]
+
874  "mul r16,r23\n" // r9:r10:r11 += y[1] * r23
+
875  "add r9,r0\n"
+
876  "adc r10,r1\n"
+
877  "adc r11,r22\n"
+
878  "ldd r16,Z+3\n" // r16 = y[3]
+
879  "mul r16,r23\n" // r11:r1 += y[3] * r23
+
880  "add r11,r0\n"
+
881  "adc r1,r22\n"
+
882  "add r8,r24\n" // r8:r9:r10:r11:r1 += carry
+
883  "adc r9,r22\n"
+
884  "adc r10,r22\n"
+
885  "adc r11,r22\n"
+
886  "adc r1,r22\n"
+
887  "ld r16,Y\n" // r8:r9:r10:r11:r1 += rr[0..3]
+
888  "add r8,r16\n"
+
889  "ldd r16,Y+1\n"
+
890  "adc r9,r16\n"
+
891  "ldd r16,Y+2\n"
+
892  "adc r10,r16\n"
+
893  "ldd r16,Y+3\n"
+
894  "adc r11,r16\n"
+
895  "adc r1,r22\n"
+
896  "mov r24,r1\n" // carry = r1
+
897  "st Y+,r8\n" // *rr++ = r8:r9:r10:r11
+
898  "st Y+,r9\n"
+
899  "st Y+,r10\n"
+
900  "st Y+,r11\n"
+
901  "adiw r30,4\n"
+
902  "dec r25\n"
+
903  "brne 3b\n"
+
904  "st Y+,r24\n" // *r++ = carry
+
905  "sbiw r28,32\n" // rr -= 32
+
906  "sbiw r30,32\n" // Point Z back to the start of y
+
907  "dec r21\n"
+
908  "brne 2b\n"
+
909 
+
910  // Restore Y and __zero_reg__.
+
911  "pop r29\n"
+
912  "pop r28\n"
+
913  "clr __zero_reg__\n"
+
914  : : "x"(x), "z"(y), "r"(result)
+
915  : "r8", "r9", "r10", "r11", "r16", "r20", "r21", "r22",
+
916  "r23", "r24", "r25"
+
917  );
+
918 #endif
+
919 }
+
920 
+
931 void Curve25519::mul(limb_t *result, const limb_t *x, const limb_t *y)
+
932 {
+
933  limb_t temp[NUM_LIMBS_512BIT];
+
934  mulNoReduce(temp, x, y);
+
935  reduce(result, temp, NUM_LIMBS_256BIT);
+
936  strict_clean(temp);
+
937 }
+
938 
+
958 void Curve25519::mulA24(limb_t *result, const limb_t *x)
+
959 {
+
960 #if !defined(CURVE25519_ASM_AVR)
+
961  // The constant a24 = 121665 (0x1DB41) as a limb array.
+
962 #if BIGNUMBER_LIMB_8BIT
+
963  static limb_t const a24[3] PROGMEM = {0x41, 0xDB, 0x01};
+
964 #elif BIGNUMBER_LIMB_16BIT
+
965  static limb_t const a24[2] PROGMEM = {0xDB41, 0x0001};
+
966 #elif BIGNUMBER_LIMB_32BIT || BIGNUMBER_LIMB_64BIT
+
967  static limb_t const a24[1] PROGMEM = {0x0001DB41};
+
968 #else
+
969  #error "limb_t must be 8, 16, 32, or 64 bits in size"
+
970 #endif
+
971  #define NUM_A24_LIMBS (sizeof(a24) / sizeof(limb_t))
+
972 
+
973  // Multiply the lowest limb of a24 by x and zero-extend into the result.
+
974  limb_t temp[NUM_LIMBS_512BIT];
+
975  uint8_t i, j;
+
976  dlimb_t carry = 0;
+
977  limb_t word = pgm_read_limb(&(a24[0]));
+
978  const limb_t *xx = x;
+
979  limb_t *tt = temp;
+
980  for (i = 0; i < NUM_LIMBS_256BIT; ++i) {
+
981  carry += ((dlimb_t)(*xx++)) * word;
+
982  *tt++ = (limb_t)carry;
+
983  carry >>= LIMB_BITS;
+
984  }
+
985  *tt = (limb_t)carry;
+
986 
+
987  // Multiply and add the remaining limbs of a24.
+
988  for (i = 1; i < NUM_A24_LIMBS; ++i) {
+
989  word = pgm_read_limb(&(a24[i]));
+
990  carry = 0;
+
991  xx = x;
+
992  tt = temp + i;
+
993  for (j = 0; j < NUM_LIMBS_256BIT; ++j) {
+
994  carry += ((dlimb_t)(*xx++)) * word;
+
995  carry += *tt;
+
996  *tt++ = (limb_t)carry;
+
997  carry >>= LIMB_BITS;
+
998  }
+
999  *tt = (limb_t)carry;
+
1000  }
+
1001 #else
+
1002  limb_t temp[NUM_LIMBS_512BIT];
+
1003  #define NUM_A24_LIMBS ((3 + sizeof(limb_t) - 1) / sizeof(limb_t))
+
1004  __asm__ __volatile__ (
+
1005  // Load the two low bytes of a24 into r16 and r17.
+
1006  // The third byte is 0x01 which we can deal with implicitly.
+
1007  "ldi r16,0x41\n"
+
1008  "ldi r17,0xDB\n"
+
1009 
+
1010  // Iterate over the bytes of "x" and multiply each with a24.
+
1011  "ldi r25,32\n" // 32 bytes in "x"
+
1012  "clr r22\n" // r22 = 0
+
1013  "clr r18\n" // r18:r19:r11 = 0 (carry)
+
1014  "clr r19\n"
+
1015  "clr r11\n"
+
1016  "1:\n"
+
1017  "ld r21,X+\n" // r21 = *x++
+
1018  "mul r21,r16\n" // r8:r9 = r21 * a24[0]
+
1019  "movw r8,r0\n"
+
1020  "mul r21,r17\n" // r9:r1 += r21 * a24[1]
+
1021  "add r9,r0\n"
+
1022  "adc r1,r21\n" // r1:r10 += r21 * a24[2] (implicitly 1)
+
1023  "mov r10,r22\n"
+
1024  "adc r10,r22\n"
+
1025  "add r8,r18\n" // r8:r9:r1:r10 += carry
+
1026  "adc r9,r19\n"
+
1027  "adc r1,r11\n"
+
1028  "adc r10,r22\n"
+
1029  "st Z+,r8\n" // *tt++ = r8
+
1030  "mov r18,r9\n" // carry = r9:r1:r10
+
1031  "mov r19,r1\n"
+
1032  "mov r11,r10\n"
+
1033  "dec r25\n"
+
1034  "brne 1b\n"
+
1035  "st Z,r18\n" // *tt = carry
+
1036  "std Z+1,r19\n"
+
1037  "std Z+2,r11\n"
+
1038 #if BIGNUMBER_LIMB_16BIT || BIGNUMBER_LIMB_32BIT
+
1039  "std Z+3,r22\n" // Zero pad to a limb boundary
+
1040 #endif
+
1041 
+
1042  // Restore __zero_reg__
+
1043  "clr __zero_reg__\n"
+
1044 
+
1045  : : "x"(x), "z"(temp)
+
1046  : "r8", "r9", "r10", "r11", "r16", "r17", "r18", "r19",
+
1047  "r20", "r21", "r22", "r25"
+
1048  );
+
1049 #endif
+
1050 
+
1051  // Reduce the intermediate result modulo 2^255 - 19.
+
1052  reduce(result, temp, NUM_A24_LIMBS);
+
1053  strict_clean(temp);
+
1054 }
+
1055 
+
1067 void Curve25519::mul_P(limb_t *result, const limb_t *x, const limb_t *y)
+
1068 {
+
1069  limb_t temp[NUM_LIMBS_512BIT];
+
1070  uint8_t i, j;
+
1071  dlimb_t carry;
+
1072  limb_t word;
+
1073  const limb_t *xx;
+
1074  limb_t *tt;
+
1075 
+
1076  // Multiply the lowest word of y by x.
+
1077  carry = 0;
+
1078  word = pgm_read_limb(&(y[0]));
+
1079  xx = x;
+
1080  tt = temp;
+
1081  for (i = 0; i < NUM_LIMBS_256BIT; ++i) {
+
1082  carry += ((dlimb_t)(*xx++)) * word;
+
1083  *tt++ = (limb_t)carry;
+
1084  carry >>= LIMB_BITS;
+
1085  }
+
1086  *tt = (limb_t)carry;
+
1087 
+
1088  // Multiply and add the remaining words of y by x.
+
1089  for (i = 1; i < NUM_LIMBS_256BIT; ++i) {
+
1090  word = pgm_read_limb(&(y[i]));
+
1091  carry = 0;
+
1092  xx = x;
+
1093  tt = temp + i;
+
1094  for (j = 0; j < NUM_LIMBS_256BIT; ++j) {
+
1095  carry += ((dlimb_t)(*xx++)) * word;
+
1096  carry += *tt;
+
1097  *tt++ = (limb_t)carry;
+
1098  carry >>= LIMB_BITS;
+
1099  }
+
1100  *tt = (limb_t)carry;
+
1101  }
+
1102 
+
1103  // Reduce the intermediate result modulo 2^255 - 19.
+
1104  reduce(result, temp, NUM_LIMBS_256BIT);
+
1105  strict_clean(temp);
+
1106 }
+
1107 
+
1118 void Curve25519::add(limb_t *result, const limb_t *x, const limb_t *y)
+
1119 {
+
1120 #if !defined(CURVE25519_ASM_AVR)
+
1121  dlimb_t carry = 0;
+
1122  uint8_t posn;
+
1123  limb_t *rr = result;
+
1124 
+
1125  // Add the two arrays to obtain the intermediate result.
+
1126  for (posn = 0; posn < NUM_LIMBS_256BIT; ++posn) {
+
1127  carry += *x++;
+
1128  carry += *y++;
+
1129  *rr++ = (limb_t)carry;
+
1130  carry >>= LIMB_BITS;
+
1131  }
+
1132 #else // CURVE25519_ASM_AVR
+
1133  __asm__ __volatile__ (
+
1134  // Save Y and copy the "result" pointer into it.
+
1135  "push r28\n"
+
1136  "push r29\n"
+
1137  "mov r28,%A2\n"
+
1138  "mov r29,%B2\n"
+
1139 
+
1140  // Unroll the loop to operate on 4 bytes at a time (8 iterations).
+
1141  "ldi r24,8\n" // Loop counter.
+
1142  "clr r25\n" // carry = 0
+
1143  "1:\n"
+
1144  "ld r16,X+\n" // r16:r19 = *x++
+
1145  "ld r17,X+\n"
+
1146  "ld r18,X+\n"
+
1147  "ld r19,X+\n"
+
1148  "ld r20,Z+\n" // r20:r23 = *y++
+
1149  "ld r21,Z+\n"
+
1150  "ld r22,Z+\n"
+
1151  "ld r23,Z+\n"
+
1152  "add r16,r25\n" // r16:r19:carry += carry
+
1153  "adc r17,__zero_reg__\n"
+
1154  "adc r18,__zero_reg__\n"
+
1155  "adc r19,__zero_reg__\n"
+
1156  "mov r25,__zero_reg__\n"
+
1157  "adc r25,r25\n"
+
1158  "add r16,r20\n" // r16:r19:carry += r20:r23
+
1159  "adc r17,r21\n"
+
1160  "adc r18,r22\n"
+
1161  "adc r19,r23\n"
+
1162  "adc r25,__zero_reg__\n"
+
1163  "st Y+,r16\n" // *rr++ = r16:r23
+
1164  "st Y+,r17\n"
+
1165  "st Y+,r18\n"
+
1166  "st Y+,r19\n"
+
1167  "dec r24\n"
+
1168  "brne 1b\n"
+
1169 
+
1170  // Restore Y.
+
1171  "pop r29\n"
+
1172  "pop r28\n"
+
1173  : : "x"(x), "z"(y), "r"(result)
+
1174  : "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23",
+
1175  "r24", "r25"
+
1176  );
+
1177 #endif // CURVE25519_ASM_AVR
+
1178 
+
1179  // Reduce the result using the quick trial subtraction method.
+
1180  reduceQuick(result);
+
1181 }
+
1182 
+
1193 void Curve25519::sub(limb_t *result, const limb_t *x, const limb_t *y)
+
1194 {
+
1195 #if !defined(CURVE25519_ASM_AVR)
+
1196  dlimb_t borrow;
+
1197  uint8_t posn;
+
1198  limb_t *rr = result;
+
1199 
+
1200  // Subtract y from x to generate the intermediate result.
+
1201  borrow = 0;
+
1202  for (posn = 0; posn < NUM_LIMBS_256BIT; ++posn) {
+
1203  borrow = ((dlimb_t)(*x++)) - (*y++) - ((borrow >> LIMB_BITS) & 0x01);
+
1204  *rr++ = (limb_t)borrow;
+
1205  }
+
1206 
+
1207  // If we had a borrow, then the result has gone negative and we
+
1208  // have to add 2^255 - 19 to the result to make it positive again.
+
1209  // The top bits of "borrow" will be all 1's if there is a borrow
+
1210  // or it will be all 0's if there was no borrow. Easiest is to
+
1211  // conditionally subtract 19 and then mask off the high bit.
+
1212  rr = result;
+
1213  borrow = (borrow >> LIMB_BITS) & 19U;
+
1214  borrow = ((dlimb_t)(*rr)) - borrow;
+
1215  *rr++ = (limb_t)borrow;
+
1216  for (posn = 1; posn < NUM_LIMBS_256BIT; ++posn) {
+
1217  borrow = ((dlimb_t)(*rr)) - ((borrow >> LIMB_BITS) & 0x01);
+
1218  *rr++ = (limb_t)borrow;
+
1219  }
+
1220  *(--rr) &= ((((limb_t)1) << (LIMB_BITS - 1)) - 1);
+
1221 #else // CURVE25519_ASM_AVR
+
1222  __asm__ __volatile__ (
+
1223  // Save Y and copy the "result" pointer into it.
+
1224  "push r28\n"
+
1225  "push r29\n"
+
1226  "mov r28,%A2\n"
+
1227  "mov r29,%B2\n"
+
1228 
+
1229  // Unroll the sub loop to operate on 4 bytes at a time (8 iterations).
+
1230  "ldi r24,8\n" // Loop counter.
+
1231  "clr r25\n" // borrow = 0
+
1232  "1:\n"
+
1233  "ld r16,X+\n" // r16:r19 = *x++
+
1234  "ld r17,X+\n"
+
1235  "ld r18,X+\n"
+
1236  "ld r19,X+\n"
+
1237  "ld r20,Z+\n" // r20:r23 = *y++
+
1238  "ld r21,Z+\n"
+
1239  "ld r22,Z+\n"
+
1240  "ld r23,Z+\n"
+
1241  "sub r16,r25\n" // r16:r19:borrow -= borrow
+
1242  "sbc r17,__zero_reg__\n"
+
1243  "sbc r18,__zero_reg__\n"
+
1244  "sbc r19,__zero_reg__\n"
+
1245  "mov r25,__zero_reg__\n"
+
1246  "sbc r25,__zero_reg__\n"
+
1247  "sub r16,r20\n" // r16:r19:borrow -= r20:r23
+
1248  "sbc r17,r21\n"
+
1249  "sbc r18,r22\n"
+
1250  "sbc r19,r23\n"
+
1251  "sbc r25,__zero_reg__\n"
+
1252  "st Y+,r16\n" // *rr++ = r16:r23
+
1253  "st Y+,r17\n"
+
1254  "st Y+,r18\n"
+
1255  "st Y+,r19\n"
+
1256  "andi r25,1\n" // Only need the bottom bit of the borrow
+
1257  "dec r24\n"
+
1258  "brne 1b\n"
+
1259 
+
1260  // If there was a borrow, then we need to add 2^255 - 19 back.
+
1261  // We conditionally subtract 19 and then mask off the high bit.
+
1262  "neg r25\n" // borrow = mask(borrow) & 19
+
1263  "andi r25,19\n"
+
1264  "sbiw r28,32\n" // Point Y back to the start of "result"
+
1265  "ldi r24,8\n"
+
1266  "2:\n"
+
1267  "ld r16,Y\n" // r16:r19 = *rr
+
1268  "ldd r17,Y+1\n"
+
1269  "ldd r18,Y+2\n"
+
1270  "ldd r19,Y+3\n"
+
1271  "sub r16,r25\n"
+
1272  "sbc r17,__zero_reg__\n" // r16:r19:borrow -= borrow
+
1273  "sbc r18,__zero_reg__\n"
+
1274  "sbc r19,__zero_reg__\n"
+
1275  "mov r25,__zero_reg__\n"
+
1276  "sbc r25,__zero_reg__\n"
+
1277  "andi r25,1\n"
+
1278  "st Y+,r16\n" // *r++ = r16:r19
+
1279  "st Y+,r17\n"
+
1280  "st Y+,r18\n"
+
1281  "st Y+,r19\n"
+
1282  "dec r24\n"
+
1283  "brne 2b\n"
+
1284  "andi r19,0x7F\n" // Mask off the high bit in the last byte
+
1285  "sbiw r28,1\n"
+
1286  "st Y,r19\n"
+
1287 
+
1288  // Restore Y.
+
1289  "pop r29\n"
+
1290  "pop r28\n"
+
1291  : : "x"(x), "z"(y), "r"(result)
+
1292  : "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23",
+
1293  "r24", "r25"
+
1294  );
+
1295 #endif // CURVE25519_ASM_AVR
+
1296 }
+
1297 
+
1310 void Curve25519::cswap(limb_t select, limb_t *x, limb_t *y)
+
1311 {
+
1312 #if !defined(CURVE25519_ASM_AVR)
+
1313  uint8_t posn;
+
1314  limb_t dummy;
+
1315  limb_t sel;
+
1316 
+
1317  // Turn "select" into an all-zeroes or all-ones mask. We don't care
+
1318  // which bit or bits is set in the original "select" value.
+
1319  sel = (limb_t)(((((dlimb_t)1) << LIMB_BITS) - select) >> LIMB_BITS);
+
1320  --sel;
+
1321 
+
1322  // Swap the two values based on "select". Algorithm from:
+
1323  // http://tools.ietf.org/html/rfc7748
+
1324  for (posn = 0; posn < NUM_LIMBS_256BIT; ++posn) {
+
1325  dummy = sel & (x[posn] ^ y[posn]);
+
1326  x[posn] ^= dummy;
+
1327  y[posn] ^= dummy;
+
1328  }
+
1329 #else // CURVE25519_ASM_AVR
+
1330  __asm__ __volatile__ (
+
1331  // Combine all bytes from "select" into one and then turn
+
1332  // that byte into the "sel" mask in r24.
+
1333  "clr r24\n"
+
1334 #if BIGNUMBER_LIMB_8BIT
+
1335  "sub r24,%2\n"
+
1336 #elif BIGNUMBER_LIMB_16BIT
+
1337  "or %A2,%B2\n"
+
1338  "sub r24,%A2\n"
+
1339 #elif BIGNUMBER_LIMB_32BIT
+
1340  "or %A2,%B2\n"
+
1341  "or %A2,%C2\n"
+
1342  "or %A2,%D2\n"
+
1343  "sub r24,%A2\n"
+
1344 #endif
+
1345  "mov r24,__zero_reg__\n"
+
1346  "sbc r24,r24\n"
+
1347 
+
1348  // Perform the conditional swap 4 bytes at a time.
+
1349  "ldi r25,8\n"
+
1350  "1:\n"
+
1351  "ld r16,X+\n" // r16:r19 = *x
+
1352  "ld r17,X+\n"
+
1353  "ld r18,X+\n"
+
1354  "ld r19,X\n"
+
1355  "ld r20,Z\n" // r20:r23 = *y
+
1356  "ldd r21,Z+1\n"
+
1357  "ldd r22,Z+2\n"
+
1358  "ldd r23,Z+3\n"
+
1359  "mov r12,r16\n" // r12:r15 = (r16:r19 ^ r20:r23) & sel
+
1360  "mov r13,r17\n"
+
1361  "mov r14,r18\n"
+
1362  "mov r15,r19\n"
+
1363  "eor r12,r20\n"
+
1364  "eor r13,r21\n"
+
1365  "eor r14,r22\n"
+
1366  "eor r15,r23\n"
+
1367  "and r12,r24\n"
+
1368  "and r13,r24\n"
+
1369  "and r14,r24\n"
+
1370  "and r15,r24\n"
+
1371  "eor r16,r12\n" // r16:r19 ^= r12:r15
+
1372  "eor r17,r13\n"
+
1373  "eor r18,r14\n"
+
1374  "eor r19,r15\n"
+
1375  "eor r20,r12\n" // r20:r23 ^= r12:r15
+
1376  "eor r21,r13\n"
+
1377  "eor r22,r14\n"
+
1378  "eor r23,r15\n"
+
1379  "st X,r19\n" // *x++ = r16:r19
+
1380  "st -X,r18\n"
+
1381  "st -X,r17\n"
+
1382  "st -X,r16\n"
+
1383  "adiw r26,4\n"
+
1384  "st Z+,r20\n" // *y++ = r20:r23
+
1385  "st Z+,r21\n"
+
1386  "st Z+,r22\n"
+
1387  "st Z+,r23\n"
+
1388  "dec r25\n"
+
1389  "brne 1b\n"
+
1390 
+
1391  : : "x"(x), "z"(y), "r"(select)
+
1392  : "r12", "r13", "r14", "r15", "r16", "r17", "r18", "r19",
+
1393  "r20", "r21", "r22", "r23", "r24", "r25"
+
1394  );
+
1395 #endif // CURVE25519_ASM_AVR
+
1396 }
+
1397 
+
1410 void Curve25519::cmove(limb_t select, limb_t *x, const limb_t *y)
+
1411 {
+
1412 #if !defined(CURVE25519_ASM_AVR)
+
1413  uint8_t posn;
+
1414  limb_t dummy;
+
1415  limb_t sel;
+
1416 
+
1417  // Turn "select" into an all-zeroes or all-ones mask. We don't care
+
1418  // which bit or bits is set in the original "select" value.
+
1419  sel = (limb_t)(((((dlimb_t)1) << LIMB_BITS) - select) >> LIMB_BITS);
+
1420  --sel;
+
1421 
+
1422  // Move y into x based on "select". Similar to conditional swap above.
+
1423  for (posn = 0; posn < NUM_LIMBS_256BIT; ++posn) {
+
1424  dummy = sel & (x[posn] ^ y[posn]);
+
1425  x[posn] ^= dummy;
+
1426  }
+
1427 #else // CURVE25519_ASM_AVR
+
1428  __asm__ __volatile__ (
+
1429  // Combine all bytes from "select" into one and then turn
+
1430  // that byte into the "sel" mask in r24.
+
1431  "clr r24\n"
+
1432 #if BIGNUMBER_LIMB_8BIT
+
1433  "sub r24,%2\n"
+
1434 #elif BIGNUMBER_LIMB_16BIT
+
1435  "or %A2,%B2\n"
+
1436  "sub r24,%A2\n"
+
1437 #elif BIGNUMBER_LIMB_32BIT
+
1438  "or %A2,%B2\n"
+
1439  "or %A2,%C2\n"
+
1440  "or %A2,%D2\n"
+
1441  "sub r24,%A2\n"
+
1442 #endif
+
1443  "mov r24,__zero_reg__\n"
+
1444  "sbc r24,r24\n"
+
1445 
+
1446  // Perform the conditional move 4 bytes at a time.
+
1447  "ldi r25,8\n"
+
1448  "1:\n"
+
1449  "ld r16,X+\n" // r16:r19 = *x
+
1450  "ld r17,X+\n"
+
1451  "ld r18,X+\n"
+
1452  "ld r19,X\n"
+
1453  "ld r20,Z+\n" // r20:r23 = *y++
+
1454  "ld r21,Z+\n"
+
1455  "ld r22,Z+\n"
+
1456  "ld r23,Z+\n"
+
1457  "eor r20,r16\n" // r20:r23 = (r16:r19 ^ r20:r23) & sel
+
1458  "eor r21,r17\n"
+
1459  "eor r22,r18\n"
+
1460  "eor r23,r19\n"
+
1461  "and r20,r24\n"
+
1462  "and r21,r24\n"
+
1463  "and r22,r24\n"
+
1464  "and r23,r24\n"
+
1465  "eor r16,r20\n" // r16:r19 ^= r20:r23
+
1466  "eor r17,r21\n"
+
1467  "eor r18,r22\n"
+
1468  "eor r19,r23\n"
+
1469  "st X,r19\n" // *x++ = r16:r19
+
1470  "st -X,r18\n"
+
1471  "st -X,r17\n"
+
1472  "st -X,r16\n"
+
1473  "adiw r26,4\n"
+
1474  "dec r25\n"
+
1475  "brne 1b\n"
+
1476 
+
1477  : : "x"(x), "z"(y), "r"(select)
+
1478  : "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23",
+
1479  "r24", "r25"
+
1480  );
+
1481 #endif // CURVE25519_ASM_AVR
+
1482 }
+
1483 
+
1490 void Curve25519::pow250(limb_t *result, const limb_t *x)
+
1491 {
+
1492  limb_t t1[NUM_LIMBS_256BIT];
+
1493  uint8_t i, j;
+
1494 
+
1495  // The big-endian hexadecimal expansion of (2^250 - 1) is:
+
1496  // 03FFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF
+
1497  //
+
1498  // The naive implementation needs to do 2 multiplications per 1 bit and
+
1499  // 1 multiplication per 0 bit. We can improve upon this by creating a
+
1500  // pattern 0000000001 ... 0000000001. If we square and multiply the
+
1501  // pattern by itself we can turn the pattern into the partial results
+
1502  // 0000000011 ... 0000000011, 0000000111 ... 0000000111, etc.
+
1503  // This averages out to about 1.1 multiplications per 1 bit instead of 2.
+
1504 
+
1505  // Build a pattern of 250 bits in length of repeated copies of 0000000001.
+
1506  #define RECIP_GROUP_SIZE 10
+
1507  #define RECIP_GROUP_BITS 250 // Must be a multiple of RECIP_GROUP_SIZE.
+
1508  square(t1, x);
+
1509  for (j = 0; j < (RECIP_GROUP_SIZE - 1); ++j)
+
1510  square(t1, t1);
+
1511  mul(result, t1, x);
+
1512  for (i = 0; i < ((RECIP_GROUP_BITS / RECIP_GROUP_SIZE) - 2); ++i) {
+
1513  for (j = 0; j < RECIP_GROUP_SIZE; ++j)
+
1514  square(t1, t1);
+
1515  mul(result, result, t1);
+
1516  }
+
1517 
+
1518  // Multiply bit-shifted versions of the 0000000001 pattern into
+
1519  // the result to "fill in" the gaps in the pattern.
+
1520  square(t1, result);
+
1521  mul(result, result, t1);
+
1522  for (j = 0; j < (RECIP_GROUP_SIZE - 2); ++j) {
+
1523  square(t1, t1);
+
1524  mul(result, result, t1);
+
1525  }
+
1526 
+
1527  // Clean up and exit.
+
1528  clean(t1);
+
1529 }
+
1530 
+
1538 void Curve25519::recip(limb_t *result, const limb_t *x)
+
1539 {
+
1540  // The reciprocal is the same as x ^ (p - 2) where p = 2^255 - 19.
+
1541  // The big-endian hexadecimal expansion of (p - 2) is:
+
1542  // 7FFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFEB
+
1543  // Start with the 250 upper bits of the expansion of (p - 2).
+
1544  pow250(result, x);
+
1545 
+
1546  // Deal with the 5 lowest bits of (p - 2), 01011, from highest to lowest.
1547  square(result, result);
-
1548  mul(result, result, x);
-
1549  square(result, result);
+
1548  square(result, result);
+
1549  mul(result, result, x);
1550  square(result, result);
-
1551  mul(result, result, x);
-
1552  square(result, result);
-
1553  mul(result, result, x);
-
1554 }
-
1555 
-
1571 bool Curve25519::sqrt(limb_t *result, const limb_t *x)
-
1572 {
-
1573  // sqrt(-1) mod (2^255 - 19).
-
1574  static limb_t const numSqrtM1[NUM_LIMBS_256BIT] PROGMEM = {
-
1575  LIMB_PAIR(0x4A0EA0B0, 0xC4EE1B27), LIMB_PAIR(0xAD2FE478, 0x2F431806),
-
1576  LIMB_PAIR(0x3DFBD7A7, 0x2B4D0099), LIMB_PAIR(0x4FC1DF0B, 0x2B832480)
-
1577  };
-
1578  limb_t y[NUM_LIMBS_256BIT];
-
1579 
-
1580  // Algorithm from: http://tools.ietf.org/html/rfc7748
-
1581 
-
1582  // Compute a candidate root: result = x^((p + 3) / 8) mod p.
-
1583  // (p + 3) / 8 = (2^252 - 2) which is 251 one bits followed by a zero:
-
1584  // 0FFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFE
-
1585  pow250(result, x);
-
1586  square(result, result);
-
1587  mul(result, result, x);
-
1588  square(result, result);
-
1589 
-
1590  // Did we get the square root immediately?
-
1591  square(y, result);
-
1592  if (memcmp(x, y, sizeof(y)) == 0) {
-
1593  clean(y);
-
1594  return true;
-
1595  }
-
1596 
-
1597  // Multiply the result by sqrt(-1) and check again.
-
1598  mul_P(result, result, numSqrtM1);
-
1599  square(y, result);
-
1600  if (memcmp(x, y, sizeof(y)) == 0) {
-
1601  clean(y);
-
1602  return true;
-
1603  }
-
1604 
-
1605  // The number does not have a square root.
-
1606  clean(y);
-
1607  return false;
-
1608 }
+
1551  square(result, result);
+
1552  mul(result, result, x);
+
1553  square(result, result);
+
1554  mul(result, result, x);
+
1555 }
+
1556 
+
1572 bool Curve25519::sqrt(limb_t *result, const limb_t *x)
+
1573 {
+
1574  // sqrt(-1) mod (2^255 - 19).
+
1575  static limb_t const numSqrtM1[NUM_LIMBS_256BIT] PROGMEM = {
+
1576  LIMB_PAIR(0x4A0EA0B0, 0xC4EE1B27), LIMB_PAIR(0xAD2FE478, 0x2F431806),
+
1577  LIMB_PAIR(0x3DFBD7A7, 0x2B4D0099), LIMB_PAIR(0x4FC1DF0B, 0x2B832480)
+
1578  };
+
1579  limb_t y[NUM_LIMBS_256BIT];
+
1580 
+
1581  // Algorithm from: http://tools.ietf.org/html/rfc7748
+
1582 
+
1583  // Compute a candidate root: result = x^((p + 3) / 8) mod p.
+
1584  // (p + 3) / 8 = (2^252 - 2) which is 251 one bits followed by a zero:
+
1585  // 0FFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFE
+
1586  pow250(result, x);
+
1587  square(result, result);
+
1588  mul(result, result, x);
+
1589  square(result, result);
+
1590 
+
1591  // Did we get the square root immediately?
+
1592  square(y, result);
+
1593  if (memcmp(x, y, sizeof(y)) == 0) {
+
1594  clean(y);
+
1595  return true;
+
1596  }
+
1597 
+
1598  // Multiply the result by sqrt(-1) and check again.
+
1599  mul_P(result, result, numSqrtM1);
+
1600  square(y, result);
+
1601  if (memcmp(x, y, sizeof(y)) == 0) {
+
1602  clean(y);
+
1603  return true;
+
1604  }
+
1605 
+
1606  // The number does not have a square root.
+
1607  clean(y);
+
1608  return false;
+
1609 }
void rand(uint8_t *data, size_t len)
Generates random bytes into a caller-supplied buffer.
Definition: RNG.cpp:508
-
static bool eval(uint8_t result[32], const uint8_t s[32], const uint8_t x[32])
Evaluates the raw Curve25519 function.
Definition: Curve25519.cpp:79
+
static bool eval(uint8_t result[32], const uint8_t s[32], const uint8_t x[32])
Evaluates the raw Curve25519 function.
Definition: Curve25519.cpp:80
static void unpackLE(limb_t *limbs, size_t count, const uint8_t *bytes, size_t len)
Unpacks the little-endian byte representation of a big number into a limb array.
static void packLE(uint8_t *bytes, size_t len, const limb_t *limbs, size_t count)
Packs the little-endian byte representation of a big number into a byte array.
-
static void dh1(uint8_t k[32], uint8_t f[32])
Performs phase 1 of a Diffie-Hellman key exchange using Curve25519.
Definition: Curve25519.cpp:244
-
static bool dh2(uint8_t k[32], uint8_t f[32])
Performs phase 2 of a Diffie-Hellman key exchange using Curve25519.
Definition: Curve25519.cpp:282
+
static void dh1(uint8_t k[32], uint8_t f[32])
Performs phase 1 of a Diffie-Hellman key exchange using Curve25519.
Definition: Curve25519.cpp:245
+
static bool dh2(uint8_t k[32], uint8_t f[32])
Performs phase 2 of a Diffie-Hellman key exchange using Curve25519.
Definition: Curve25519.cpp:283
diff --git a/Curve25519_8h_source.html b/Curve25519_8h_source.html index a71842a6..c8beb4c2 100644 --- a/Curve25519_8h_source.html +++ b/Curve25519_8h_source.html @@ -166,14 +166,14 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
76 
77 #endif
Diffie-Hellman key agreement based on the elliptic curve modulo 2^255 - 19.
Definition: Curve25519.h:30
-
static bool eval(uint8_t result[32], const uint8_t s[32], const uint8_t x[32])
Evaluates the raw Curve25519 function.
Definition: Curve25519.cpp:79
+
static bool eval(uint8_t result[32], const uint8_t s[32], const uint8_t x[32])
Evaluates the raw Curve25519 function.
Definition: Curve25519.cpp:80
Digital signatures based on the elliptic curve modulo 2^255 - 19.
Definition: Ed25519.h:29
-
static void dh1(uint8_t k[32], uint8_t f[32])
Performs phase 1 of a Diffie-Hellman key exchange using Curve25519.
Definition: Curve25519.cpp:244
-
static bool dh2(uint8_t k[32], uint8_t f[32])
Performs phase 2 of a Diffie-Hellman key exchange using Curve25519.
Definition: Curve25519.cpp:282
+
static void dh1(uint8_t k[32], uint8_t f[32])
Performs phase 1 of a Diffie-Hellman key exchange using Curve25519.
Definition: Curve25519.cpp:245
+
static bool dh2(uint8_t k[32], uint8_t f[32])
Performs phase 2 of a Diffie-Hellman key exchange using Curve25519.
Definition: Curve25519.cpp:283
diff --git a/DMD_8cpp_source.html b/DMD_8cpp_source.html index b1585068..604dce6e 100644 --- a/DMD_8cpp_source.html +++ b/DMD_8cpp_source.html @@ -456,7 +456,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/DMD_8h_source.html b/DMD_8h_source.html index fd3841d0..096235b9 100644 --- a/DMD_8h_source.html +++ b/DMD_8h_source.html @@ -170,7 +170,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/DS1307RTC_8cpp_source.html b/DS1307RTC_8cpp_source.html index 9c8d538f..aeb62be3 100644 --- a/DS1307RTC_8cpp_source.html +++ b/DS1307RTC_8cpp_source.html @@ -415,7 +415,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/DS1307RTC_8h_source.html b/DS1307RTC_8h_source.html index cad18f98..938f582b 100644 --- a/DS1307RTC_8h_source.html +++ b/DS1307RTC_8h_source.html @@ -172,7 +172,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/DS3231RTC_8cpp_source.html b/DS3231RTC_8cpp_source.html index 3902f7e1..dd0d3cdb 100644 --- a/DS3231RTC_8cpp_source.html +++ b/DS3231RTC_8cpp_source.html @@ -657,7 +657,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/DS3231RTC_8h_source.html b/DS3231RTC_8h_source.html index eebd6a8d..71616790 100644 --- a/DS3231RTC_8h_source.html +++ b/DS3231RTC_8h_source.html @@ -202,7 +202,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/DS3232RTC_8cpp_source.html b/DS3232RTC_8cpp_source.html index 876dbef5..6daaa1bd 100644 --- a/DS3232RTC_8cpp_source.html +++ b/DS3232RTC_8cpp_source.html @@ -575,7 +575,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/DS3232RTC_8h_source.html b/DS3232RTC_8h_source.html index ed798fe2..b9dfcd8c 100644 --- a/DS3232RTC_8h_source.html +++ b/DS3232RTC_8h_source.html @@ -190,7 +190,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/DejaVuSans9_8h_source.html b/DejaVuSans9_8h_source.html index a9ae51fa..d4bc123d 100644 --- a/DejaVuSans9_8h_source.html +++ b/DejaVuSans9_8h_source.html @@ -257,7 +257,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/DejaVuSansBold9_8h_source.html b/DejaVuSansBold9_8h_source.html index 641f415b..107787b7 100644 --- a/DejaVuSansBold9_8h_source.html +++ b/DejaVuSansBold9_8h_source.html @@ -257,7 +257,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/DejaVuSansItalic9_8h_source.html b/DejaVuSansItalic9_8h_source.html index 4cc1474d..d8c4ac37 100644 --- a/DejaVuSansItalic9_8h_source.html +++ b/DejaVuSansItalic9_8h_source.html @@ -257,7 +257,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/EAX_8cpp_source.html b/EAX_8cpp_source.html index 58161502..05d1d2d4 100644 --- a/EAX_8cpp_source.html +++ b/EAX_8cpp_source.html @@ -301,7 +301,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/EAX_8h_source.html b/EAX_8h_source.html index b40a7e11..d286dfa6 100644 --- a/EAX_8h_source.html +++ b/EAX_8h_source.html @@ -196,7 +196,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/EEPROM24_8cpp_source.html b/EEPROM24_8cpp_source.html index e2f75d25..ff396923 100644 --- a/EEPROM24_8cpp_source.html +++ b/EEPROM24_8cpp_source.html @@ -282,7 +282,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/EEPROM24_8h_source.html b/EEPROM24_8h_source.html index f528689e..d6a32236 100644 --- a/EEPROM24_8h_source.html +++ b/EEPROM24_8h_source.html @@ -186,7 +186,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/Ed25519_8cpp_source.html b/Ed25519_8cpp_source.html index 382729b5..4b682c2f 100644 --- a/Ed25519_8cpp_source.html +++ b/Ed25519_8cpp_source.html @@ -571,7 +571,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/Ed25519_8h_source.html b/Ed25519_8h_source.html index 3b24c612..c7814185 100644 --- a/Ed25519_8h_source.html +++ b/Ed25519_8h_source.html @@ -168,7 +168,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/Field_8cpp_source.html b/Field_8cpp_source.html index c608c73b..2801ad5d 100644 --- a/Field_8cpp_source.html +++ b/Field_8cpp_source.html @@ -196,7 +196,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/Field_8h_source.html b/Field_8h_source.html index 101bf55f..d8da47aa 100644 --- a/Field_8h_source.html +++ b/Field_8h_source.html @@ -164,7 +164,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/Form_8cpp_source.html b/Form_8cpp_source.html index bdcbfc74..bd1170b6 100644 --- a/Form_8cpp_source.html +++ b/Form_8cpp_source.html @@ -278,7 +278,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/Form_8h_source.html b/Form_8h_source.html index 7764398d..0ff78206 100644 --- a/Form_8h_source.html +++ b/Form_8h_source.html @@ -172,7 +172,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/GCM_8cpp_source.html b/GCM_8cpp_source.html index a932ec2b..b2fdafd4 100644 --- a/GCM_8cpp_source.html +++ b/GCM_8cpp_source.html @@ -353,7 +353,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/GCM_8h_source.html b/GCM_8h_source.html index 2bbb10c1..a5960617 100644 --- a/GCM_8h_source.html +++ b/GCM_8h_source.html @@ -191,7 +191,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/GF128_8cpp_source.html b/GF128_8cpp_source.html index 728ef341..056b6dbb 100644 --- a/GF128_8cpp_source.html +++ b/GF128_8cpp_source.html @@ -578,7 +578,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/GF128_8h_source.html b/GF128_8h_source.html index b9046e7a..cba4b10b 100644 --- a/GF128_8h_source.html +++ b/GF128_8h_source.html @@ -139,7 +139,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/GHASH_8cpp_source.html b/GHASH_8cpp_source.html index dda6e7d0..36c0dfa8 100644 --- a/GHASH_8cpp_source.html +++ b/GHASH_8cpp_source.html @@ -190,7 +190,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/GHASH_8h_source.html b/GHASH_8h_source.html index b14470e0..c935f5fb 100644 --- a/GHASH_8h_source.html +++ b/GHASH_8h_source.html @@ -150,7 +150,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/Hash_8cpp_source.html b/Hash_8cpp_source.html index 619d6b08..01134fb7 100644 --- a/Hash_8cpp_source.html +++ b/Hash_8cpp_source.html @@ -151,7 +151,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/Hash_8h_source.html b/Hash_8h_source.html index bd761edb..c6552015 100644 --- a/Hash_8h_source.html +++ b/Hash_8h_source.html @@ -154,7 +154,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/I2CMaster_8cpp_source.html b/I2CMaster_8cpp_source.html index b2c26877..715f7fca 100644 --- a/I2CMaster_8cpp_source.html +++ b/I2CMaster_8cpp_source.html @@ -115,7 +115,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/I2CMaster_8h_source.html b/I2CMaster_8h_source.html index b9fae769..48db898d 100644 --- a/I2CMaster_8h_source.html +++ b/I2CMaster_8h_source.html @@ -140,7 +140,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/IRreceiver_8cpp_source.html b/IRreceiver_8cpp_source.html index 78e6f4ae..8e9fbcd6 100644 --- a/IRreceiver_8cpp_source.html +++ b/IRreceiver_8cpp_source.html @@ -261,7 +261,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/IRreceiver_8h_source.html b/IRreceiver_8h_source.html index 1904726d..738e940b 100644 --- a/IRreceiver_8h_source.html +++ b/IRreceiver_8h_source.html @@ -157,7 +157,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/IntField_8cpp_source.html b/IntField_8cpp_source.html index 58368922..312b4fe9 100644 --- a/IntField_8cpp_source.html +++ b/IntField_8cpp_source.html @@ -208,7 +208,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/IntField_8h_source.html b/IntField_8h_source.html index b0e0683d..ab345ff8 100644 --- a/IntField_8h_source.html +++ b/IntField_8h_source.html @@ -173,7 +173,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/KeccakCore_8cpp_source.html b/KeccakCore_8cpp_source.html index ef20c045..af13cdec 100644 --- a/KeccakCore_8cpp_source.html +++ b/KeccakCore_8cpp_source.html @@ -1991,7 +1991,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/KeccakCore_8h_source.html b/KeccakCore_8h_source.html index ac7d961d..cf74eea9 100644 --- a/KeccakCore_8h_source.html +++ b/KeccakCore_8h_source.html @@ -167,7 +167,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/LCD_8cpp_source.html b/LCD_8cpp_source.html index f79f7146..ed995a0e 100644 --- a/LCD_8cpp_source.html +++ b/LCD_8cpp_source.html @@ -290,7 +290,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/LCD_8h_source.html b/LCD_8h_source.html index 17a324e6..1b9a5765 100644 --- a/LCD_8h_source.html +++ b/LCD_8h_source.html @@ -202,7 +202,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/ListField_8cpp_source.html b/ListField_8cpp_source.html index 9441d5df..e1c9173d 100644 --- a/ListField_8cpp_source.html +++ b/ListField_8cpp_source.html @@ -221,7 +221,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/ListField_8h_source.html b/ListField_8h_source.html index 1f7c7c94..18d3b370 100644 --- a/ListField_8h_source.html +++ b/ListField_8h_source.html @@ -159,7 +159,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/LoginShell_8cpp_source.html b/LoginShell_8cpp_source.html index cd3e2fc5..4729ef32 100644 --- a/LoginShell_8cpp_source.html +++ b/LoginShell_8cpp_source.html @@ -126,7 +126,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/LoginShell_8h_source.html b/LoginShell_8h_source.html index 06f21098..1fded03b 100644 --- a/LoginShell_8h_source.html +++ b/LoginShell_8h_source.html @@ -155,7 +155,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/Melody_8cpp_source.html b/Melody_8cpp_source.html index 2738ab03..e71b5b5e 100644 --- a/Melody_8cpp_source.html +++ b/Melody_8cpp_source.html @@ -215,7 +215,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/Melody_8h_source.html b/Melody_8h_source.html index f196cee1..6fe83142 100644 --- a/Melody_8h_source.html +++ b/Melody_8h_source.html @@ -258,7 +258,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/Mono5x7_8h_source.html b/Mono5x7_8h_source.html index 23c06e5f..d8dd7594 100644 --- a/Mono5x7_8h_source.html +++ b/Mono5x7_8h_source.html @@ -246,7 +246,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/NewHope_8cpp_source.html b/NewHope_8cpp_source.html index d0e287f6..c400ed03 100644 --- a/NewHope_8cpp_source.html +++ b/NewHope_8cpp_source.html @@ -1253,7 +1253,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/NewHope_8h_source.html b/NewHope_8h_source.html index ef800adb..c3eea3ee 100644 --- a/NewHope_8h_source.html +++ b/NewHope_8h_source.html @@ -171,7 +171,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/NoiseSource_8cpp_source.html b/NoiseSource_8cpp_source.html index 9746d325..d9ae3cda 100644 --- a/NoiseSource_8cpp_source.html +++ b/NoiseSource_8cpp_source.html @@ -138,7 +138,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/NoiseSource_8h_source.html b/NoiseSource_8h_source.html index 0e3b7618..86000179 100644 --- a/NoiseSource_8h_source.html +++ b/NoiseSource_8h_source.html @@ -142,7 +142,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/OFB_8cpp_source.html b/OFB_8cpp_source.html index 8552bca8..d91aaca1 100644 --- a/OFB_8cpp_source.html +++ b/OFB_8cpp_source.html @@ -206,7 +206,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/OFB_8h_source.html b/OFB_8h_source.html index 2cf95bbd..2ba468cf 100644 --- a/OFB_8h_source.html +++ b/OFB_8h_source.html @@ -171,7 +171,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/OMAC_8cpp_source.html b/OMAC_8cpp_source.html index 4e40f923..2488b646 100644 --- a/OMAC_8cpp_source.html +++ b/OMAC_8cpp_source.html @@ -208,7 +208,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/OMAC_8h_source.html b/OMAC_8h_source.html index 1ad42c0c..1ddac239 100644 --- a/OMAC_8h_source.html +++ b/OMAC_8h_source.html @@ -152,7 +152,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/P521_8cpp_source.html b/P521_8cpp_source.html index 744a2a9a..81f682f8 100644 --- a/P521_8cpp_source.html +++ b/P521_8cpp_source.html @@ -1333,7 +1333,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/P521_8h_source.html b/P521_8h_source.html index 58b8a7e3..fea62787 100644 --- a/P521_8h_source.html +++ b/P521_8h_source.html @@ -215,7 +215,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/Poly1305_8cpp_source.html b/Poly1305_8cpp_source.html index 9309443e..d3b439ef 100644 --- a/Poly1305_8cpp_source.html +++ b/Poly1305_8cpp_source.html @@ -358,7 +358,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/Poly1305_8h_source.html b/Poly1305_8h_source.html index ceee0906..a79edf58 100644 --- a/Poly1305_8h_source.html +++ b/Poly1305_8h_source.html @@ -153,7 +153,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/PowerSave_8cpp_source.html b/PowerSave_8cpp_source.html index 3adefbbb..293df9b2 100644 --- a/PowerSave_8cpp_source.html +++ b/PowerSave_8cpp_source.html @@ -155,7 +155,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/PowerSave_8h_source.html b/PowerSave_8h_source.html index b94a7a83..0fb8682a 100644 --- a/PowerSave_8h_source.html +++ b/PowerSave_8h_source.html @@ -158,7 +158,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/RC5_8h_source.html b/RC5_8h_source.html index f1d78d62..089f4d91 100644 --- a/RC5_8h_source.html +++ b/RC5_8h_source.html @@ -435,7 +435,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/RNG_8cpp_source.html b/RNG_8cpp_source.html index 803dcc51..2a9ca811 100644 --- a/RNG_8cpp_source.html +++ b/RNG_8cpp_source.html @@ -651,7 +651,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/RNG_8h_source.html b/RNG_8h_source.html index 631ac31f..47c6b101 100644 --- a/RNG_8h_source.html +++ b/RNG_8h_source.html @@ -177,7 +177,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/RTC_8cpp_source.html b/RTC_8cpp_source.html index 02111500..65094720 100644 --- a/RTC_8cpp_source.html +++ b/RTC_8cpp_source.html @@ -380,7 +380,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/RTC_8h_source.html b/RTC_8h_source.html index 2398d2e2..85cf626c 100644 --- a/RTC_8h_source.html +++ b/RTC_8h_source.html @@ -237,7 +237,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/RingOscillatorNoiseSource_8cpp_source.html b/RingOscillatorNoiseSource_8cpp_source.html index 5501d9c3..f5470b4a 100644 --- a/RingOscillatorNoiseSource_8cpp_source.html +++ b/RingOscillatorNoiseSource_8cpp_source.html @@ -285,7 +285,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/RingOscillatorNoiseSource_8h_source.html b/RingOscillatorNoiseSource_8h_source.html index 815b4f69..63de51b4 100644 --- a/RingOscillatorNoiseSource_8h_source.html +++ b/RingOscillatorNoiseSource_8h_source.html @@ -145,7 +145,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/SHA256_8cpp_source.html b/SHA256_8cpp_source.html index be282a5d..05250219 100644 --- a/SHA256_8cpp_source.html +++ b/SHA256_8cpp_source.html @@ -339,7 +339,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/SHA256_8h_source.html b/SHA256_8h_source.html index d866d2a8..8a4a6b76 100644 --- a/SHA256_8h_source.html +++ b/SHA256_8h_source.html @@ -160,7 +160,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/SHA3_8cpp_source.html b/SHA3_8cpp_source.html index 030351ef..202fdddf 100644 --- a/SHA3_8cpp_source.html +++ b/SHA3_8cpp_source.html @@ -257,7 +257,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/SHA3_8h_source.html b/SHA3_8h_source.html index 499495c2..32c4d86d 100644 --- a/SHA3_8h_source.html +++ b/SHA3_8h_source.html @@ -188,7 +188,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/SHA512_8cpp_source.html b/SHA512_8cpp_source.html index d886205c..cf7e7e1f 100644 --- a/SHA512_8cpp_source.html +++ b/SHA512_8cpp_source.html @@ -355,7 +355,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/SHA512_8h_source.html b/SHA512_8h_source.html index a72e7bf2..71907522 100644 --- a/SHA512_8h_source.html +++ b/SHA512_8h_source.html @@ -166,7 +166,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/SHAKE_8cpp_source.html b/SHAKE_8cpp_source.html index 97d965a3..519e07ea 100644 --- a/SHAKE_8cpp_source.html +++ b/SHAKE_8cpp_source.html @@ -192,7 +192,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/SHAKE_8h_source.html b/SHAKE_8h_source.html index 5ab9594b..3a5f8291 100644 --- a/SHAKE_8h_source.html +++ b/SHAKE_8h_source.html @@ -174,7 +174,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/Shell_8cpp_source.html b/Shell_8cpp_source.html index 8167448a..396af323 100644 --- a/Shell_8cpp_source.html +++ b/Shell_8cpp_source.html @@ -848,7 +848,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/Shell_8h_source.html b/Shell_8h_source.html index 348a310a..61e2e627 100644 --- a/Shell_8h_source.html +++ b/Shell_8h_source.html @@ -273,7 +273,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/SoftI2C_8cpp_source.html b/SoftI2C_8cpp_source.html index a820bbb7..e71f4e16 100644 --- a/SoftI2C_8cpp_source.html +++ b/SoftI2C_8cpp_source.html @@ -283,7 +283,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/SoftI2C_8h_source.html b/SoftI2C_8h_source.html index 23642c8c..c9ac8433 100644 --- a/SoftI2C_8h_source.html +++ b/SoftI2C_8h_source.html @@ -157,7 +157,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/SpeckSmall_8cpp_source.html b/SpeckSmall_8cpp_source.html index e2ccad70..cdc67251 100644 --- a/SpeckSmall_8cpp_source.html +++ b/SpeckSmall_8cpp_source.html @@ -317,405 +317,339 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
261 void SpeckSmall::decryptBlock(uint8_t *output, const uint8_t *input)
262 {
263 #if USE_AVR_INLINE_ASM
-
264  uint64_t l[4];
-
265  uint32_t xlow, xhigh, ylow, yhigh;
-
266  uint32_t slow, shigh;
-
267  uint8_t li_in = (rounds + 3) & 0x03;
-
268  uint8_t li_out = (((rounds - 31) + li_in) & 0x03) * 8;
-
269  li_in *= 8;
-
270 
-
271  // Prepare to expand the key schedule.
-
272  __asm__ __volatile__ (
-
273  "add r30,%4\n" // Z = &(this->l[li_out])
-
274  "adc r31,__zero_reg__\n"
-
275  "ld __tmp_reg__,Z\n" // s = this->l[li_out]
-
276  "std %A0,__tmp_reg__\n"
-
277  "ldd __tmp_reg__,Z+1\n"
-
278  "std %B0,__tmp_reg__\n"
-
279  "ldd __tmp_reg__,Z+2\n"
-
280  "std %C0,__tmp_reg__\n"
-
281  "ldd __tmp_reg__,Z+3\n"
-
282  "std %D0,__tmp_reg__\n"
-
283  "ldd __tmp_reg__,Z+4\n"
-
284  "std %A1,__tmp_reg__\n"
-
285  "ldd __tmp_reg__,Z+5\n"
-
286  "std %B1,__tmp_reg__\n"
-
287  "ldd __tmp_reg__,Z+6\n"
-
288  "std %C1,__tmp_reg__\n"
-
289  "ldd __tmp_reg__,Z+7\n"
-
290  "std %D1,__tmp_reg__\n"
-
291  "sub r30,%4\n" // Point Z back to the start of this->l.
-
292  "sbc r31,__zero_reg__\n"
-
293 
-
294  "ldi r25,32\n" // Copy the entire this->l array into l.
-
295  "1:\n"
-
296  "ld __tmp_reg__,Z+\n"
-
297  "st X+,__tmp_reg__\n"
-
298  "dec r25\n"
-
299  "brne 1b\n"
-
300  : "=Q"(slow), "=Q"(shigh)
-
301  : "z"(this->l), "x"(l), "r"(li_out)
-
302  : "r25"
-
303  );
-
304 
-
305  // Unpack the input into the x and y variables, converting
-
306  // from big-endian into little-endian in the process.
-
307  __asm__ __volatile__ (
-
308  "ld %D1,Z\n"
-
309  "ldd %C1,Z+1\n"
-
310  "ldd %B1,Z+2\n"
-
311  "ldd %A1,Z+3\n"
-
312  "ldd %D0,Z+4\n"
-
313  "ldd %C0,Z+5\n"
-
314  "ldd %B0,Z+6\n"
-
315  "ldd %A0,Z+7\n"
-
316  "ldd %D3,Z+8\n"
-
317  "ldd %C3,Z+9\n"
-
318  "ldd %B3,Z+10\n"
-
319  "ldd %A3,Z+11\n"
-
320  "ldd %D2,Z+12\n"
-
321  "ldd %C2,Z+13\n"
-
322  "ldd %B2,Z+14\n"
-
323  "ldd %A2,Z+15\n"
-
324  : "=r"(xlow), "=r"(xhigh), "=r"(ylow), "=r"(yhigh)
-
325  : "z"(input)
-
326  );
-
327 
-
328  // Perform all decryption rounds while expanding the key schedule in-place.
-
329  __asm__ __volatile__ (
-
330  "mov r23,%9\n" // i = rounds - 1
-
331  "dec r23\n"
-
332  "1:\n"
-
333 
-
334  // Adjust x and y for this round using the key schedule word s.
-
335 
-
336  // y = rightRotate3_64(x ^ y);
-
337  "eor %A2,%A0\n" // y ^= x
-
338  "eor %B2,%B0\n"
-
339  "eor %C2,%C0\n"
-
340  "eor %D2,%D0\n"
-
341  "eor %A3,%A1\n"
-
342  "eor %B3,%B1\n"
-
343  "eor %C3,%C1\n"
-
344  "eor %D3,%D1\n"
-
345 
-
346  "bst %A2,0\n" // y = rightRotate1_64(y)
-
347  "ror %D3\n"
-
348  "ror %C3\n"
-
349  "ror %B3\n"
-
350  "ror %A3\n"
-
351  "ror %D2\n"
-
352  "ror %C2\n"
-
353  "ror %B2\n"
-
354  "ror %A2\n"
-
355  "bld %D3,7\n"
-
356 
-
357  "bst %A2,0\n" // y = rightRotate1_64(y)
-
358  "ror %D3\n"
-
359  "ror %C3\n"
-
360  "ror %B3\n"
-
361  "ror %A3\n"
-
362  "ror %D2\n"
-
363  "ror %C2\n"
-
364  "ror %B2\n"
-
365  "ror %A2\n"
-
366  "bld %D3,7\n"
-
367 
-
368  "bst %A2,0\n" // y = rightRotate1_64(y)
-
369  "ror %D3\n"
-
370  "ror %C3\n"
-
371  "ror %B3\n"
-
372  "ror %A3\n"
-
373  "ror %D2\n"
-
374  "ror %C2\n"
-
375  "ror %B2\n"
-
376  "ror %A2\n"
-
377  "bld %D3,7\n"
-
378 
-
379  // x = leftRotate8_64((x ^ s) - y);
-
380  "ldd __tmp_reg__,%A4\n" // x ^= s
-
381  "eor %A0,__tmp_reg__\n"
-
382  "ldd __tmp_reg__,%B4\n"
-
383  "eor %B0,__tmp_reg__\n"
-
384  "ldd __tmp_reg__,%C4\n"
-
385  "eor %C0,__tmp_reg__\n"
-
386  "ldd __tmp_reg__,%D4\n"
-
387  "eor %D0,__tmp_reg__\n"
-
388  "ldd __tmp_reg__,%A5\n"
-
389  "eor %A1,__tmp_reg__\n"
-
390  "ldd __tmp_reg__,%B5\n"
-
391  "eor %B1,__tmp_reg__\n"
-
392  "ldd __tmp_reg__,%C5\n"
-
393  "eor %C1,__tmp_reg__\n"
-
394  "ldd __tmp_reg__,%D5\n"
-
395  "eor %D1,__tmp_reg__\n"
-
396 
-
397  "sub %A0,%A2\n" // x -= y
-
398  "sbc %B0,%B2\n"
-
399  "sbc %C0,%C2\n"
-
400  "sbc %D0,%D2\n"
-
401  "sbc %A1,%A3\n"
-
402  "sbc %B1,%B3\n"
-
403  "sbc %C1,%C3\n"
-
404  "sbc %D1,%D3\n"
-
405 
-
406  "mov __tmp_reg__,%D1\n" // x = lefRotate8_64(x)
-
407  "mov %D1,%C1\n"
-
408  "mov %C1,%B1\n"
-
409  "mov %B1,%A1\n"
-
410  "mov %A1,%D0\n"
-
411  "mov %D0,%C0\n"
-
412  "mov %C0,%B0\n"
-
413  "mov %B0,%A0\n"
-
414  "mov %A0,__tmp_reg__\n"
-
415 
-
416  // On the last round we don't need to compute s so we
-
417  // can exit early here if i == 0.
-
418  "or r23,r23\n" // if (i == 0)
-
419  "brne 2f\n"
-
420  "rjmp 3f\n"
-
421  "2:\n"
-
422  "dec r23\n" // --i
-
423 
-
424  // Save x and y on the stack so we can reuse registers for t and s.
-
425  "push %A0\n"
-
426  "push %B0\n"
-
427  "push %C0\n"
-
428  "push %D0\n"
-
429  "push %A1\n"
-
430  "push %B1\n"
-
431  "push %C1\n"
-
432  "push %D1\n"
-
433  "push %A2\n"
-
434  "push %B2\n"
-
435  "push %C2\n"
-
436  "push %D2\n"
-
437  "push %A3\n"
-
438  "push %B3\n"
-
439  "push %C3\n"
-
440  "push %D3\n"
-
441 
-
442  // Compute the key schedule word s for the next round.
-
443 
-
444  // li_out = (li_out + 3) & 0x03;
-
445  "ldd r24,%7\n"
-
446  "ldi r25,24\n"
-
447  "add r24,r25\n"
-
448  "andi r24,0x1f\n"
-
449  "std %7,r24\n"
-
450 
-
451  // s = rightRotate3_64(s ^ l[li_out]);
-
452  "add %A8,r24\n" // Z = &(l[li_out])
-
453  "adc %B8,__zero_reg__\n"
-
454 
-
455  "ld %A0,Z\n" // t = l[li_out]
-
456  "ldd %B0,Z+1\n"
-
457  "ldd %C0,Z+2\n"
-
458  "ldd %D0,Z+3\n"
-
459  "ldd %A1,Z+4\n"
-
460  "ldd %B1,Z+5\n"
-
461  "ldd %C1,Z+6\n"
-
462  "ldd %D1,Z+7\n"
-
463 
-
464  "ldd %A2,%A4\n" // load s
-
465  "ldd %B2,%B4\n"
-
466  "ldd %C2,%C4\n"
-
467  "ldd %D2,%D4\n"
-
468  "ldd %A3,%A5\n"
-
469  "ldd %B3,%B5\n"
-
470  "ldd %C3,%C5\n"
-
471  "ldd %D3,%D5\n"
-
472 
-
473  "eor %A2,%A0\n" // s ^= t
-
474  "eor %B2,%B0\n"
-
475  "eor %C2,%C0\n"
-
476  "eor %D2,%D0\n"
-
477  "eor %A3,%A1\n"
-
478  "eor %B3,%B1\n"
-
479  "eor %C3,%C1\n"
-
480  "eor %D3,%D1\n"
-
481 
-
482  "bst %A2,0\n" // s = rightRotate1_64(s)
-
483  "ror %D3\n"
-
484  "ror %C3\n"
-
485  "ror %B3\n"
-
486  "ror %A3\n"
-
487  "ror %D2\n"
-
488  "ror %C2\n"
-
489  "ror %B2\n"
-
490  "ror %A2\n"
-
491  "bld %D3,7\n"
-
492 
-
493  "bst %A2,0\n" // s = rightRotate1_64(s)
-
494  "ror %D3\n"
-
495  "ror %C3\n"
-
496  "ror %B3\n"
-
497  "ror %A3\n"
-
498  "ror %D2\n"
-
499  "ror %C2\n"
-
500  "ror %B2\n"
-
501  "ror %A2\n"
-
502  "bld %D3,7\n"
-
503 
-
504  "bst %A2,0\n" // s = rightRotate1_64(s)
-
505  "ror %D3\n"
-
506  "ror %C3\n"
-
507  "ror %B3\n"
-
508  "ror %A3\n"
-
509  "ror %D2\n"
-
510  "ror %C2\n"
-
511  "ror %B2\n"
-
512  "ror %A2\n"
-
513  "bld %D3,7\n"
-
514 
-
515  "sub %A8,r24\n" // Z -= li_out
-
516  "sbc %B8,__zero_reg__\n"
-
517 
-
518  // li_in = (li_in + 3) & 0x03;
-
519  "ldd r24,%6\n"
-
520  "add r24,r25\n"
-
521  "andi r24,0x1f\n"
-
522  "std %6,r24\n"
-
523 
-
524  // l[li_in] = leftRotate8_64((l[li_out] ^ i) - s);
-
525  "add %A8,r24\n" // Z = &(l[li_in])
-
526  "adc %B8,__zero_reg__\n"
-
527 
-
528  "eor %A0,r23\n" // t ^= i
-
529 
-
530  "sub %A0,%A2\n" // t -= s
-
531  "sbc %B0,%B2\n"
-
532  "sbc %C0,%C2\n"
-
533  "sbc %D0,%D2\n"
-
534  "sbc %A1,%A3\n"
-
535  "sbc %B1,%B3\n"
-
536  "sbc %C1,%C3\n"
-
537  "sbc %D1,%D3\n"
-
538 
-
539  "st Z,%D1\n" // l[li_in] = leftRotate8_64(t)
-
540  "std Z+1,%A0\n"
-
541  "std Z+2,%B0\n"
-
542  "std Z+3,%C0\n"
-
543  "std Z+4,%D0\n"
-
544  "std Z+5,%A1\n"
-
545  "std Z+6,%B1\n"
-
546  "std Z+7,%C1\n"
-
547 
-
548  "sub %A8,r24\n" // Z -= li_in
-
549  "sbc %B8,__zero_reg__\n"
-
550 
-
551  "std %A4,%A2\n" // store s
-
552  "std %B4,%B2\n"
-
553  "std %C4,%C2\n"
-
554  "std %D4,%D2\n"
-
555  "std %A5,%A3\n"
-
556  "std %B5,%B3\n"
-
557  "std %C5,%C3\n"
-
558  "std %D5,%D3\n"
-
559 
-
560  // Pop registers from the stack to recover the x and y values.
-
561  "pop %D3\n"
-
562  "pop %C3\n"
-
563  "pop %B3\n"
-
564  "pop %A3\n"
-
565  "pop %D2\n"
-
566  "pop %C2\n"
-
567  "pop %B2\n"
-
568  "pop %A2\n"
-
569  "pop %D1\n"
-
570  "pop %C1\n"
-
571  "pop %B1\n"
-
572  "pop %A1\n"
-
573  "pop %D0\n"
-
574  "pop %C0\n"
-
575  "pop %B0\n"
-
576  "pop %A0\n"
-
577 
-
578  // Bottom of the loop.
-
579  "rjmp 1b\n"
-
580  "3:\n"
+
264  // Automatically generated by the genspeck tool.
+
265  uint64_t l[5];
+
266  uint8_t r = rounds;
+
267  uint8_t li_in = ((r + 3) & 0x03) * 8;
+
268  uint8_t li_out = ((((r - 31) & 0x03) * 8) + li_in) & 0x1F;
+
269  __asm__ __volatile__ (
+
270  "ldd r25,%4\n"
+
271  "ldi r24,32\n"
+
272  "1:\n"
+
273  "ld __tmp_reg__,X+\n"
+
274  "st Z+,__tmp_reg__\n"
+
275  "dec r24\n"
+
276  "brne 1b\n"
+
277  "movw r26,r30\n"
+
278  "sbiw r30,32\n"
+
279  "add r30,r25\n"
+
280  "adc r31,__zero_reg__\n"
+
281  "ld __tmp_reg__,Z\n"
+
282  "st X+,__tmp_reg__\n"
+
283  "ldd __tmp_reg__,Z+1\n"
+
284  "st X+,__tmp_reg__\n"
+
285  "ldd __tmp_reg__,Z+2\n"
+
286  "st X+,__tmp_reg__\n"
+
287  "ldd __tmp_reg__,Z+3\n"
+
288  "st X+,__tmp_reg__\n"
+
289  "ldd __tmp_reg__,Z+4\n"
+
290  "st X+,__tmp_reg__\n"
+
291  "ldd __tmp_reg__,Z+5\n"
+
292  "st X+,__tmp_reg__\n"
+
293  "ldd __tmp_reg__,Z+6\n"
+
294  "st X+,__tmp_reg__\n"
+
295  "ldd __tmp_reg__,Z+7\n"
+
296  "st X+,__tmp_reg__\n"
+
297  "sub r30,r25\n"
+
298  "sbc r31,__zero_reg__\n"
+
299  "movw r26,%A2\n"
+
300  "ld r15,X+\n"
+
301  "ld r14,X+\n"
+
302  "ld r13,X+\n"
+
303  "ld r12,X+\n"
+
304  "ld r11,X+\n"
+
305  "ld r10,X+\n"
+
306  "ld r9,X+\n"
+
307  "ld r8,X+\n"
+
308  "ld r23,X+\n"
+
309  "ld r22,X+\n"
+
310  "ld r21,X+\n"
+
311  "ld r20,X+\n"
+
312  "ld r19,X+\n"
+
313  "ld r18,X+\n"
+
314  "ld r17,X+\n"
+
315  "ld r16,X\n"
+
316  "ldd %A2,%6\n"
+
317  "mov %B2,r25\n"
+
318  "ldd r25,%5\n"
+
319  "dec r25\n"
+
320  "movw r26,r30\n"
+
321  "adiw r26,40\n"
+
322  "2:\n"
+
323  "eor r16,r8\n"
+
324  "eor r17,r9\n"
+
325  "eor r18,r10\n"
+
326  "eor r19,r11\n"
+
327  "eor r20,r12\n"
+
328  "eor r21,r13\n"
+
329  "eor r22,r14\n"
+
330  "eor r23,r15\n"
+
331  "bst r16,0\n"
+
332  "ror r23\n"
+
333  "ror r22\n"
+
334  "ror r21\n"
+
335  "ror r20\n"
+
336  "ror r19\n"
+
337  "ror r18\n"
+
338  "ror r17\n"
+
339  "ror r16\n"
+
340  "bld r23,7\n"
+
341  "bst r16,0\n"
+
342  "ror r23\n"
+
343  "ror r22\n"
+
344  "ror r21\n"
+
345  "ror r20\n"
+
346  "ror r19\n"
+
347  "ror r18\n"
+
348  "ror r17\n"
+
349  "ror r16\n"
+
350  "bld r23,7\n"
+
351  "bst r16,0\n"
+
352  "ror r23\n"
+
353  "ror r22\n"
+
354  "ror r21\n"
+
355  "ror r20\n"
+
356  "ror r19\n"
+
357  "ror r18\n"
+
358  "ror r17\n"
+
359  "ror r16\n"
+
360  "bld r23,7\n"
+
361  "ld __tmp_reg__,-X\n"
+
362  "eor __tmp_reg__,r15\n"
+
363  "ld r15,-X\n"
+
364  "eor r15,r14\n"
+
365  "ld r14,-X\n"
+
366  "eor r14,r13\n"
+
367  "ld r13,-X\n"
+
368  "eor r13,r12\n"
+
369  "ld r12,-X\n"
+
370  "eor r12,r11\n"
+
371  "ld r11,-X\n"
+
372  "eor r11,r10\n"
+
373  "ld r10,-X\n"
+
374  "eor r10,r9\n"
+
375  "ld r9,-X\n"
+
376  "eor r9,r8\n"
+
377  "mov r8,__tmp_reg__\n"
+
378  "sub r9,r16\n"
+
379  "sbc r10,r17\n"
+
380  "sbc r11,r18\n"
+
381  "sbc r12,r19\n"
+
382  "sbc r13,r20\n"
+
383  "sbc r14,r21\n"
+
384  "sbc r15,r22\n"
+
385  "sbc r8,r23\n"
+
386  "or r25,r25\n"
+
387  "brne 3f\n"
+
388  "rjmp 4f\n"
+
389  "3:\n"
+
390  "dec r25\n"
+
391  "push r8\n"
+
392  "push r9\n"
+
393  "push r10\n"
+
394  "push r11\n"
+
395  "push r12\n"
+
396  "push r13\n"
+
397  "push r14\n"
+
398  "push r15\n"
+
399  "push r16\n"
+
400  "push r17\n"
+
401  "push r18\n"
+
402  "push r19\n"
+
403  "push r20\n"
+
404  "push r21\n"
+
405  "push r22\n"
+
406  "push r23\n"
+
407  "ldi r24,24\n"
+
408  "add %A2,r24\n"
+
409  "add %B2,r24\n"
+
410  "ldi r24,0x1F\n"
+
411  "and %A2,r24\n"
+
412  "and %B2,r24\n"
+
413  "ld r16,X+\n"
+
414  "ld r17,X+\n"
+
415  "ld r18,X+\n"
+
416  "ld r19,X+\n"
+
417  "ld r20,X+\n"
+
418  "ld r21,X+\n"
+
419  "ld r22,X+\n"
+
420  "ld r23,X+\n"
+
421  "add r30,%B2\n"
+
422  "adc r31,__zero_reg__\n"
+
423  "ld r8,Z\n"
+
424  "ldd r9,Z+1\n"
+
425  "ldd r10,Z+2\n"
+
426  "ldd r11,Z+3\n"
+
427  "ldd r12,Z+4\n"
+
428  "ldd r13,Z+5\n"
+
429  "ldd r14,Z+6\n"
+
430  "ldd r15,Z+7\n"
+
431  "sub r30,%B2\n"
+
432  "sbc r31,__zero_reg__\n"
+
433  "eor r16,r8\n"
+
434  "eor r17,r9\n"
+
435  "eor r18,r10\n"
+
436  "eor r19,r11\n"
+
437  "eor r20,r12\n"
+
438  "eor r21,r13\n"
+
439  "eor r22,r14\n"
+
440  "eor r23,r15\n"
+
441  "bst r16,0\n"
+
442  "ror r23\n"
+
443  "ror r22\n"
+
444  "ror r21\n"
+
445  "ror r20\n"
+
446  "ror r19\n"
+
447  "ror r18\n"
+
448  "ror r17\n"
+
449  "ror r16\n"
+
450  "bld r23,7\n"
+
451  "bst r16,0\n"
+
452  "ror r23\n"
+
453  "ror r22\n"
+
454  "ror r21\n"
+
455  "ror r20\n"
+
456  "ror r19\n"
+
457  "ror r18\n"
+
458  "ror r17\n"
+
459  "ror r16\n"
+
460  "bld r23,7\n"
+
461  "bst r16,0\n"
+
462  "ror r23\n"
+
463  "ror r22\n"
+
464  "ror r21\n"
+
465  "ror r20\n"
+
466  "ror r19\n"
+
467  "ror r18\n"
+
468  "ror r17\n"
+
469  "ror r16\n"
+
470  "bld r23,7\n"
+
471  "st -X,r23\n"
+
472  "st -X,r22\n"
+
473  "st -X,r21\n"
+
474  "st -X,r20\n"
+
475  "st -X,r19\n"
+
476  "st -X,r18\n"
+
477  "st -X,r17\n"
+
478  "st -X,r16\n"
+
479  "adiw r26,8\n"
+
480  "eor r8,r25\n"
+
481  "sub r8,r16\n"
+
482  "sbc r9,r17\n"
+
483  "sbc r10,r18\n"
+
484  "sbc r11,r19\n"
+
485  "sbc r12,r20\n"
+
486  "sbc r13,r21\n"
+
487  "sbc r14,r22\n"
+
488  "sbc r15,r23\n"
+
489  "add r30,%A2\n"
+
490  "adc r31,__zero_reg__\n"
+
491  "st Z,r15\n"
+
492  "std Z+1,r8\n"
+
493  "std Z+2,r9\n"
+
494  "std Z+3,r10\n"
+
495  "std Z+4,r11\n"
+
496  "std Z+5,r12\n"
+
497  "std Z+6,r13\n"
+
498  "std Z+7,r14\n"
+
499  "sub r30,%A2\n"
+
500  "sbc r31,__zero_reg__\n"
+
501  "pop r23\n"
+
502  "pop r22\n"
+
503  "pop r21\n"
+
504  "pop r20\n"
+
505  "pop r19\n"
+
506  "pop r18\n"
+
507  "pop r17\n"
+
508  "pop r16\n"
+
509  "pop r15\n"
+
510  "pop r14\n"
+
511  "pop r13\n"
+
512  "pop r12\n"
+
513  "pop r11\n"
+
514  "pop r10\n"
+
515  "pop r9\n"
+
516  "pop r8\n"
+
517  "rjmp 2b\n"
+
518  "4:\n"
+
519  "ldd r26,%A3\n"
+
520  "ldd r27,%B3\n"
+
521  "st X+,r15\n"
+
522  "st X+,r14\n"
+
523  "st X+,r13\n"
+
524  "st X+,r12\n"
+
525  "st X+,r11\n"
+
526  "st X+,r10\n"
+
527  "st X+,r9\n"
+
528  "st X+,r8\n"
+
529  "st X+,r23\n"
+
530  "st X+,r22\n"
+
531  "st X+,r21\n"
+
532  "st X+,r20\n"
+
533  "st X+,r19\n"
+
534  "st X+,r18\n"
+
535  "st X+,r17\n"
+
536  "st X,r16\n"
+
537  : : "x"(this->l), "z"(l), "r"(input), "Q"(output), "Q"(li_out), "Q"(r), "Q"(li_in)
+
538  : "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
+
539  "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23", "memory"
+
540  , "r24", "r25"
+
541  );
+
542 #else
+
543  uint64_t l[4];
+
544  uint64_t x, y, s;
+
545  uint8_t round;
+
546  uint8_t li_in = (rounds + 3) & 0x03;
+
547  uint8_t li_out = ((rounds - 31) + li_in) & 0x03;
+
548 
+
549  // Prepare the key schedule, starting at the end.
+
550  for (round = li_in; round != li_out; round = (round + 1) & 0x03)
+
551  l[round] = this->l[round];
+
552  s = this->l[li_out];
+
553 
+
554  // Unpack the input and convert from big-endian.
+
555  unpack64(x, input);
+
556  unpack64(y, input + 8);
+
557 
+
558  // Perform all decryption rounds except the last while
+
559  // expanding the decryption schedule on the fly.
+
560  for (uint8_t round = rounds - 1; round > 0; --round) {
+
561  // Decrypt using the current round key.
+
562  y = rightRotate3_64(x ^ y);
+
563  x = leftRotate8_64((x ^ s) - y);
+
564 
+
565  // Generate the round key for the previous round.
+
566  li_in = (li_in + 3) & 0x03;
+
567  li_out = (li_out + 3) & 0x03;
+
568  s = rightRotate3_64(s ^ l[li_out]);
+
569  l[li_in] = leftRotate8_64((l[li_out] ^ (round - 1)) - s);
+
570  }
+
571 
+
572  // Perform the final decryption round.
+
573  y = rightRotate3_64(x ^ y);
+
574  x = leftRotate8_64((x ^ s) - y);
+
575 
+
576  // Pack the output and convert to big-endian.
+
577  pack64(output, x);
+
578  pack64(output + 8, y);
+
579 #endif
+
580 }
581 
-
582  : "+r"(xlow), "+r"(xhigh), "+r"(ylow), "+r"(yhigh),
-
583  "+Q"(slow), "+Q"(shigh), "+Q"(li_in), "+Q"(li_out)
-
584  : "z"(l), "r"(rounds)
-
585  : "r23", "r24", "r25"
-
586  );
-
587 
-
588  // Pack the results into the output and convert back to big-endian.
-
589  __asm__ __volatile__ (
-
590  "st Z,%D1\n"
-
591  "std Z+1,%C1\n"
-
592  "std Z+2,%B1\n"
-
593  "std Z+3,%A1\n"
-
594  "std Z+4,%D0\n"
-
595  "std Z+5,%C0\n"
-
596  "std Z+6,%B0\n"
-
597  "std Z+7,%A0\n"
-
598  "std Z+8,%D3\n"
-
599  "std Z+9,%C3\n"
-
600  "std Z+10,%B3\n"
-
601  "std Z+11,%A3\n"
-
602  "std Z+12,%D2\n"
-
603  "std Z+13,%C2\n"
-
604  "std Z+14,%B2\n"
-
605  "std Z+15,%A2\n"
-
606  : : "r"(xlow), "r"(xhigh), "r"(ylow), "r"(yhigh), "z"(output)
-
607  );
-
608 #else
-
609  uint64_t l[4];
-
610  uint64_t x, y, s;
-
611  uint8_t round;
-
612  uint8_t li_in = (rounds + 3) & 0x03;
-
613  uint8_t li_out = ((rounds - 31) + li_in) & 0x03;
-
614 
-
615  // Prepare the key schedule, starting at the end.
-
616  for (round = li_in; round != li_out; round = (round + 1) & 0x03)
-
617  l[round] = this->l[round];
-
618  s = this->l[li_out];
-
619 
-
620  // Unpack the input and convert from big-endian.
-
621  unpack64(x, input);
-
622  unpack64(y, input + 8);
-
623 
-
624  // Perform all decryption rounds except the last while
-
625  // expanding the decryption schedule on the fly.
-
626  for (uint8_t round = rounds - 1; round > 0; --round) {
-
627  // Decrypt using the current round key.
-
628  y = rightRotate3_64(x ^ y);
-
629  x = leftRotate8_64((x ^ s) - y);
-
630 
-
631  // Generate the round key for the previous round.
-
632  li_in = (li_in + 3) & 0x03;
-
633  li_out = (li_out + 3) & 0x03;
-
634  s = rightRotate3_64(s ^ l[li_out]);
-
635  l[li_in] = leftRotate8_64((l[li_out] ^ (round - 1)) - s);
-
636  }
-
637 
-
638  // Perform the final decryption round.
-
639  y = rightRotate3_64(x ^ y);
-
640  x = leftRotate8_64((x ^ s) - y);
-
641 
-
642  // Pack the output and convert to big-endian.
-
643  pack64(output, x);
-
644  pack64(output + 8, y);
-
645 #endif
-
646 }
-
647 
-
648 void SpeckSmall::clear()
-
649 {
-
650  SpeckTiny::clear();
-
651  clean(l);
-
652 }
+
582 void SpeckSmall::clear()
+
583 {
+
584  SpeckTiny::clear();
+
585  clean(l);
+
586 }
bool setKey(const uint8_t *key, size_t len)
Sets the key to use for future encryption and decryption operations.
Definition: SpeckTiny.cpp:109
void decryptBlock(uint8_t *output, const uint8_t *input)
Decrypts a single block using this cipher.
Definition: SpeckSmall.cpp:261
bool setKey(const uint8_t *key, size_t len)
Sets the key to use for future encryption and decryption operations.
Definition: SpeckSmall.cpp:94
-
void clear()
Clears all security-sensitive state from this block cipher.
Definition: SpeckSmall.cpp:648
+
void clear()
Clears all security-sensitive state from this block cipher.
Definition: SpeckSmall.cpp:582
SpeckSmall()
Constructs a small-memory Speck block cipher with no initial key.
Definition: SpeckSmall.cpp:85
-
void clear()
Clears all security-sensitive state from this block cipher.
Definition: SpeckTiny.cpp:532
+
void clear()
Clears all security-sensitive state from this block cipher.
Definition: SpeckTiny.cpp:453
diff --git a/SpeckSmall_8h_source.html b/SpeckSmall_8h_source.html index e55d2818..17036858 100644 --- a/SpeckSmall_8h_source.html +++ b/SpeckSmall_8h_source.html @@ -136,12 +136,12 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
Speck block cipher with a 128-bit block size (small-memory version).
Definition: SpeckSmall.h:28
void decryptBlock(uint8_t *output, const uint8_t *input)
Decrypts a single block using this cipher.
Definition: SpeckSmall.cpp:261
bool setKey(const uint8_t *key, size_t len)
Sets the key to use for future encryption and decryption operations.
Definition: SpeckSmall.cpp:94
-
void clear()
Clears all security-sensitive state from this block cipher.
Definition: SpeckSmall.cpp:648
+
void clear()
Clears all security-sensitive state from this block cipher.
Definition: SpeckSmall.cpp:582
SpeckSmall()
Constructs a small-memory Speck block cipher with no initial key.
Definition: SpeckSmall.cpp:85
diff --git a/SpeckTiny_8cpp_source.html b/SpeckTiny_8cpp_source.html index d3ae3efd..d0f1a3ef 100644 --- a/SpeckTiny_8cpp_source.html +++ b/SpeckTiny_8cpp_source.html @@ -209,394 +209,315 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
156 void SpeckTiny::encryptBlock(uint8_t *output, const uint8_t *input)
157 {
158 #if USE_AVR_INLINE_ASM
-
159  uint64_t l[4];
-
160  uint32_t xlow, xhigh, ylow, yhigh;
-
161  uint32_t slow, shigh;
-
162  uint8_t li_in = 0;
-
163  uint8_t li_out = (rounds - 31) * 8;
-
164 
-
165  // Copy the "k" array into "s" and the "l" array.
-
166  __asm__ __volatile__ (
-
167  "ldd r25,%4\n" // r25 = li_out
-
168 
-
169  "ld __tmp_reg__,Z+\n"
-
170  "std %A0,__tmp_reg__\n"
-
171  "ld __tmp_reg__,Z+\n"
-
172  "std %B0,__tmp_reg__\n"
-
173  "ld __tmp_reg__,Z+\n"
-
174  "std %C0,__tmp_reg__\n"
-
175  "ld __tmp_reg__,Z+\n"
-
176  "std %D0,__tmp_reg__\n"
-
177  "ld __tmp_reg__,Z+\n"
-
178  "std %A1,__tmp_reg__\n"
-
179  "ld __tmp_reg__,Z+\n"
-
180  "std %B1,__tmp_reg__\n"
-
181  "ld __tmp_reg__,Z+\n"
-
182  "std %C1,__tmp_reg__\n"
-
183  "ld __tmp_reg__,Z+\n"
-
184  "std %D1,__tmp_reg__\n"
-
185 
-
186  "1:\n" // l[0..] = k[1..]
-
187  "ld __tmp_reg__,Z+\n"
-
188  "st X+,__tmp_reg__\n"
-
189  "dec r25\n"
-
190  "brne 1b\n"
-
191  : "=Q"(slow), "=Q"(shigh)
-
192  : "z"(k), "x"(l), "Q"(li_out)
-
193  : "r25"
-
194  );
-
195 
-
196  // Unpack the input into the x and y variables, converting
-
197  // from big-endian into little-endian in the process.
-
198  __asm__ __volatile__ (
-
199  "ld %D1,Z\n"
-
200  "ldd %C1,Z+1\n"
-
201  "ldd %B1,Z+2\n"
-
202  "ldd %A1,Z+3\n"
-
203  "ldd %D0,Z+4\n"
-
204  "ldd %C0,Z+5\n"
-
205  "ldd %B0,Z+6\n"
-
206  "ldd %A0,Z+7\n"
-
207  "ldd %D3,Z+8\n"
-
208  "ldd %C3,Z+9\n"
-
209  "ldd %B3,Z+10\n"
-
210  "ldd %A3,Z+11\n"
-
211  "ldd %D2,Z+12\n"
-
212  "ldd %C2,Z+13\n"
-
213  "ldd %B2,Z+14\n"
-
214  "ldd %A2,Z+15\n"
-
215  : "=r"(xlow), "=r"(xhigh), "=r"(ylow), "=r"(yhigh)
-
216  : "z"(input)
-
217  );
-
218 
-
219  // Perform all encryption rounds while expanding the key schedule in-place.
-
220  __asm__ __volatile__ (
-
221  "mov r23,__zero_reg__\n" // i = 0
-
222  "1:\n"
-
223 
-
224  // Adjust x and y for this round using the key schedule word s.
-
225 
-
226  // x = (rightRotate8_64(x) + y) ^ s;
-
227  "mov __tmp_reg__,%A0\n" // x = rightRotate8_64(x)
-
228  "mov %A0,%B0\n"
-
229  "mov %B0,%C0\n"
-
230  "mov %C0,%D0\n"
-
231  "mov %D0,%A1\n"
-
232  "mov %A1,%B1\n"
-
233  "mov %B1,%C1\n"
-
234  "mov %C1,%D1\n"
-
235  "mov %D1,__tmp_reg__\n"
-
236 
-
237  "add %A0,%A2\n" // x += y
-
238  "adc %B0,%B2\n"
-
239  "adc %C0,%C2\n"
-
240  "adc %D0,%D2\n"
-
241  "adc %A1,%A3\n"
-
242  "adc %B1,%B3\n"
-
243  "adc %C1,%C3\n"
-
244  "adc %D1,%D3\n"
-
245 
-
246  "ldd __tmp_reg__,%A4\n" // x ^= s
-
247  "eor %A0,__tmp_reg__\n"
-
248  "ldd __tmp_reg__,%B4\n"
-
249  "eor %B0,__tmp_reg__\n"
-
250  "ldd __tmp_reg__,%C4\n"
-
251  "eor %C0,__tmp_reg__\n"
-
252  "ldd __tmp_reg__,%D4\n"
-
253  "eor %D0,__tmp_reg__\n"
-
254  "ldd __tmp_reg__,%A5\n"
-
255  "eor %A1,__tmp_reg__\n"
-
256  "ldd __tmp_reg__,%B5\n"
-
257  "eor %B1,__tmp_reg__\n"
-
258  "ldd __tmp_reg__,%C5\n"
-
259  "eor %C1,__tmp_reg__\n"
-
260  "ldd __tmp_reg__,%D5\n"
-
261  "eor %D1,__tmp_reg__\n"
-
262 
-
263  // y = leftRotate3_64(y) ^ x;
-
264  "lsl %A2\n" // y = leftRotate1_64(y)
-
265  "rol %B2\n"
-
266  "rol %C2\n"
-
267  "rol %D2\n"
-
268  "rol %A3\n"
-
269  "rol %B3\n"
-
270  "rol %C3\n"
-
271  "rol %D3\n"
-
272  "adc %A2,__zero_reg__\n"
-
273 
-
274  "lsl %A2\n" // y = leftRotate1_64(y)
-
275  "rol %B2\n"
-
276  "rol %C2\n"
-
277  "rol %D2\n"
-
278  "rol %A3\n"
-
279  "rol %B3\n"
-
280  "rol %C3\n"
-
281  "rol %D3\n"
-
282 
-
283  "adc %A2,__zero_reg__\n"
-
284  "lsl %A2\n" // y = leftRotate1_64(y)
-
285  "rol %B2\n"
-
286  "rol %C2\n"
-
287  "rol %D2\n"
-
288  "rol %A3\n"
-
289  "rol %B3\n"
-
290  "rol %C3\n"
-
291  "rol %D3\n"
-
292  "adc %A2,__zero_reg__\n"
-
293 
-
294  "eor %A2,%A0\n" // y ^= x
-
295  "eor %B2,%B0\n"
-
296  "eor %C2,%C0\n"
-
297  "eor %D2,%D0\n"
-
298  "eor %A3,%A1\n"
-
299  "eor %B3,%B1\n"
-
300  "eor %C3,%C1\n"
-
301  "eor %D3,%D1\n"
-
302 
-
303  // On the last round we don't need to compute s so we
-
304  // can exit early here if (i + 1) == rounds.
-
305  "mov __tmp_reg__,r23\n" // temp = i + 1
-
306  "inc __tmp_reg__\n"
-
307  "cp __tmp_reg__,%9\n" // if (temp == rounds) ...
-
308  "brne 2f\n"
-
309  "rjmp 3f\n"
-
310  "2:\n"
-
311 
-
312  // Save x and y on the stack so we can reuse registers for t and s.
-
313  "push %A0\n"
-
314  "push %B0\n"
-
315  "push %C0\n"
-
316  "push %D0\n"
-
317  "push %A1\n"
-
318  "push %B1\n"
-
319  "push %C1\n"
-
320  "push %D1\n"
-
321  "push %A2\n"
-
322  "push %B2\n"
-
323  "push %C2\n"
-
324  "push %D2\n"
-
325  "push %A3\n"
-
326  "push %B3\n"
-
327  "push %C3\n"
-
328  "push %D3\n"
-
329 
-
330  // Compute the key schedule word s for the next round.
-
331 
-
332  // l[li_out] = (s + rightRotate8_64(l[li_in])) ^ i;
-
333  "ldd r24,%6\n" // Z = &(l[li_in])
-
334  "add %A8,r24\n"
-
335  "adc %B8,__zero_reg__\n"
-
336 
-
337  "ld %D1,Z+\n" // t = rightRotate8_64(l[li_in])
-
338  "ld %A0,Z+\n"
-
339  "ld %B0,Z+\n"
-
340  "ld %C0,Z+\n"
-
341  "ld %D0,Z+\n"
-
342  "ld %A1,Z+\n"
-
343  "ld %B1,Z+\n"
-
344  "ld %C1,Z+\n"
-
345 
-
346  "ldd %A2,%A4\n" // load s
-
347  "ldd %B2,%B4\n"
-
348  "ldd %C2,%C4\n"
-
349  "ldd %D2,%D4\n"
-
350  "ldd %A3,%A5\n"
-
351  "ldd %B3,%B5\n"
-
352  "ldd %C3,%C5\n"
-
353  "ldd %D3,%D5\n"
-
354 
-
355  "add %A0,%A2\n" // t += s
-
356  "adc %B0,%B2\n"
-
357  "adc %C0,%C2\n"
-
358  "adc %D0,%D2\n"
-
359  "adc %A1,%A3\n"
-
360  "adc %B1,%B3\n"
-
361  "adc %C1,%C3\n"
-
362  "adc %D1,%D3\n"
-
363 
-
364  "eor %A0,r23\n" // t ^= i
-
365 
-
366  // Z = Z - li_in + li_out
-
367  "ldi r25,8\n" // li_in = li_in + 1
-
368  "add r24,r25\n"
-
369  "sub %A8,r24\n" // return Z to its initial value
-
370  "sbc %B8,__zero_reg__\n"
-
371  "andi r24,0x1f\n" // li_in = li_in % 4
-
372  "std %6,r24\n"
-
373  "ldd r24,%7\n" // Z = &(l[li_out])
-
374  "add %A8,r24\n"
-
375  "adc %B8,__zero_reg__\n"
-
376 
-
377  "st Z+,%A0\n" // l[li_out] = t
-
378  "st Z+,%B0\n"
-
379  "st Z+,%C0\n"
-
380  "st Z+,%D0\n"
-
381  "st Z+,%A1\n"
-
382  "st Z+,%B1\n"
-
383  "st Z+,%C1\n"
-
384  "st Z+,%D1\n"
-
385 
-
386  "add r24,r25\n" // li_out = li_out + 1
-
387  "sub %A8,r24\n" // return Z to its initial value
-
388  "sbc %B8,__zero_reg__\n"
-
389  "andi r24,0x1f\n" // li_out = li_out % 4
-
390  "std %7,r24\n"
-
391 
-
392  // s = leftRotate3_64(s) ^ l[li_out];
-
393  "lsl %A2\n" // s = leftRotate1_64(s)
-
394  "rol %B2\n"
-
395  "rol %C2\n"
-
396  "rol %D2\n"
-
397  "rol %A3\n"
-
398  "rol %B3\n"
-
399  "rol %C3\n"
-
400  "rol %D3\n"
-
401  "adc %A2,__zero_reg__\n"
-
402 
-
403  "lsl %A2\n" // s = leftRotate1_64(s)
-
404  "rol %B2\n"
-
405  "rol %C2\n"
-
406  "rol %D2\n"
-
407  "rol %A3\n"
-
408  "rol %B3\n"
-
409  "rol %C3\n"
-
410  "rol %D3\n"
-
411  "adc %A2,__zero_reg__\n"
-
412 
-
413  "lsl %A2\n" // s = leftRotate1_64(s)
-
414  "rol %B2\n"
-
415  "rol %C2\n"
-
416  "rol %D2\n"
-
417  "rol %A3\n"
-
418  "rol %B3\n"
-
419  "rol %C3\n"
-
420  "rol %D3\n"
-
421  "adc %A2,__zero_reg__\n"
+
159  // Automatically generated by the genspeck tool.
+
160  uint64_t l[5];
+
161  uint8_t r = rounds;
+
162  uint8_t mb = (r - 31) * 8;
+
163  __asm__ __volatile__ (
+
164  "movw r8,r30\n"
+
165  "ldd r16,%4\n"
+
166  "ldi r24,8\n"
+
167  "add r16,r24\n"
+
168  "1:\n"
+
169  "ld __tmp_reg__,X+\n"
+
170  "st Z+,__tmp_reg__\n"
+
171  "dec r16\n"
+
172  "brne 1b\n"
+
173  "movw r30,r8\n"
+
174  "movw r26,%A2\n"
+
175  "ld r15,X+\n"
+
176  "ld r14,X+\n"
+
177  "ld r13,X+\n"
+
178  "ld r12,X+\n"
+
179  "ld r11,X+\n"
+
180  "ld r10,X+\n"
+
181  "ld r9,X+\n"
+
182  "ld r8,X+\n"
+
183  "ld r23,X+\n"
+
184  "ld r22,X+\n"
+
185  "ld r21,X+\n"
+
186  "ld r20,X+\n"
+
187  "ld r19,X+\n"
+
188  "ld r18,X+\n"
+
189  "ld r17,X+\n"
+
190  "ld r16,X\n"
+
191  "clr %A2\n"
+
192  "ldd %B2,%4\n"
+
193  "clr r25\n"
+
194  "2:\n"
+
195  "add r9,r16\n"
+
196  "adc r10,r17\n"
+
197  "adc r11,r18\n"
+
198  "adc r12,r19\n"
+
199  "adc r13,r20\n"
+
200  "adc r14,r21\n"
+
201  "adc r15,r22\n"
+
202  "adc r8,r23\n"
+
203  "ld __tmp_reg__,Z+\n"
+
204  "eor __tmp_reg__,r9\n"
+
205  "ld r9,Z+\n"
+
206  "eor r9,r10\n"
+
207  "ld r10,Z+\n"
+
208  "eor r10,r11\n"
+
209  "ld r11,Z+\n"
+
210  "eor r11,r12\n"
+
211  "ld r12,Z+\n"
+
212  "eor r12,r13\n"
+
213  "ld r13,Z+\n"
+
214  "eor r13,r14\n"
+
215  "ld r14,Z+\n"
+
216  "eor r14,r15\n"
+
217  "ld r15,Z+\n"
+
218  "eor r15,r8\n"
+
219  "mov r8,__tmp_reg__\n"
+
220  "lsl r16\n"
+
221  "rol r17\n"
+
222  "rol r18\n"
+
223  "rol r19\n"
+
224  "rol r20\n"
+
225  "rol r21\n"
+
226  "rol r22\n"
+
227  "rol r23\n"
+
228  "adc r16, __zero_reg__\n"
+
229  "lsl r16\n"
+
230  "rol r17\n"
+
231  "rol r18\n"
+
232  "rol r19\n"
+
233  "rol r20\n"
+
234  "rol r21\n"
+
235  "rol r22\n"
+
236  "rol r23\n"
+
237  "adc r16, __zero_reg__\n"
+
238  "lsl r16\n"
+
239  "rol r17\n"
+
240  "rol r18\n"
+
241  "rol r19\n"
+
242  "rol r20\n"
+
243  "rol r21\n"
+
244  "rol r22\n"
+
245  "rol r23\n"
+
246  "adc r16, __zero_reg__\n"
+
247  "eor r16,r8\n"
+
248  "eor r17,r9\n"
+
249  "eor r18,r10\n"
+
250  "eor r19,r11\n"
+
251  "eor r20,r12\n"
+
252  "eor r21,r13\n"
+
253  "eor r22,r14\n"
+
254  "eor r23,r15\n"
+
255  "mov __tmp_reg__,r25\n"
+
256  "inc __tmp_reg__\n"
+
257  "ldd r24,%5\n"
+
258  "cp __tmp_reg__,r24\n"
+
259  "brne 3f\n"
+
260  "rjmp 4f\n"
+
261  "3:\n"
+
262  "push r8\n"
+
263  "push r9\n"
+
264  "push r10\n"
+
265  "push r11\n"
+
266  "push r12\n"
+
267  "push r13\n"
+
268  "push r14\n"
+
269  "push r15\n"
+
270  "push r16\n"
+
271  "push r17\n"
+
272  "push r18\n"
+
273  "push r19\n"
+
274  "push r20\n"
+
275  "push r21\n"
+
276  "push r22\n"
+
277  "push r23\n"
+
278  "sbiw r30,8\n"
+
279  "ld r16,Z\n"
+
280  "ldd r17,Z+1\n"
+
281  "ldd r18,Z+2\n"
+
282  "ldd r19,Z+3\n"
+
283  "ldd r20,Z+4\n"
+
284  "ldd r21,Z+5\n"
+
285  "ldd r22,Z+6\n"
+
286  "ldd r23,Z+7\n"
+
287  "add r30,%A2\n"
+
288  "adc r31,__zero_reg__\n"
+
289  "ldd r15,Z+8\n"
+
290  "ldd r8,Z+9\n"
+
291  "ldd r9,Z+10\n"
+
292  "ldd r10,Z+11\n"
+
293  "ldd r11,Z+12\n"
+
294  "ldd r12,Z+13\n"
+
295  "ldd r13,Z+14\n"
+
296  "ldd r14,Z+15\n"
+
297  "add r8,r16\n"
+
298  "adc r9,r17\n"
+
299  "adc r10,r18\n"
+
300  "adc r11,r19\n"
+
301  "adc r12,r20\n"
+
302  "adc r13,r21\n"
+
303  "adc r14,r22\n"
+
304  "adc r15,r23\n"
+
305  "eor r8,r25\n"
+
306  "sub r30,%A2\n"
+
307  "sbc r31,__zero_reg__\n"
+
308  "add r30,%B2\n"
+
309  "adc r31,__zero_reg__\n"
+
310  "std Z+8,r8\n"
+
311  "std Z+9,r9\n"
+
312  "std Z+10,r10\n"
+
313  "std Z+11,r11\n"
+
314  "std Z+12,r12\n"
+
315  "std Z+13,r13\n"
+
316  "std Z+14,r14\n"
+
317  "std Z+15,r15\n"
+
318  "sub r30,%B2\n"
+
319  "sbc r31,__zero_reg__\n"
+
320  "lsl r16\n"
+
321  "rol r17\n"
+
322  "rol r18\n"
+
323  "rol r19\n"
+
324  "rol r20\n"
+
325  "rol r21\n"
+
326  "rol r22\n"
+
327  "rol r23\n"
+
328  "adc r16, __zero_reg__\n"
+
329  "lsl r16\n"
+
330  "rol r17\n"
+
331  "rol r18\n"
+
332  "rol r19\n"
+
333  "rol r20\n"
+
334  "rol r21\n"
+
335  "rol r22\n"
+
336  "rol r23\n"
+
337  "adc r16, __zero_reg__\n"
+
338  "lsl r16\n"
+
339  "rol r17\n"
+
340  "rol r18\n"
+
341  "rol r19\n"
+
342  "rol r20\n"
+
343  "rol r21\n"
+
344  "rol r22\n"
+
345  "rol r23\n"
+
346  "adc r16, __zero_reg__\n"
+
347  "eor r16,r8\n"
+
348  "eor r17,r9\n"
+
349  "eor r18,r10\n"
+
350  "eor r19,r11\n"
+
351  "eor r20,r12\n"
+
352  "eor r21,r13\n"
+
353  "eor r22,r14\n"
+
354  "eor r23,r15\n"
+
355  "st Z,r16\n"
+
356  "std Z+1,r17\n"
+
357  "std Z+2,r18\n"
+
358  "std Z+3,r19\n"
+
359  "std Z+4,r20\n"
+
360  "std Z+5,r21\n"
+
361  "std Z+6,r22\n"
+
362  "std Z+7,r23\n"
+
363  "ldi r24,8\n"
+
364  "add %A2,r24\n"
+
365  "add %B2,r24\n"
+
366  "ldi r24,0x1F\n"
+
367  "and %A2,r24\n"
+
368  "and %B2,r24\n"
+
369  "pop r23\n"
+
370  "pop r22\n"
+
371  "pop r21\n"
+
372  "pop r20\n"
+
373  "pop r19\n"
+
374  "pop r18\n"
+
375  "pop r17\n"
+
376  "pop r16\n"
+
377  "pop r15\n"
+
378  "pop r14\n"
+
379  "pop r13\n"
+
380  "pop r12\n"
+
381  "pop r11\n"
+
382  "pop r10\n"
+
383  "pop r9\n"
+
384  "pop r8\n"
+
385  "inc r25\n"
+
386  "rjmp 2b\n"
+
387  "4:\n"
+
388  "ldd r26,%A3\n"
+
389  "ldd r27,%B3\n"
+
390  "st X+,r15\n"
+
391  "st X+,r14\n"
+
392  "st X+,r13\n"
+
393  "st X+,r12\n"
+
394  "st X+,r11\n"
+
395  "st X+,r10\n"
+
396  "st X+,r9\n"
+
397  "st X+,r8\n"
+
398  "st X+,r23\n"
+
399  "st X+,r22\n"
+
400  "st X+,r21\n"
+
401  "st X+,r20\n"
+
402  "st X+,r19\n"
+
403  "st X+,r18\n"
+
404  "st X+,r17\n"
+
405  "st X,r16\n"
+
406  : : "x"(k), "z"(l), "r"(input), "Q"(output), "Q"(mb), "Q"(r)
+
407  : "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
+
408  "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23", "memory"
+
409  , "r24", "r25"
+
410  );
+
411 #else
+
412  uint64_t l[4];
+
413  uint64_t x, y, s;
+
414  uint8_t round;
+
415  uint8_t li_in = 0;
+
416  uint8_t li_out = rounds - 31;
+
417  uint8_t i = 0;
+
418 
+
419  // Copy the input block into the work registers.
+
420  unpack64(x, input);
+
421  unpack64(y, input + 8);
422 
-
423  "eor %A2,%A0\n" // s ^= l[li_out]
-
424  "eor %B2,%B0\n"
-
425  "eor %C2,%C0\n"
-
426  "eor %D2,%D0\n"
-
427  "eor %A3,%A1\n"
-
428  "eor %B3,%B1\n"
-
429  "eor %C3,%C1\n"
-
430  "eor %D3,%D1\n"
-
431 
-
432  "std %A4,%A2\n" // store s
-
433  "std %B4,%B2\n"
-
434  "std %C4,%C2\n"
-
435  "std %D4,%D2\n"
-
436  "std %A5,%A3\n"
-
437  "std %B5,%B3\n"
-
438  "std %C5,%C3\n"
-
439  "std %D5,%D3\n"
-
440 
-
441  // Pop registers from the stack to recover the x and y values.
-
442  "pop %D3\n"
-
443  "pop %C3\n"
-
444  "pop %B3\n"
-
445  "pop %A3\n"
-
446  "pop %D2\n"
-
447  "pop %C2\n"
-
448  "pop %B2\n"
-
449  "pop %A2\n"
-
450  "pop %D1\n"
-
451  "pop %C1\n"
-
452  "pop %B1\n"
-
453  "pop %A1\n"
-
454  "pop %D0\n"
-
455  "pop %C0\n"
-
456  "pop %B0\n"
-
457  "pop %A0\n"
-
458 
-
459  // Bottom of the loop.
-
460  "inc r23\n"
-
461  "rjmp 1b\n"
-
462  "3:\n"
-
463 
-
464  : "+r"(xlow), "+r"(xhigh), "+r"(ylow), "+r"(yhigh),
-
465  "+Q"(slow), "+Q"(shigh), "+Q"(li_in), "+Q"(li_out)
-
466  : "z"(l), "r"(rounds)
-
467  : "r23", "r24", "r25"
-
468  );
-
469 
-
470  // Pack the results into the output and convert back to big-endian.
-
471  __asm__ __volatile__ (
-
472  "st Z,%D1\n"
-
473  "std Z+1,%C1\n"
-
474  "std Z+2,%B1\n"
-
475  "std Z+3,%A1\n"
-
476  "std Z+4,%D0\n"
-
477  "std Z+5,%C0\n"
-
478  "std Z+6,%B0\n"
-
479  "std Z+7,%A0\n"
-
480  "std Z+8,%D3\n"
-
481  "std Z+9,%C3\n"
-
482  "std Z+10,%B3\n"
-
483  "std Z+11,%A3\n"
-
484  "std Z+12,%D2\n"
-
485  "std Z+13,%C2\n"
-
486  "std Z+14,%B2\n"
-
487  "std Z+15,%A2\n"
-
488  : : "r"(xlow), "r"(xhigh), "r"(ylow), "r"(yhigh), "z"(output)
-
489  );
-
490 #else
-
491  uint64_t l[4];
-
492  uint64_t x, y, s;
-
493  uint8_t round;
-
494  uint8_t li_in = 0;
-
495  uint8_t li_out = rounds - 31;
-
496  uint8_t i = 0;
-
497 
-
498  // Copy the input block into the work registers.
-
499  unpack64(x, input);
-
500  unpack64(y, input + 8);
-
501 
-
502  // Prepare the key schedule.
-
503  memcpy(l, k + 1, li_out * sizeof(uint64_t));
-
504  s = k[0];
-
505 
-
506  // Perform all encryption rounds except the last.
-
507  for (round = rounds - 1; round > 0; --round, ++i) {
-
508  // Perform the round with the current key schedule word.
-
509  x = (rightRotate8_64(x) + y) ^ s;
-
510  y = leftRotate3_64(y) ^ x;
-
511 
-
512  // Calculate the next key schedule word.
-
513  l[li_out] = (s + rightRotate8_64(l[li_in])) ^ i;
-
514  s = leftRotate3_64(s) ^ l[li_out];
-
515  li_in = (li_in + 1) & 0x03;
-
516  li_out = (li_out + 1) & 0x03;
-
517  }
-
518 
-
519  // Perform the final round and copy to the output.
-
520  x = (rightRotate8_64(x) + y) ^ s;
-
521  y = leftRotate3_64(y) ^ x;
-
522  pack64(output, x);
-
523  pack64(output + 8, y);
-
524 #endif
-
525 }
-
526 
-
527 void SpeckTiny::decryptBlock(uint8_t *output, const uint8_t *input)
-
528 {
-
529  // Decryption is not supported by SpeckTiny. Use SpeckSmall instead.
-
530 }
-
531 
-
532 void SpeckTiny::clear()
-
533 {
-
534  clean(k);
-
535 }
+
423  // Prepare the key schedule.
+
424  memcpy(l, k + 1, li_out * sizeof(uint64_t));
+
425  s = k[0];
+
426 
+
427  // Perform all encryption rounds except the last.
+
428  for (round = rounds - 1; round > 0; --round, ++i) {
+
429  // Perform the round with the current key schedule word.
+
430  x = (rightRotate8_64(x) + y) ^ s;
+
431  y = leftRotate3_64(y) ^ x;
+
432 
+
433  // Calculate the next key schedule word.
+
434  l[li_out] = (s + rightRotate8_64(l[li_in])) ^ i;
+
435  s = leftRotate3_64(s) ^ l[li_out];
+
436  li_in = (li_in + 1) & 0x03;
+
437  li_out = (li_out + 1) & 0x03;
+
438  }
+
439 
+
440  // Perform the final round and copy to the output.
+
441  x = (rightRotate8_64(x) + y) ^ s;
+
442  y = leftRotate3_64(y) ^ x;
+
443  pack64(output, x);
+
444  pack64(output + 8, y);
+
445 #endif
+
446 }
+
447 
+
448 void SpeckTiny::decryptBlock(uint8_t *output, const uint8_t *input)
+
449 {
+
450  // Decryption is not supported by SpeckTiny. Use SpeckSmall instead.
+
451 }
+
452 
+
453 void SpeckTiny::clear()
+
454 {
+
455  clean(k);
+
456 }
SpeckTiny()
Constructs a tiny-memory Speck block cipher with no initial key.
Definition: SpeckTiny.cpp:76
size_t blockSize() const
Size of a single block processed by this cipher, in bytes.
Definition: SpeckTiny.cpp:86
bool setKey(const uint8_t *key, size_t len)
Sets the key to use for future encryption and decryption operations.
Definition: SpeckTiny.cpp:109
void encryptBlock(uint8_t *output, const uint8_t *input)
Encrypts a single block using this cipher.
Definition: SpeckTiny.cpp:156
size_t keySize() const
Default size of the key for this block cipher, in bytes.
Definition: SpeckTiny.cpp:91
-
void decryptBlock(uint8_t *output, const uint8_t *input)
Decrypts a single block using this cipher.
Definition: SpeckTiny.cpp:527
-
void clear()
Clears all security-sensitive state from this block cipher.
Definition: SpeckTiny.cpp:532
+
void decryptBlock(uint8_t *output, const uint8_t *input)
Decrypts a single block using this cipher.
Definition: SpeckTiny.cpp:448
+
void clear()
Clears all security-sensitive state from this block cipher.
Definition: SpeckTiny.cpp:453
diff --git a/SpeckTiny_8h_source.html b/SpeckTiny_8h_source.html index 8d4ee0e0..0297d7c5 100644 --- a/SpeckTiny_8h_source.html +++ b/SpeckTiny_8h_source.html @@ -149,12 +149,12 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
Speck block cipher with a 128-bit block size (small-memory version).
Definition: SpeckSmall.h:28
void encryptBlock(uint8_t *output, const uint8_t *input)
Encrypts a single block using this cipher.
Definition: SpeckTiny.cpp:156
size_t keySize() const
Default size of the key for this block cipher, in bytes.
Definition: SpeckTiny.cpp:91
-
void decryptBlock(uint8_t *output, const uint8_t *input)
Decrypts a single block using this cipher.
Definition: SpeckTiny.cpp:527
-
void clear()
Clears all security-sensitive state from this block cipher.
Definition: SpeckTiny.cpp:532
+
void decryptBlock(uint8_t *output, const uint8_t *input)
Decrypts a single block using this cipher.
Definition: SpeckTiny.cpp:448
+
void clear()
Clears all security-sensitive state from this block cipher.
Definition: SpeckTiny.cpp:453
diff --git a/Speck_8cpp_source.html b/Speck_8cpp_source.html index 61973bc5..3fb96a85 100644 --- a/Speck_8cpp_source.html +++ b/Speck_8cpp_source.html @@ -162,524 +162,463 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
105 bool Speck::setKey(const uint8_t *key, size_t len)
106 {
107 #if USE_AVR_INLINE_ASM
-
108  uint64_t l[4];
-
109  uint8_t m, mb;
-
110  if (len == 32) {
-
111  m = 4;
-
112  mb = 3 * 8;
-
113  } else if (len == 24) {
-
114  m = 3;
-
115  mb = 2 * 8;
-
116  } else if (len == 16) {
-
117  m = 2;
-
118  mb = 8;
-
119  } else {
-
120  return false;
-
121  }
-
122  rounds = 30 + m;
-
123 
-
124  // Copy the first (m - 1) * 8 bytes of the key into the "l" array
-
125  // in reverse order to convert big endian into little-endian.
-
126  __asm__ __volatile__ (
-
127  "1:\n"
-
128  "ld __tmp_reg__,-Z\n"
-
129  "st X+,__tmp_reg__\n"
-
130  "dec %2\n"
-
131  "brne 1b\n"
-
132  : : "x"(l), "z"(key + len - 8), "r"(mb)
-
133  );
-
134 
-
135  // Copy the final 8 bytes of the key into k[0] in reverse order.
-
136  __asm__ __volatile__ (
-
137  "1:\n"
-
138  "ld __tmp_reg__,-Z\n"
-
139  "st X+,__tmp_reg__\n"
-
140  "dec %2\n"
-
141  "brne 1b\n"
-
142  : : "x"(k), "z"(key + len), "r"(8)
-
143  );
-
144 
-
145  // Expand the key to the full key schedule.
-
146  __asm__ __volatile__ (
-
147  "1:\n"
-
148  // l[li_out] = (k[i] + rightRotate8_64(l[li_in])) ^ i;
-
149  "add %A1,%2\n" // X = &(l[li_in])
-
150  "adc %B1,__zero_reg__\n"
-
151  "ld r15,X+\n" // x = rightRotate8_64(l[li_in])
-
152  "ld r8,X+\n"
-
153  "ld r9,X+\n"
-
154  "ld r10,X+\n"
-
155  "ld r11,X+\n"
-
156  "ld r12,X+\n"
-
157  "ld r13,X+\n"
-
158  "ld r14,X+\n"
-
159 
-
160  "ld r16,Z+\n" // y = k[i]
-
161  "ld r17,Z+\n"
-
162  "ld r18,Z+\n"
-
163  "ld r19,Z+\n"
-
164  "ld r20,Z+\n"
-
165  "ld r21,Z+\n"
-
166  "ld r22,Z+\n"
-
167  "ld r23,Z+\n"
-
168 
-
169  "add r8,r16\n" // x += y
-
170  "adc r9,r17\n"
-
171  "adc r10,r18\n"
-
172  "adc r11,r19\n"
-
173  "adc r12,r20\n"
-
174  "adc r13,r21\n"
-
175  "adc r14,r22\n"
-
176  "adc r15,r23\n"
-
177 
-
178  "eor r8,%4\n" // x ^= i
-
179 
-
180  // X = X - li_in + li_out
-
181  "ldi r24,8\n" // li_in = li_in + 1
-
182  "add %2,r24\n"
-
183  "sub %A1,%2\n" // return X to its initial value
-
184  "sbc %B1,__zero_reg__\n"
-
185  "ldi r25,0x1f\n"
-
186  "and %2,r25\n" // li_in = li_in % 4
-
187  "add %A1,%3\n" // X = &(l[li_out])
-
188  "adc %B1,__zero_reg__\n"
-
189 
-
190  "st X+,r8\n" // l[li_out] = x
-
191  "st X+,r9\n"
-
192  "st X+,r10\n"
-
193  "st X+,r11\n"
-
194  "st X+,r12\n"
-
195  "st X+,r13\n"
-
196  "st X+,r14\n"
-
197  "st X+,r15\n"
-
198 
-
199  "add %3,r24\n" // li_out = li_out + 1
-
200  "sub %A1,%3\n" // return X to its initial value
-
201  "sbc %B1,__zero_reg__\n"
-
202  "and %3,r25\n" // li_out = li_out % 4
-
203 
-
204  // k[i + 1] = leftRotate3_64(k[i]) ^ l[li_out];
-
205  "lsl r16\n" // y = leftRotate1_64(y)
-
206  "rol r17\n"
-
207  "rol r18\n"
-
208  "rol r19\n"
-
209  "rol r20\n"
-
210  "rol r21\n"
-
211  "rol r22\n"
-
212  "rol r23\n"
-
213  "adc r16,__zero_reg__\n"
-
214 
-
215  "lsl r16\n" // y = leftRotate1_64(y)
-
216  "rol r17\n"
-
217  "rol r18\n"
-
218  "rol r19\n"
-
219  "rol r20\n"
-
220  "rol r21\n"
-
221  "rol r22\n"
-
222  "rol r23\n"
-
223  "adc r16,__zero_reg__\n"
-
224 
-
225  "lsl r16\n" // y = leftRotate1_64(y)
-
226  "rol r17\n"
-
227  "rol r18\n"
-
228  "rol r19\n"
-
229  "rol r20\n"
-
230  "rol r21\n"
-
231  "rol r22\n"
-
232  "rol r23\n"
-
233  "adc r16,__zero_reg__\n"
-
234 
-
235  "eor r16,r8\n" // y ^= x
-
236  "eor r17,r9\n"
-
237  "eor r18,r10\n"
-
238  "eor r19,r11\n"
-
239  "eor r20,r12\n"
-
240  "eor r21,r13\n"
-
241  "eor r22,r14\n"
-
242  "eor r23,r15\n"
-
243 
-
244  "st Z,r16\n" // k[i + 1] = y
-
245  "std Z+1,r17\n"
-
246  "std Z+2,r18\n"
-
247  "std Z+3,r19\n"
-
248  "std Z+4,r20\n"
-
249  "std Z+5,r21\n"
-
250  "std Z+6,r22\n"
-
251  "std Z+7,r23\n"
-
252 
-
253  // Loop
-
254  "inc %4\n" // ++i
-
255  "dec %5\n" // --rounds
-
256  "breq 2f\n"
-
257  "rjmp 1b\n"
-
258  "2:\n"
-
259 
-
260  : : "z"(k), "x"(l),
-
261  "r"((uint8_t)0), // initial value of li_in
-
262  "r"((uint8_t)((m - 1) * 8)), // initial value of li_out
-
263  "r"(0), // initial value of i
-
264  "r"(rounds - 1)
-
265  : "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
-
266  "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23",
-
267  "r24", "r25"
-
268  );
-
269 #else
-
270  uint64_t l[4];
-
271  uint8_t m;
-
272  if (len == 32) {
-
273  m = 4;
-
274  unpack64(l[2], key);
-
275  unpack64(l[1], key + 8);
-
276  unpack64(l[0], key + 16);
-
277  unpack64(k[0], key + 24);
-
278  } else if (len == 24) {
-
279  m = 3;
-
280  unpack64(l[1], key);
-
281  unpack64(l[0], key + 8);
-
282  unpack64(k[0], key + 16);
-
283  } else if (len == 16) {
-
284  m = 2;
-
285  unpack64(l[0], key);
-
286  unpack64(k[0], key + 8);
-
287  } else {
-
288  return false;
-
289  }
-
290  rounds = 30 + m;
-
291  uint8_t li_in = 0;
-
292  uint8_t li_out = m - 1;
-
293  for (uint8_t i = 0; i < (rounds - 1); ++i) {
-
294  l[li_out] = (k[i] + rightRotate8_64(l[li_in])) ^ i;
-
295  k[i + 1] = leftRotate3_64(k[i]) ^ l[li_out];
-
296  if ((++li_in) >= m)
-
297  li_in = 0;
-
298  if ((++li_out) >= m)
-
299  li_out = 0;
-
300  }
-
301 #endif
-
302  clean(l);
-
303  return true;
-
304 }
-
305 
-
306 void Speck::encryptBlock(uint8_t *output, const uint8_t *input)
-
307 {
-
308 #if USE_AVR_INLINE_ASM
-
309  uint32_t xlow, xhigh, ylow, yhigh;
-
310 
-
311  // Unpack the input into the x and y variables, converting
-
312  // from big-endian into little-endian in the process.
-
313  __asm__ __volatile__ (
-
314  "ld %D1,Z\n"
-
315  "ldd %C1,Z+1\n"
-
316  "ldd %B1,Z+2\n"
-
317  "ldd %A1,Z+3\n"
-
318  "ldd %D0,Z+4\n"
-
319  "ldd %C0,Z+5\n"
-
320  "ldd %B0,Z+6\n"
-
321  "ldd %A0,Z+7\n"
-
322  "ldd %D3,Z+8\n"
-
323  "ldd %C3,Z+9\n"
-
324  "ldd %B3,Z+10\n"
-
325  "ldd %A3,Z+11\n"
-
326  "ldd %D2,Z+12\n"
-
327  "ldd %C2,Z+13\n"
-
328  "ldd %B2,Z+14\n"
-
329  "ldd %A2,Z+15\n"
-
330  : "=r"(xlow), "=r"(xhigh), "=r"(ylow), "=r"(yhigh)
-
331  : "z"(input)
-
332  );
-
333 
-
334  // Perform all encryption rounds. Z points to the key schedule.
-
335  __asm__ __volatile__ (
-
336  "1:\n"
-
337  // x = (rightRotate8_64(x) + y) ^ *s++;
-
338  "mov __tmp_reg__,%A0\n" // x = rightRotate8_64(x)
-
339  "mov %A0,%B0\n"
-
340  "mov %B0,%C0\n"
-
341  "mov %C0,%D0\n"
-
342  "mov %D0,%A1\n"
-
343  "mov %A1,%B1\n"
-
344  "mov %B1,%C1\n"
-
345  "mov %C1,%D1\n"
-
346  "mov %D1,__tmp_reg__\n"
-
347 
-
348  "add %A0,%A2\n" // x += y
-
349  "adc %B0,%B2\n"
-
350  "adc %C0,%C2\n"
-
351  "adc %D0,%D2\n"
-
352  "adc %A1,%A3\n"
-
353  "adc %B1,%B3\n"
-
354  "adc %C1,%C3\n"
-
355  "adc %D1,%D3\n"
-
356 
-
357  "ld __tmp_reg__,Z+\n" // x ^= *s++
-
358  "eor %A0,__tmp_reg__\n"
-
359  "ld __tmp_reg__,Z+\n"
-
360  "eor %B0,__tmp_reg__\n"
-
361  "ld __tmp_reg__,Z+\n"
-
362  "eor %C0,__tmp_reg__\n"
-
363  "ld __tmp_reg__,Z+\n"
-
364  "eor %D0,__tmp_reg__\n"
-
365  "ld __tmp_reg__,Z+\n"
-
366  "eor %A1,__tmp_reg__\n"
-
367  "ld __tmp_reg__,Z+\n"
-
368  "eor %B1,__tmp_reg__\n"
-
369  "ld __tmp_reg__,Z+\n"
-
370  "eor %C1,__tmp_reg__\n"
-
371  "ld __tmp_reg__,Z+\n"
-
372  "eor %D1,__tmp_reg__\n"
-
373 
-
374  // y = leftRotate3_64(y) ^ x;
-
375  "lsl %A2\n" // y = leftRotate1_64(y)
-
376  "rol %B2\n"
-
377  "rol %C2\n"
-
378  "rol %D2\n"
-
379  "rol %A3\n"
-
380  "rol %B3\n"
-
381  "rol %C3\n"
-
382  "rol %D3\n"
-
383  "adc %A2,__zero_reg__\n"
-
384 
-
385  "lsl %A2\n" // y = leftRotate1_64(y)
-
386  "rol %B2\n"
-
387  "rol %C2\n"
-
388  "rol %D2\n"
-
389  "rol %A3\n"
-
390  "rol %B3\n"
-
391  "rol %C3\n"
-
392  "rol %D3\n"
-
393  "adc %A2,__zero_reg__\n"
-
394 
-
395  "lsl %A2\n" // y = leftRotate1_64(y)
-
396  "rol %B2\n"
-
397  "rol %C2\n"
-
398  "rol %D2\n"
-
399  "rol %A3\n"
-
400  "rol %B3\n"
-
401  "rol %C3\n"
-
402  "rol %D3\n"
-
403  "adc %A2,__zero_reg__\n"
-
404 
-
405  "eor %A2,%A0\n" // y ^= x
-
406  "eor %B2,%B0\n"
-
407  "eor %C2,%C0\n"
-
408  "eor %D2,%D0\n"
-
409  "eor %A3,%A1\n"
-
410  "eor %B3,%B1\n"
-
411  "eor %C3,%C1\n"
-
412  "eor %D3,%D1\n"
-
413 
-
414  // Loop
-
415  "dec %5\n" // --round
-
416  "breq 2f\n"
-
417  "rjmp 1b\n"
-
418  "2:\n"
-
419  : "+r"(xlow), "+r"(xhigh), "+r"(ylow), "+r"(yhigh)
-
420  : "z"(k), "r"(rounds)
-
421  );
-
422 
-
423  // Pack the results into the output and convert back to big-endian.
-
424  __asm__ __volatile__ (
-
425  "st Z,%D1\n"
-
426  "std Z+1,%C1\n"
-
427  "std Z+2,%B1\n"
-
428  "std Z+3,%A1\n"
-
429  "std Z+4,%D0\n"
-
430  "std Z+5,%C0\n"
-
431  "std Z+6,%B0\n"
-
432  "std Z+7,%A0\n"
-
433  "std Z+8,%D3\n"
-
434  "std Z+9,%C3\n"
-
435  "std Z+10,%B3\n"
-
436  "std Z+11,%A3\n"
-
437  "std Z+12,%D2\n"
-
438  "std Z+13,%C2\n"
-
439  "std Z+14,%B2\n"
-
440  "std Z+15,%A2\n"
-
441  : : "r"(xlow), "r"(xhigh), "r"(ylow), "r"(yhigh), "z"(output)
-
442  );
-
443 #else
-
444  uint64_t x, y;
-
445  const uint64_t *s = k;
-
446  unpack64(x, input);
-
447  unpack64(y, input + 8);
-
448  for (uint8_t round = rounds; round > 0; --round, ++s) {
-
449  x = (rightRotate8_64(x) + y) ^ s[0];
-
450  y = leftRotate3_64(y) ^ x;
-
451  }
-
452  pack64(output, x);
-
453  pack64(output + 8, y);
-
454 #endif
-
455 }
-
456 
-
457 void Speck::decryptBlock(uint8_t *output, const uint8_t *input)
-
458 {
-
459 #if USE_AVR_INLINE_ASM
-
460  uint32_t xlow, xhigh, ylow, yhigh;
-
461 
-
462  // Unpack the input into the x and y variables, converting
-
463  // from big-endian into little-endian in the process.
-
464  __asm__ __volatile__ (
-
465  "ld %D1,Z\n"
-
466  "ldd %C1,Z+1\n"
-
467  "ldd %B1,Z+2\n"
-
468  "ldd %A1,Z+3\n"
-
469  "ldd %D0,Z+4\n"
-
470  "ldd %C0,Z+5\n"
-
471  "ldd %B0,Z+6\n"
-
472  "ldd %A0,Z+7\n"
-
473  "ldd %D3,Z+8\n"
-
474  "ldd %C3,Z+9\n"
-
475  "ldd %B3,Z+10\n"
-
476  "ldd %A3,Z+11\n"
-
477  "ldd %D2,Z+12\n"
-
478  "ldd %C2,Z+13\n"
-
479  "ldd %B2,Z+14\n"
-
480  "ldd %A2,Z+15\n"
-
481  : "=r"(xlow), "=r"(xhigh), "=r"(ylow), "=r"(yhigh)
-
482  : "z"(input)
-
483  );
-
484 
-
485  // Perform all decryption rounds. Z points to the end of key schedule.
-
486  __asm__ __volatile__ (
-
487  "1:\n"
-
488  // y = rightRotate3_64(x ^ y);
-
489  "eor %A2,%A0\n" // y ^= x
-
490  "eor %B2,%B0\n"
-
491  "eor %C2,%C0\n"
-
492  "eor %D2,%D0\n"
-
493  "eor %A3,%A1\n"
-
494  "eor %B3,%B1\n"
-
495  "eor %C3,%C1\n"
-
496  "eor %D3,%D1\n"
-
497 
-
498  "bst %A2,0\n" // y = rightRotate1_64(y)
-
499  "ror %D3\n"
-
500  "ror %C3\n"
-
501  "ror %B3\n"
-
502  "ror %A3\n"
-
503  "ror %D2\n"
-
504  "ror %C2\n"
-
505  "ror %B2\n"
-
506  "ror %A2\n"
-
507  "bld %D3,7\n"
-
508 
-
509  "bst %A2,0\n" // y = rightRotate1_64(y)
-
510  "ror %D3\n"
-
511  "ror %C3\n"
-
512  "ror %B3\n"
-
513  "ror %A3\n"
-
514  "ror %D2\n"
-
515  "ror %C2\n"
-
516  "ror %B2\n"
-
517  "ror %A2\n"
-
518  "bld %D3,7\n"
-
519 
-
520  "bst %A2,0\n" // y = rightRotate1_64(y)
-
521  "ror %D3\n"
-
522  "ror %C3\n"
-
523  "ror %B3\n"
-
524  "ror %A3\n"
-
525  "ror %D2\n"
-
526  "ror %C2\n"
-
527  "ror %B2\n"
-
528  "ror %A2\n"
-
529  "bld %D3,7\n"
-
530 
-
531  // x = leftRotate8_64((x ^ *s--) - y);
-
532  "ld __tmp_reg__,-Z\n" // x ^= *s--
-
533  "eor %D1,__tmp_reg__\n"
-
534  "ld __tmp_reg__,-Z\n"
-
535  "eor %C1,__tmp_reg__\n"
-
536  "ld __tmp_reg__,-Z\n"
-
537  "eor %B1,__tmp_reg__\n"
-
538  "ld __tmp_reg__,-Z\n"
-
539  "eor %A1,__tmp_reg__\n"
-
540  "ld __tmp_reg__,-Z\n"
-
541  "eor %D0,__tmp_reg__\n"
-
542  "ld __tmp_reg__,-Z\n"
-
543  "eor %C0,__tmp_reg__\n"
-
544  "ld __tmp_reg__,-Z\n"
-
545  "eor %B0,__tmp_reg__\n"
-
546  "ld __tmp_reg__,-Z\n"
-
547  "eor %A0,__tmp_reg__\n"
-
548 
-
549  "sub %A0,%A2\n" // x -= y
-
550  "sbc %B0,%B2\n"
-
551  "sbc %C0,%C2\n"
-
552  "sbc %D0,%D2\n"
-
553  "sbc %A1,%A3\n"
-
554  "sbc %B1,%B3\n"
-
555  "sbc %C1,%C3\n"
-
556  "sbc %D1,%D3\n"
-
557 
-
558  "mov __tmp_reg__,%D1\n" // x = lefRotate8_64(x)
-
559  "mov %D1,%C1\n"
-
560  "mov %C1,%B1\n"
-
561  "mov %B1,%A1\n"
-
562  "mov %A1,%D0\n"
-
563  "mov %D0,%C0\n"
-
564  "mov %C0,%B0\n"
-
565  "mov %B0,%A0\n"
-
566  "mov %A0,__tmp_reg__\n"
-
567 
-
568  // Loop
-
569  "dec %5\n" // --round
-
570  "breq 2f\n"
-
571  "rjmp 1b\n"
-
572  "2:\n"
-
573  : "+r"(xlow), "+r"(xhigh), "+r"(ylow), "+r"(yhigh)
-
574  : "z"(k + rounds), "r"(rounds)
-
575  );
-
576 
-
577  // Pack the results into the output and convert back to big-endian.
-
578  __asm__ __volatile__ (
-
579  "st Z,%D1\n"
-
580  "std Z+1,%C1\n"
-
581  "std Z+2,%B1\n"
-
582  "std Z+3,%A1\n"
-
583  "std Z+4,%D0\n"
-
584  "std Z+5,%C0\n"
-
585  "std Z+6,%B0\n"
-
586  "std Z+7,%A0\n"
-
587  "std Z+8,%D3\n"
-
588  "std Z+9,%C3\n"
-
589  "std Z+10,%B3\n"
-
590  "std Z+11,%A3\n"
-
591  "std Z+12,%D2\n"
-
592  "std Z+13,%C2\n"
-
593  "std Z+14,%B2\n"
-
594  "std Z+15,%A2\n"
-
595  : : "r"(xlow), "r"(xhigh), "r"(ylow), "r"(yhigh), "z"(output)
-
596  );
-
597 #else
-
598  uint64_t x, y;
-
599  const uint64_t *s = k + rounds - 1;
-
600  unpack64(x, input);
-
601  unpack64(y, input + 8);
-
602  for (uint8_t round = rounds; round > 0; --round, --s) {
-
603  y = rightRotate3_64(x ^ y);
-
604  x = leftRotate8_64((x ^ s[0]) - y);
-
605  }
-
606  pack64(output, x);
-
607  pack64(output + 8, y);
-
608 #endif
-
609 }
-
610 
-
611 void Speck::clear()
-
612 {
-
613  clean(k);
-
614 }
+
108  // Automatically generated by the genspeck tool.
+
109  uint64_t l[4];
+
110  uint8_t m, mb;
+
111  if (len == 32) {
+
112  m = 4;
+
113  mb = 3 * 8;
+
114  } else if (len == 24) {
+
115  m = 3;
+
116  mb = 2 * 8;
+
117  } else if (len == 16) {
+
118  m = 2;
+
119  mb = 8;
+
120  } else {
+
121  return false;
+
122  }
+
123  rounds = 30 + m;
+
124  uint8_t r = rounds - 1;
+
125  __asm__ __volatile__ (
+
126  "ld __tmp_reg__,-X\n"
+
127  "st Z+,__tmp_reg__\n"
+
128  "ld __tmp_reg__,-X\n"
+
129  "st Z+,__tmp_reg__\n"
+
130  "ld __tmp_reg__,-X\n"
+
131  "st Z+,__tmp_reg__\n"
+
132  "ld __tmp_reg__,-X\n"
+
133  "st Z+,__tmp_reg__\n"
+
134  "ld __tmp_reg__,-X\n"
+
135  "st Z+,__tmp_reg__\n"
+
136  "ld __tmp_reg__,-X\n"
+
137  "st Z+,__tmp_reg__\n"
+
138  "ld __tmp_reg__,-X\n"
+
139  "st Z+,__tmp_reg__\n"
+
140  "ld __tmp_reg__,-X\n"
+
141  "st Z+,__tmp_reg__\n"
+
142  "sbiw r30,8\n"
+
143  "movw r10,r30\n"
+
144  "movw r30,%A2\n"
+
145  "ldd r8,%3\n"
+
146  "1:\n"
+
147  "ld __tmp_reg__,-X\n"
+
148  "st Z+,__tmp_reg__\n"
+
149  "dec r8\n"
+
150  "brne 1b\n"
+
151  "movw r26,%A2\n"
+
152  "movw r30,r10\n"
+
153  "clr %A2\n"
+
154  "ldd %B2,%3\n"
+
155  "clr r25\n"
+
156  "ld r16,Z+\n"
+
157  "ld r17,Z+\n"
+
158  "ld r18,Z+\n"
+
159  "ld r19,Z+\n"
+
160  "ld r20,Z+\n"
+
161  "ld r21,Z+\n"
+
162  "ld r22,Z+\n"
+
163  "ld r23,Z+\n"
+
164  "2:\n"
+
165  "add r26,%A2\n"
+
166  "adc r27,__zero_reg__\n"
+
167  "ld r15,X+\n"
+
168  "ld r8,X+\n"
+
169  "ld r9,X+\n"
+
170  "ld r10,X+\n"
+
171  "ld r11,X+\n"
+
172  "ld r12,X+\n"
+
173  "ld r13,X+\n"
+
174  "ld r14,X+\n"
+
175  "sub r26,%A2\n"
+
176  "sbc r27,__zero_reg__\n"
+
177  "sbiw r26,8\n"
+
178  "add r8,r16\n"
+
179  "adc r9,r17\n"
+
180  "adc r10,r18\n"
+
181  "adc r11,r19\n"
+
182  "adc r12,r20\n"
+
183  "adc r13,r21\n"
+
184  "adc r14,r22\n"
+
185  "adc r15,r23\n"
+
186  "eor r8,r25\n"
+
187  "add r26,%B2\n"
+
188  "adc r27,__zero_reg__\n"
+
189  "st X+,r8\n"
+
190  "st X+,r9\n"
+
191  "st X+,r10\n"
+
192  "st X+,r11\n"
+
193  "st X+,r12\n"
+
194  "st X+,r13\n"
+
195  "st X+,r14\n"
+
196  "st X+,r15\n"
+
197  "sub r26,%B2\n"
+
198  "sbc r27,__zero_reg__\n"
+
199  "sbiw r26,8\n"
+
200  "lsl r16\n"
+
201  "rol r17\n"
+
202  "rol r18\n"
+
203  "rol r19\n"
+
204  "rol r20\n"
+
205  "rol r21\n"
+
206  "rol r22\n"
+
207  "rol r23\n"
+
208  "adc r16, __zero_reg__\n"
+
209  "lsl r16\n"
+
210  "rol r17\n"
+
211  "rol r18\n"
+
212  "rol r19\n"
+
213  "rol r20\n"
+
214  "rol r21\n"
+
215  "rol r22\n"
+
216  "rol r23\n"
+
217  "adc r16, __zero_reg__\n"
+
218  "lsl r16\n"
+
219  "rol r17\n"
+
220  "rol r18\n"
+
221  "rol r19\n"
+
222  "rol r20\n"
+
223  "rol r21\n"
+
224  "rol r22\n"
+
225  "rol r23\n"
+
226  "adc r16, __zero_reg__\n"
+
227  "eor r16,r8\n"
+
228  "eor r17,r9\n"
+
229  "eor r18,r10\n"
+
230  "eor r19,r11\n"
+
231  "eor r20,r12\n"
+
232  "eor r21,r13\n"
+
233  "eor r22,r14\n"
+
234  "eor r23,r15\n"
+
235  "st Z+,r16\n"
+
236  "st Z+,r17\n"
+
237  "st Z+,r18\n"
+
238  "st Z+,r19\n"
+
239  "st Z+,r20\n"
+
240  "st Z+,r21\n"
+
241  "st Z+,r22\n"
+
242  "st Z+,r23\n"
+
243  "ldi r24,8\n"
+
244  "add %A2,r24\n"
+
245  "add %B2,r24\n"
+
246  "ldi r24,0x1F\n"
+
247  "and %A2,r24\n"
+
248  "and %B2,r24\n"
+
249  "ldd r8,%4\n"
+
250  "inc r25\n"
+
251  "cp r25,r8\n"
+
252  "breq 3f\n"
+
253  "rjmp 2b\n"
+
254  "3:\n"
+
255  "ldi r24,32\n"
+
256  "4:\n"
+
257  "st X+,__zero_reg__\n"
+
258  "dec r24\n"
+
259  "brne 4b\n"
+
260  : : "z"(k), "x"(key + len), "r"(l), "Q"(mb), "Q"(r)
+
261  : "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
+
262  "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23", "memory"
+
263  , "r24", "r25"
+
264  );
+
265  return true;
+
266 #else
+
267  uint64_t l[4];
+
268  uint8_t m;
+
269  if (len == 32) {
+
270  m = 4;
+
271  unpack64(l[2], key);
+
272  unpack64(l[1], key + 8);
+
273  unpack64(l[0], key + 16);
+
274  unpack64(k[0], key + 24);
+
275  } else if (len == 24) {
+
276  m = 3;
+
277  unpack64(l[1], key);
+
278  unpack64(l[0], key + 8);
+
279  unpack64(k[0], key + 16);
+
280  } else if (len == 16) {
+
281  m = 2;
+
282  unpack64(l[0], key);
+
283  unpack64(k[0], key + 8);
+
284  } else {
+
285  return false;
+
286  }
+
287  rounds = 30 + m;
+
288  uint8_t li_in = 0;
+
289  uint8_t li_out = m - 1;
+
290  for (uint8_t i = 0; i < (rounds - 1); ++i) {
+
291  l[li_out] = (k[i] + rightRotate8_64(l[li_in])) ^ i;
+
292  k[i + 1] = leftRotate3_64(k[i]) ^ l[li_out];
+
293  if ((++li_in) >= m)
+
294  li_in = 0;
+
295  if ((++li_out) >= m)
+
296  li_out = 0;
+
297  }
+
298  clean(l);
+
299  return true;
+
300 #endif
+
301 }
+
302 
+
303 void Speck::encryptBlock(uint8_t *output, const uint8_t *input)
+
304 {
+
305 #if USE_AVR_INLINE_ASM
+
306  // Automatically generated by the genspeck tool.
+
307  __asm__ __volatile__ (
+
308  "ld r15,X+\n"
+
309  "ld r14,X+\n"
+
310  "ld r13,X+\n"
+
311  "ld r12,X+\n"
+
312  "ld r11,X+\n"
+
313  "ld r10,X+\n"
+
314  "ld r9,X+\n"
+
315  "ld r8,X+\n"
+
316  "ld r23,X+\n"
+
317  "ld r22,X+\n"
+
318  "ld r21,X+\n"
+
319  "ld r20,X+\n"
+
320  "ld r19,X+\n"
+
321  "ld r18,X+\n"
+
322  "ld r17,X+\n"
+
323  "ld r16,X\n"
+
324  "1:\n"
+
325  "add r9,r16\n"
+
326  "adc r10,r17\n"
+
327  "adc r11,r18\n"
+
328  "adc r12,r19\n"
+
329  "adc r13,r20\n"
+
330  "adc r14,r21\n"
+
331  "adc r15,r22\n"
+
332  "adc r8,r23\n"
+
333  "ld __tmp_reg__,Z+\n"
+
334  "eor __tmp_reg__,r9\n"
+
335  "ld r9,Z+\n"
+
336  "eor r9,r10\n"
+
337  "ld r10,Z+\n"
+
338  "eor r10,r11\n"
+
339  "ld r11,Z+\n"
+
340  "eor r11,r12\n"
+
341  "ld r12,Z+\n"
+
342  "eor r12,r13\n"
+
343  "ld r13,Z+\n"
+
344  "eor r13,r14\n"
+
345  "ld r14,Z+\n"
+
346  "eor r14,r15\n"
+
347  "ld r15,Z+\n"
+
348  "eor r15,r8\n"
+
349  "mov r8,__tmp_reg__\n"
+
350  "lsl r16\n"
+
351  "rol r17\n"
+
352  "rol r18\n"
+
353  "rol r19\n"
+
354  "rol r20\n"
+
355  "rol r21\n"
+
356  "rol r22\n"
+
357  "rol r23\n"
+
358  "adc r16, __zero_reg__\n"
+
359  "lsl r16\n"
+
360  "rol r17\n"
+
361  "rol r18\n"
+
362  "rol r19\n"
+
363  "rol r20\n"
+
364  "rol r21\n"
+
365  "rol r22\n"
+
366  "rol r23\n"
+
367  "adc r16, __zero_reg__\n"
+
368  "lsl r16\n"
+
369  "rol r17\n"
+
370  "rol r18\n"
+
371  "rol r19\n"
+
372  "rol r20\n"
+
373  "rol r21\n"
+
374  "rol r22\n"
+
375  "rol r23\n"
+
376  "adc r16, __zero_reg__\n"
+
377  "eor r16,r8\n"
+
378  "eor r17,r9\n"
+
379  "eor r18,r10\n"
+
380  "eor r19,r11\n"
+
381  "eor r20,r12\n"
+
382  "eor r21,r13\n"
+
383  "eor r22,r14\n"
+
384  "eor r23,r15\n"
+
385  "dec %2\n"
+
386  "breq 2f\n"
+
387  "rjmp 1b\n"
+
388  "2:\n"
+
389  "ldd r26,%A3\n"
+
390  "ldd r27,%B3\n"
+
391  "st X+,r15\n"
+
392  "st X+,r14\n"
+
393  "st X+,r13\n"
+
394  "st X+,r12\n"
+
395  "st X+,r11\n"
+
396  "st X+,r10\n"
+
397  "st X+,r9\n"
+
398  "st X+,r8\n"
+
399  "st X+,r23\n"
+
400  "st X+,r22\n"
+
401  "st X+,r21\n"
+
402  "st X+,r20\n"
+
403  "st X+,r19\n"
+
404  "st X+,r18\n"
+
405  "st X+,r17\n"
+
406  "st X,r16\n"
+
407  : : "x"(input), "z"(k), "r"(rounds), "Q"(output)
+
408  : "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
+
409  "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23", "memory"
+
410  );
+
411 #else
+
412  uint64_t x, y;
+
413  const uint64_t *s = k;
+
414  unpack64(x, input);
+
415  unpack64(y, input + 8);
+
416  for (uint8_t round = rounds; round > 0; --round, ++s) {
+
417  x = (rightRotate8_64(x) + y) ^ s[0];
+
418  y = leftRotate3_64(y) ^ x;
+
419  }
+
420  pack64(output, x);
+
421  pack64(output + 8, y);
+
422 #endif
+
423 }
+
424 
+
425 void Speck::decryptBlock(uint8_t *output, const uint8_t *input)
+
426 {
+
427 #if USE_AVR_INLINE_ASM
+
428  // Automatically generated by the genspeck tool.
+
429  __asm__ __volatile__ (
+
430  "ld r15,X+\n"
+
431  "ld r14,X+\n"
+
432  "ld r13,X+\n"
+
433  "ld r12,X+\n"
+
434  "ld r11,X+\n"
+
435  "ld r10,X+\n"
+
436  "ld r9,X+\n"
+
437  "ld r8,X+\n"
+
438  "ld r23,X+\n"
+
439  "ld r22,X+\n"
+
440  "ld r21,X+\n"
+
441  "ld r20,X+\n"
+
442  "ld r19,X+\n"
+
443  "ld r18,X+\n"
+
444  "ld r17,X+\n"
+
445  "ld r16,X\n"
+
446  "1:\n"
+
447  "eor r16,r8\n"
+
448  "eor r17,r9\n"
+
449  "eor r18,r10\n"
+
450  "eor r19,r11\n"
+
451  "eor r20,r12\n"
+
452  "eor r21,r13\n"
+
453  "eor r22,r14\n"
+
454  "eor r23,r15\n"
+
455  "bst r16,0\n"
+
456  "ror r23\n"
+
457  "ror r22\n"
+
458  "ror r21\n"
+
459  "ror r20\n"
+
460  "ror r19\n"
+
461  "ror r18\n"
+
462  "ror r17\n"
+
463  "ror r16\n"
+
464  "bld r23,7\n"
+
465  "bst r16,0\n"
+
466  "ror r23\n"
+
467  "ror r22\n"
+
468  "ror r21\n"
+
469  "ror r20\n"
+
470  "ror r19\n"
+
471  "ror r18\n"
+
472  "ror r17\n"
+
473  "ror r16\n"
+
474  "bld r23,7\n"
+
475  "bst r16,0\n"
+
476  "ror r23\n"
+
477  "ror r22\n"
+
478  "ror r21\n"
+
479  "ror r20\n"
+
480  "ror r19\n"
+
481  "ror r18\n"
+
482  "ror r17\n"
+
483  "ror r16\n"
+
484  "bld r23,7\n"
+
485  "ld __tmp_reg__,-Z\n"
+
486  "eor __tmp_reg__,r15\n"
+
487  "ld r15,-Z\n"
+
488  "eor r15,r14\n"
+
489  "ld r14,-Z\n"
+
490  "eor r14,r13\n"
+
491  "ld r13,-Z\n"
+
492  "eor r13,r12\n"
+
493  "ld r12,-Z\n"
+
494  "eor r12,r11\n"
+
495  "ld r11,-Z\n"
+
496  "eor r11,r10\n"
+
497  "ld r10,-Z\n"
+
498  "eor r10,r9\n"
+
499  "ld r9,-Z\n"
+
500  "eor r9,r8\n"
+
501  "mov r8,__tmp_reg__\n"
+
502  "sub r9,r16\n"
+
503  "sbc r10,r17\n"
+
504  "sbc r11,r18\n"
+
505  "sbc r12,r19\n"
+
506  "sbc r13,r20\n"
+
507  "sbc r14,r21\n"
+
508  "sbc r15,r22\n"
+
509  "sbc r8,r23\n"
+
510  "dec %2\n"
+
511  "breq 2f\n"
+
512  "rjmp 1b\n"
+
513  "2:\n"
+
514  "ldd r26,%A3\n"
+
515  "ldd r27,%B3\n"
+
516  "st X+,r15\n"
+
517  "st X+,r14\n"
+
518  "st X+,r13\n"
+
519  "st X+,r12\n"
+
520  "st X+,r11\n"
+
521  "st X+,r10\n"
+
522  "st X+,r9\n"
+
523  "st X+,r8\n"
+
524  "st X+,r23\n"
+
525  "st X+,r22\n"
+
526  "st X+,r21\n"
+
527  "st X+,r20\n"
+
528  "st X+,r19\n"
+
529  "st X+,r18\n"
+
530  "st X+,r17\n"
+
531  "st X,r16\n"
+
532  : : "x"(input), "z"(k + rounds), "r"(rounds), "Q"(output)
+
533  : "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
+
534  "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23", "memory"
+
535  );
+
536 #else
+
537  uint64_t x, y;
+
538  const uint64_t *s = k + rounds - 1;
+
539  unpack64(x, input);
+
540  unpack64(y, input + 8);
+
541  for (uint8_t round = rounds; round > 0; --round, --s) {
+
542  y = rightRotate3_64(x ^ y);
+
543  x = leftRotate8_64((x ^ s[0]) - y);
+
544  }
+
545  pack64(output, x);
+
546  pack64(output + 8, y);
+
547 #endif
+
548 }
+
549 
+
550 void Speck::clear()
+
551 {
+
552  clean(k);
+
553 }
size_t keySize() const
Default size of the key for this block cipher, in bytes.
Definition: Speck.cpp:87
size_t blockSize() const
Size of a single block processed by this cipher, in bytes.
Definition: Speck.cpp:82
Speck()
Constructs a Speck block cipher with no initial key.
Definition: Speck.cpp:72
-
void encryptBlock(uint8_t *output, const uint8_t *input)
Encrypts a single block using this cipher.
Definition: Speck.cpp:306
-
void decryptBlock(uint8_t *output, const uint8_t *input)
Decrypts a single block using this cipher.
Definition: Speck.cpp:457
+
void encryptBlock(uint8_t *output, const uint8_t *input)
Encrypts a single block using this cipher.
Definition: Speck.cpp:303
+
void decryptBlock(uint8_t *output, const uint8_t *input)
Decrypts a single block using this cipher.
Definition: Speck.cpp:425
bool setKey(const uint8_t *key, size_t len)
Sets the key to use for future encryption and decryption operations.
Definition: Speck.cpp:105
-
void clear()
Clears all security-sensitive state from this block cipher.
Definition: Speck.cpp:611
+
void clear()
Clears all security-sensitive state from this block cipher.
Definition: Speck.cpp:550
diff --git a/Speck_8h_source.html b/Speck_8h_source.html index fba35da6..d8012b2f 100644 --- a/Speck_8h_source.html +++ b/Speck_8h_source.html @@ -142,14 +142,14 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search');
size_t blockSize() const
Size of a single block processed by this cipher, in bytes.
Definition: Speck.cpp:82
Speck()
Constructs a Speck block cipher with no initial key.
Definition: Speck.cpp:72
Speck block cipher with a 128-bit block size.
Definition: Speck.h:28
-
void encryptBlock(uint8_t *output, const uint8_t *input)
Encrypts a single block using this cipher.
Definition: Speck.cpp:306
-
void decryptBlock(uint8_t *output, const uint8_t *input)
Decrypts a single block using this cipher.
Definition: Speck.cpp:457
+
void encryptBlock(uint8_t *output, const uint8_t *input)
Encrypts a single block using this cipher.
Definition: Speck.cpp:303
+
void decryptBlock(uint8_t *output, const uint8_t *input)
Decrypts a single block using this cipher.
Definition: Speck.cpp:425
bool setKey(const uint8_t *key, size_t len)
Sets the key to use for future encryption and decryption operations.
Definition: Speck.cpp:105
-
void clear()
Clears all security-sensitive state from this block cipher.
Definition: Speck.cpp:611
+
void clear()
Clears all security-sensitive state from this block cipher.
Definition: Speck.cpp:550
diff --git a/TelnetDefs_8h_source.html b/TelnetDefs_8h_source.html index 6e114718..a9aa983a 100644 --- a/TelnetDefs_8h_source.html +++ b/TelnetDefs_8h_source.html @@ -205,7 +205,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/Terminal_8cpp_source.html b/Terminal_8cpp_source.html index 0bd001b6..e6bdabb0 100644 --- a/Terminal_8cpp_source.html +++ b/Terminal_8cpp_source.html @@ -1037,7 +1037,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/Terminal_8h_source.html b/Terminal_8h_source.html index 7690bf84..701599d6 100644 --- a/Terminal_8h_source.html +++ b/Terminal_8h_source.html @@ -299,7 +299,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/TextField_8cpp_source.html b/TextField_8cpp_source.html index 531cc7d2..763a1635 100644 --- a/TextField_8cpp_source.html +++ b/TextField_8cpp_source.html @@ -156,7 +156,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/TextField_8h_source.html b/TextField_8h_source.html index e75a3bfd..036b73dd 100644 --- a/TextField_8h_source.html +++ b/TextField_8h_source.html @@ -142,7 +142,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/TimeField_8cpp_source.html b/TimeField_8cpp_source.html index b221f19f..5f793c76 100644 --- a/TimeField_8cpp_source.html +++ b/TimeField_8cpp_source.html @@ -325,7 +325,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/TimeField_8h_source.html b/TimeField_8h_source.html index 3d3be857..f260c289 100644 --- a/TimeField_8h_source.html +++ b/TimeField_8h_source.html @@ -167,7 +167,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/TransistorNoiseSource_8cpp_source.html b/TransistorNoiseSource_8cpp_source.html index d62bd755..36f496cf 100644 --- a/TransistorNoiseSource_8cpp_source.html +++ b/TransistorNoiseSource_8cpp_source.html @@ -295,7 +295,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/TransistorNoiseSource_8h_source.html b/TransistorNoiseSource_8h_source.html index f7be6a98..e3b0ca47 100644 --- a/TransistorNoiseSource_8h_source.html +++ b/TransistorNoiseSource_8h_source.html @@ -151,7 +151,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/USBKeysExtra_8h_source.html b/USBKeysExtra_8h_source.html index 70e5827e..9e564f66 100644 --- a/USBKeysExtra_8h_source.html +++ b/USBKeysExtra_8h_source.html @@ -215,7 +215,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/XOF_8cpp_source.html b/XOF_8cpp_source.html index 3a12f486..78bba94b 100644 --- a/XOF_8cpp_source.html +++ b/XOF_8cpp_source.html @@ -125,7 +125,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/XOF_8h_source.html b/XOF_8h_source.html index 7a707575..2b90d3ee 100644 --- a/XOF_8h_source.html +++ b/XOF_8h_source.html @@ -152,7 +152,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/XTS_8cpp_source.html b/XTS_8cpp_source.html index bbb7128e..721f66d1 100644 --- a/XTS_8cpp_source.html +++ b/XTS_8cpp_source.html @@ -290,7 +290,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/XTS_8h_source.html b/XTS_8h_source.html index ca15d1fd..45b125e4 100644 --- a/XTS_8h_source.html +++ b/XTS_8h_source.html @@ -217,7 +217,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/alarm-clock_8dox.html b/alarm-clock_8dox.html index 8a2f0a74..a66c4f2b 100644 --- a/alarm-clock_8dox.html +++ b/alarm-clock_8dox.html @@ -87,7 +87,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/alarm_clock.html b/alarm_clock.html index 7b5bfdd5..b7bf0008 100644 --- a/alarm_clock.html +++ b/alarm_clock.html @@ -140,7 +140,7 @@ Completed Clock diff --git a/annotated.html b/annotated.html index ca8057cf..24e0d00a 100644 --- a/annotated.html +++ b/annotated.html @@ -177,7 +177,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/blink-blink_8dox.html b/blink-blink_8dox.html index 1acc2497..40988407 100644 --- a/blink-blink_8dox.html +++ b/blink-blink_8dox.html @@ -87,7 +87,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/blink-charlieplex_8dox.html b/blink-charlieplex_8dox.html index a695878e..bc1ce360 100644 --- a/blink-charlieplex_8dox.html +++ b/blink-charlieplex_8dox.html @@ -87,7 +87,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/blink-cylon_8dox.html b/blink-cylon_8dox.html index c3420d8f..c62cd998 100644 --- a/blink-cylon_8dox.html +++ b/blink-cylon_8dox.html @@ -87,7 +87,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/blink-startrek_8dox.html b/blink-startrek_8dox.html index 5c4b1f85..20545bf6 100644 --- a/blink-startrek_8dox.html +++ b/blink-startrek_8dox.html @@ -87,7 +87,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/blink_blink.html b/blink_blink.html index aac87850..4bebb90d 100644 --- a/blink_blink.html +++ b/blink_blink.html @@ -120,7 +120,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/blink_charlieplex.html b/blink_charlieplex.html index 2b686cfe..045f7601 100644 --- a/blink_charlieplex.html +++ b/blink_charlieplex.html @@ -160,7 +160,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/blink_cylon.html b/blink_cylon.html index eee3d6c7..d4680305 100644 --- a/blink_cylon.html +++ b/blink_cylon.html @@ -171,7 +171,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/blink_startrek.html b/blink_startrek.html index 66a10cc4..17bc62ee 100644 --- a/blink_startrek.html +++ b/blink_startrek.html @@ -237,7 +237,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classAES128-members.html b/classAES128-members.html index 029936ac..23218a8b 100644 --- a/classAES128-members.html +++ b/classAES128-members.html @@ -105,7 +105,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classAES128.html b/classAES128.html index 299853b7..b242c352 100644 --- a/classAES128.html +++ b/classAES128.html @@ -265,7 +265,7 @@ Additional Inherited Members diff --git a/classAES192-members.html b/classAES192-members.html index f8e1b3ed..6b1e03db 100644 --- a/classAES192-members.html +++ b/classAES192-members.html @@ -105,7 +105,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classAES192.html b/classAES192.html index d0381142..97cd3cbf 100644 --- a/classAES192.html +++ b/classAES192.html @@ -265,7 +265,7 @@ Additional Inherited Members diff --git a/classAES256-members.html b/classAES256-members.html index 7647940e..806b4fdf 100644 --- a/classAES256-members.html +++ b/classAES256-members.html @@ -105,7 +105,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classAES256.html b/classAES256.html index 65f17ac2..f63ce5eb 100644 --- a/classAES256.html +++ b/classAES256.html @@ -265,7 +265,7 @@ Additional Inherited Members diff --git a/classAESCommon-members.html b/classAESCommon-members.html index 8bf73cd9..73b83002 100644 --- a/classAESCommon-members.html +++ b/classAESCommon-members.html @@ -103,7 +103,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classAESCommon.html b/classAESCommon.html index 9cfee979..78729af1 100644 --- a/classAESCommon.html +++ b/classAESCommon.html @@ -322,7 +322,7 @@ Protected Member Functions diff --git a/classAuthenticatedCipher-members.html b/classAuthenticatedCipher-members.html index 951dbf6e..d49a5329 100644 --- a/classAuthenticatedCipher-members.html +++ b/classAuthenticatedCipher-members.html @@ -108,7 +108,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classAuthenticatedCipher.html b/classAuthenticatedCipher.html index 7739f74c..6e2768c8 100644 --- a/classAuthenticatedCipher.html +++ b/classAuthenticatedCipher.html @@ -351,7 +351,7 @@ virtual  diff --git a/classBLAKE2b-members.html b/classBLAKE2b-members.html index 94955396..ef5da5dc 100644 --- a/classBLAKE2b-members.html +++ b/classBLAKE2b-members.html @@ -113,7 +113,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classBLAKE2b.html b/classBLAKE2b.html index 5b5e6ea0..2e206e51 100644 --- a/classBLAKE2b.html +++ b/classBLAKE2b.html @@ -600,7 +600,7 @@ Additional Inherited Members diff --git a/classBLAKE2s-members.html b/classBLAKE2s-members.html index 90a351af..b7fcb050 100644 --- a/classBLAKE2s-members.html +++ b/classBLAKE2s-members.html @@ -112,7 +112,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classBLAKE2s.html b/classBLAKE2s.html index 7fdf7053..b7f9a358 100644 --- a/classBLAKE2s.html +++ b/classBLAKE2s.html @@ -600,7 +600,7 @@ Additional Inherited Members diff --git a/classBigNumberUtil-members.html b/classBigNumberUtil-members.html index fc62275b..3a7a4109 100644 --- a/classBigNumberUtil-members.html +++ b/classBigNumberUtil-members.html @@ -106,7 +106,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classBigNumberUtil.html b/classBigNumberUtil.html index 2bd34db1..47742c39 100644 --- a/classBigNumberUtil.html +++ b/classBigNumberUtil.html @@ -943,7 +943,7 @@ Static Public Member Functions diff --git a/classBitmap-members.html b/classBitmap-members.html index be22cbda..e9a99072 100644 --- a/classBitmap-members.html +++ b/classBitmap-members.html @@ -138,7 +138,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classBitmap.html b/classBitmap.html index d1ba82c6..5f4566c0 100644 --- a/classBitmap.html +++ b/classBitmap.html @@ -1745,7 +1745,7 @@ class DMD diff --git a/classBlinkLED-members.html b/classBlinkLED-members.html index bdf6a586..6ff3d4a3 100644 --- a/classBlinkLED-members.html +++ b/classBlinkLED-members.html @@ -103,7 +103,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classBlinkLED.html b/classBlinkLED.html index 7b3c76e5..84149020 100644 --- a/classBlinkLED.html +++ b/classBlinkLED.html @@ -428,7 +428,7 @@ Public Member Functions diff --git a/classBlockCipher-members.html b/classBlockCipher-members.html index b4398815..73779b9a 100644 --- a/classBlockCipher-members.html +++ b/classBlockCipher-members.html @@ -101,7 +101,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classBlockCipher.html b/classBlockCipher.html index 98455a19..13e9a632 100644 --- a/classBlockCipher.html +++ b/classBlockCipher.html @@ -410,7 +410,7 @@ Public Member Functions diff --git a/classBoolField-members.html b/classBoolField-members.html index ff56cfdf..9686b290 100644 --- a/classBoolField-members.html +++ b/classBoolField-members.html @@ -113,7 +113,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classBoolField.html b/classBoolField.html index e654b82d..4e20e9f4 100644 --- a/classBoolField.html +++ b/classBoolField.html @@ -506,7 +506,7 @@ LiquidCrystal *  diff --git a/classCBC-members.html b/classCBC-members.html index 1b8b41f6..2ddffa2b 100644 --- a/classCBC-members.html +++ b/classCBC-members.html @@ -106,7 +106,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classCBC.html b/classCBC.html index 5d9b1c05..c71250b9 100644 --- a/classCBC.html +++ b/classCBC.html @@ -185,7 +185,7 @@ class CBC< T > diff --git a/classCBCCommon-members.html b/classCBCCommon-members.html index a38f06cd..e0078ed4 100644 --- a/classCBCCommon-members.html +++ b/classCBCCommon-members.html @@ -105,7 +105,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classCBCCommon.html b/classCBCCommon.html index ed6e8618..ba6750eb 100644 --- a/classCBCCommon.html +++ b/classCBCCommon.html @@ -534,7 +534,7 @@ Protected Member Functions diff --git a/classCFB-members.html b/classCFB-members.html index 0de5ea8d..f8b7e765 100644 --- a/classCFB-members.html +++ b/classCFB-members.html @@ -106,7 +106,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classCFB.html b/classCFB.html index b1275c45..18588d75 100644 --- a/classCFB.html +++ b/classCFB.html @@ -185,7 +185,7 @@ class CFB< T > diff --git a/classCFBCommon-members.html b/classCFBCommon-members.html index c8b0dfc2..dbb14243 100644 --- a/classCFBCommon-members.html +++ b/classCFBCommon-members.html @@ -105,7 +105,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classCFBCommon.html b/classCFBCommon.html index 216f6111..768ac276 100644 --- a/classCFBCommon.html +++ b/classCFBCommon.html @@ -534,7 +534,7 @@ Protected Member Functions diff --git a/classCTR-members.html b/classCTR-members.html index 7ea27047..dfbe1ffa 100644 --- a/classCTR-members.html +++ b/classCTR-members.html @@ -107,7 +107,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classCTR.html b/classCTR.html index 73a87a8c..87f5e0ad 100644 --- a/classCTR.html +++ b/classCTR.html @@ -181,7 +181,7 @@ class CTR< T > diff --git a/classCTRCommon-members.html b/classCTRCommon-members.html index 2c9a9a7e..8f506c12 100644 --- a/classCTRCommon-members.html +++ b/classCTRCommon-members.html @@ -106,7 +106,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classCTRCommon.html b/classCTRCommon.html index e0ca90c0..4085aba6 100644 --- a/classCTRCommon.html +++ b/classCTRCommon.html @@ -563,7 +563,7 @@ Protected Member Functions diff --git a/classChaCha-members.html b/classChaCha-members.html index 92c926f9..03461835 100644 --- a/classChaCha-members.html +++ b/classChaCha-members.html @@ -109,7 +109,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classChaCha.html b/classChaCha.html index 7edadda2..5c31202d 100644 --- a/classChaCha.html +++ b/classChaCha.html @@ -673,7 +673,7 @@ class ChaChaPoly< diff --git a/classChaChaPoly-members.html b/classChaChaPoly-members.html index 906adc23..569a4b94 100644 --- a/classChaChaPoly-members.html +++ b/classChaChaPoly-members.html @@ -115,7 +115,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classChaChaPoly.html b/classChaChaPoly.html index 448b47fc..ee118bf0 100644 --- a/classChaChaPoly.html +++ b/classChaChaPoly.html @@ -665,7 +665,7 @@ virtual  diff --git a/classCharlieplex-members.html b/classCharlieplex-members.html index b43d551e..8ebd0ef9 100644 --- a/classCharlieplex-members.html +++ b/classCharlieplex-members.html @@ -104,7 +104,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classCharlieplex.html b/classCharlieplex.html index 067bf945..1eb3fad2 100644 --- a/classCharlieplex.html +++ b/classCharlieplex.html @@ -538,7 +538,7 @@ Public Member Functions diff --git a/classChaseLEDs-members.html b/classChaseLEDs-members.html index d9541ecc..31264482 100644 --- a/classChaseLEDs-members.html +++ b/classChaseLEDs-members.html @@ -99,7 +99,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classChaseLEDs.html b/classChaseLEDs.html index 34d0c7e7..9212f808 100644 --- a/classChaseLEDs.html +++ b/classChaseLEDs.html @@ -347,7 +347,7 @@ Protected Member Functions diff --git a/classCipher-members.html b/classCipher-members.html index 06ca295b..1b82005e 100644 --- a/classCipher-members.html +++ b/classCipher-members.html @@ -102,7 +102,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classCipher.html b/classCipher.html index c17b456a..ebcb5ce3 100644 --- a/classCipher.html +++ b/classCipher.html @@ -485,7 +485,7 @@ Public Member Functions diff --git a/classCurve25519-members.html b/classCurve25519-members.html index df2fbfbb..65735433 100644 --- a/classCurve25519-members.html +++ b/classCurve25519-members.html @@ -97,7 +97,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classCurve25519.html b/classCurve25519.html index ff844755..c48ddf97 100644 --- a/classCurve25519.html +++ b/classCurve25519.html @@ -188,7 +188,7 @@ class Ed25519

Reference: RFC 7748

See Also
dh2()
-

Definition at line 244 of file Curve25519.cpp.

+

Definition at line 245 of file Curve25519.cpp.

@@ -236,7 +236,7 @@ class Ed25519Reference: RFC 7748

See Also
dh1()
-

Definition at line 282 of file Curve25519.cpp.

+

Definition at line 283 of file Curve25519.cpp.

@@ -292,7 +292,7 @@ class Ed25519Reference: RFC 7748

See Also
dh1(), dh2()
-

Definition at line 79 of file Curve25519.cpp.

+

Definition at line 80 of file Curve25519.cpp.

@@ -303,7 +303,7 @@ class Ed25519 diff --git a/classDMD-members.html b/classDMD-members.html index d4b874f8..d931702e 100644 --- a/classDMD-members.html +++ b/classDMD-members.html @@ -150,7 +150,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classDMD.html b/classDMD.html index 90bc6e9e..704536a9 100644 --- a/classDMD.html +++ b/classDMD.html @@ -755,7 +755,7 @@ Multiple panels diff --git a/classDS1307RTC-members.html b/classDS1307RTC-members.html index 5a2136fa..40e37ee8 100644 --- a/classDS1307RTC-members.html +++ b/classDS1307RTC-members.html @@ -125,7 +125,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classDS1307RTC.html b/classDS1307RTC.html index 5ef278ae..3525ff13 100644 --- a/classDS1307RTC.html +++ b/classDS1307RTC.html @@ -598,7 +598,7 @@ static const uint8_t  diff --git a/classDS3231RTC-members.html b/classDS3231RTC-members.html index fb4d27d3..8cf2d511 100644 --- a/classDS3231RTC-members.html +++ b/classDS3231RTC-members.html @@ -133,7 +133,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classDS3231RTC.html b/classDS3231RTC.html index 9e27b327..07ee47d7 100644 --- a/classDS3231RTC.html +++ b/classDS3231RTC.html @@ -713,7 +713,7 @@ static const uint8_t  diff --git a/classDS3232RTC-members.html b/classDS3232RTC-members.html index a20d60cf..918e97a8 100644 --- a/classDS3232RTC-members.html +++ b/classDS3232RTC-members.html @@ -130,7 +130,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classDS3232RTC.html b/classDS3232RTC.html index c2ae0c43..c9e11377 100644 --- a/classDS3232RTC.html +++ b/classDS3232RTC.html @@ -750,7 +750,7 @@ static const uint8_t  diff --git a/classEAX-members.html b/classEAX-members.html index 5a303d89..dcef3bb0 100644 --- a/classEAX-members.html +++ b/classEAX-members.html @@ -118,7 +118,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classEAX.html b/classEAX.html index 1fe6b303..ee314974 100644 --- a/classEAX.html +++ b/classEAX.html @@ -219,7 +219,7 @@ class EAX< T > diff --git a/classEAXCommon-members.html b/classEAXCommon-members.html index 3dd677dd..6f341d1d 100644 --- a/classEAXCommon-members.html +++ b/classEAXCommon-members.html @@ -117,7 +117,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classEAXCommon.html b/classEAXCommon.html index 910793b8..200a4955 100644 --- a/classEAXCommon.html +++ b/classEAXCommon.html @@ -732,7 +732,7 @@ Protected Member Functions diff --git a/classEEPROM24-members.html b/classEEPROM24-members.html index 599269ad..0d6586f6 100644 --- a/classEEPROM24-members.html +++ b/classEEPROM24-members.html @@ -101,7 +101,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classEEPROM24.html b/classEEPROM24.html index a7c86576..df642617 100644 --- a/classEEPROM24.html +++ b/classEEPROM24.html @@ -431,7 +431,7 @@ Public Member Functions diff --git a/classEd25519-members.html b/classEd25519-members.html index b6400027..4980c851 100644 --- a/classEd25519-members.html +++ b/classEd25519-members.html @@ -97,7 +97,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classEd25519.html b/classEd25519.html index 003fecd1..c930499f 100644 --- a/classEd25519.html +++ b/classEd25519.html @@ -354,7 +354,7 @@ Static Public Member Functions diff --git a/classField-members.html b/classField-members.html index a39aaeda..7cfece90 100644 --- a/classField-members.html +++ b/classField-members.html @@ -106,7 +106,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classField.html b/classField.html index 0f71c427..c48b833c 100644 --- a/classField.html +++ b/classField.html @@ -424,7 +424,7 @@ class Form diff --git a/classForm-members.html b/classForm-members.html index 5a848cf6..f56ef99c 100644 --- a/classForm-members.html +++ b/classForm-members.html @@ -108,7 +108,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classForm.html b/classForm.html index c495c190..a3780a1c 100644 --- a/classForm.html +++ b/classForm.html @@ -485,7 +485,7 @@ class Field diff --git a/classGCM-members.html b/classGCM-members.html index b5af0fb8..99f06773 100644 --- a/classGCM-members.html +++ b/classGCM-members.html @@ -119,7 +119,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classGCM.html b/classGCM.html index a84df50e..4048348e 100644 --- a/classGCM.html +++ b/classGCM.html @@ -223,7 +223,7 @@ class GCM< T > diff --git a/classGCMCommon-members.html b/classGCMCommon-members.html index 0fed898e..68f28dc0 100644 --- a/classGCMCommon-members.html +++ b/classGCMCommon-members.html @@ -118,7 +118,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classGCMCommon.html b/classGCMCommon.html index fd9e4418..41daa8a8 100644 --- a/classGCMCommon.html +++ b/classGCMCommon.html @@ -736,7 +736,7 @@ Protected Member Functions diff --git a/classGF128-members.html b/classGF128-members.html index f090f783..9e1cbddc 100644 --- a/classGF128-members.html +++ b/classGF128-members.html @@ -98,7 +98,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classGF128.html b/classGF128.html index 6a4cc977..81847a50 100644 --- a/classGF128.html +++ b/classGF128.html @@ -334,7 +334,7 @@ Static Public Member Functions diff --git a/classGHASH-members.html b/classGHASH-members.html index e732379e..466ad109 100644 --- a/classGHASH-members.html +++ b/classGHASH-members.html @@ -103,7 +103,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classGHASH.html b/classGHASH.html index 09bdf3a8..dbc05cb9 100644 --- a/classGHASH.html +++ b/classGHASH.html @@ -265,7 +265,7 @@ void  diff --git a/classHash-members.html b/classHash-members.html index 3362e388..91ddf207 100644 --- a/classHash-members.html +++ b/classHash-members.html @@ -104,7 +104,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classHash.html b/classHash.html index 8cd71ba4..7cd24355 100644 --- a/classHash.html +++ b/classHash.html @@ -575,7 +575,7 @@ Protected Member Functions diff --git a/classI2CMaster-members.html b/classI2CMaster-members.html index 5d76311d..59bb4f8c 100644 --- a/classI2CMaster-members.html +++ b/classI2CMaster-members.html @@ -100,7 +100,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classI2CMaster.html b/classI2CMaster.html index 0ec78382..d5b457b2 100644 --- a/classI2CMaster.html +++ b/classI2CMaster.html @@ -328,7 +328,7 @@ virtual unsigned int  diff --git a/classIRreceiver-members.html b/classIRreceiver-members.html index 7b51aaf8..f52e681a 100644 --- a/classIRreceiver-members.html +++ b/classIRreceiver-members.html @@ -100,7 +100,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classIRreceiver.html b/classIRreceiver.html index 2a111f7f..3931fd2d 100644 --- a/classIRreceiver.html +++ b/classIRreceiver.html @@ -328,7 +328,7 @@ void _IR_receive_interrupt diff --git a/classIntField-members.html b/classIntField-members.html index 881ef6fa..1bfa2a3e 100644 --- a/classIntField-members.html +++ b/classIntField-members.html @@ -118,7 +118,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classIntField.html b/classIntField.html index 5141da47..87edf500 100644 --- a/classIntField.html +++ b/classIntField.html @@ -647,7 +647,7 @@ LiquidCrystal *  diff --git a/classKeccakCore-members.html b/classKeccakCore-members.html index bc3a2d68..e7c0ce49 100644 --- a/classKeccakCore-members.html +++ b/classKeccakCore-members.html @@ -108,7 +108,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classKeccakCore.html b/classKeccakCore.html index 35a0a844..aee70245 100644 --- a/classKeccakCore.html +++ b/classKeccakCore.html @@ -475,7 +475,7 @@ void  diff --git a/classLCD-members.html b/classLCD-members.html index ab5194b7..6493e2a2 100644 --- a/classLCD-members.html +++ b/classLCD-members.html @@ -110,7 +110,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classLCD.html b/classLCD.html index 63b680e9..c9a4bf86 100644 --- a/classLCD.html +++ b/classLCD.html @@ -592,7 +592,7 @@ Support for DFRobot LCD Shield diff --git a/classListField-members.html b/classListField-members.html index 323831a3..462b4567 100644 --- a/classListField-members.html +++ b/classListField-members.html @@ -111,7 +111,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classListField.html b/classListField.html index d5a24941..225833eb 100644 --- a/classListField.html +++ b/classListField.html @@ -411,7 +411,7 @@ LiquidCrystal *  diff --git a/classLoginShell-members.html b/classLoginShell-members.html index 4473a77b..c1b24791 100644 --- a/classLoginShell-members.html +++ b/classLoginShell-members.html @@ -180,7 +180,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classLoginShell.html b/classLoginShell.html index 484f11bf..e71b86cf 100644 --- a/classLoginShell.html +++ b/classLoginShell.html @@ -572,7 +572,7 @@ Additional Inherited Members diff --git a/classMelody-members.html b/classMelody-members.html index 88ede0b9..eb39b00b 100644 --- a/classMelody-members.html +++ b/classMelody-members.html @@ -103,7 +103,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classMelody.html b/classMelody.html index 6bba2db9..0a7a74b6 100644 --- a/classMelody.html +++ b/classMelody.html @@ -371,7 +371,7 @@ bool  diff --git a/classNewHope-members.html b/classNewHope-members.html index f9becfc0..f9934251 100644 --- a/classNewHope-members.html +++ b/classNewHope-members.html @@ -99,7 +99,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classNewHope.html b/classNewHope.html index 6a720d64..9fe09912 100644 --- a/classNewHope.html +++ b/classNewHope.html @@ -362,7 +362,7 @@ Static Public Member Functions diff --git a/classNoiseSource-members.html b/classNoiseSource-members.html index fdca8938..1b0c5855 100644 --- a/classNoiseSource-members.html +++ b/classNoiseSource-members.html @@ -99,7 +99,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classNoiseSource.html b/classNoiseSource.html index 54728015..29454979 100644 --- a/classNoiseSource.html +++ b/classNoiseSource.html @@ -289,7 +289,7 @@ Protected Member Functions diff --git a/classOFB-members.html b/classOFB-members.html index 77516583..1466556a 100644 --- a/classOFB-members.html +++ b/classOFB-members.html @@ -106,7 +106,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classOFB.html b/classOFB.html index 11dd1e4c..d23f4c22 100644 --- a/classOFB.html +++ b/classOFB.html @@ -181,7 +181,7 @@ class OFB< T > diff --git a/classOFBCommon-members.html b/classOFBCommon-members.html index 0763b28a..b01413b8 100644 --- a/classOFBCommon-members.html +++ b/classOFBCommon-members.html @@ -105,7 +105,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classOFBCommon.html b/classOFBCommon.html index a3585dae..d4dafeb8 100644 --- a/classOFBCommon.html +++ b/classOFBCommon.html @@ -534,7 +534,7 @@ Protected Member Functions diff --git a/classOMAC-members.html b/classOMAC-members.html index 1bfc1d89..4d2154a8 100644 --- a/classOMAC-members.html +++ b/classOMAC-members.html @@ -102,7 +102,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classOMAC.html b/classOMAC.html index bc9aaa13..f3eff6a1 100644 --- a/classOMAC.html +++ b/classOMAC.html @@ -387,7 +387,7 @@ void  diff --git a/classP521-members.html b/classP521-members.html index 5b8070d5..7109240a 100644 --- a/classP521-members.html +++ b/classP521-members.html @@ -103,7 +103,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classP521.html b/classP521.html index b51aa289..066c881e 100644 --- a/classP521.html +++ b/classP521.html @@ -646,7 +646,7 @@ Static Public Member Functions diff --git a/classPoly1305-members.html b/classPoly1305-members.html index aa2ce15a..f835cd35 100644 --- a/classPoly1305-members.html +++ b/classPoly1305-members.html @@ -104,7 +104,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classPoly1305.html b/classPoly1305.html index ff86fb1c..2230a5aa 100644 --- a/classPoly1305.html +++ b/classPoly1305.html @@ -280,7 +280,7 @@ void  diff --git a/classRNGClass-members.html b/classRNGClass-members.html index b6782185..698c911d 100644 --- a/classRNGClass-members.html +++ b/classRNGClass-members.html @@ -105,7 +105,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classRNGClass.html b/classRNGClass.html index a3df81cf..54609e1a 100644 --- a/classRNGClass.html +++ b/classRNGClass.html @@ -519,7 +519,7 @@ static const int  diff --git a/classRTC-members.html b/classRTC-members.html index 3f2f69c1..293a8c35 100644 --- a/classRTC-members.html +++ b/classRTC-members.html @@ -123,7 +123,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classRTC.html b/classRTC.html index 63cfb941..48c37b5d 100644 --- a/classRTC.html +++ b/classRTC.html @@ -779,7 +779,7 @@ static const uint8_t  diff --git a/classRTCAlarm-members.html b/classRTCAlarm-members.html index 7f595918..f8886d9c 100644 --- a/classRTCAlarm-members.html +++ b/classRTCAlarm-members.html @@ -99,7 +99,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classRTCDate-members.html b/classRTCDate-members.html index e0e0ed6b..b3e1497d 100644 --- a/classRTCDate-members.html +++ b/classRTCDate-members.html @@ -96,7 +96,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classRTCTime-members.html b/classRTCTime-members.html index 38b6c030..d30b63b6 100644 --- a/classRTCTime-members.html +++ b/classRTCTime-members.html @@ -96,7 +96,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classRingOscillatorNoiseSource-members.html b/classRingOscillatorNoiseSource-members.html index 6c4b8c91..010074d2 100644 --- a/classRingOscillatorNoiseSource-members.html +++ b/classRingOscillatorNoiseSource-members.html @@ -101,7 +101,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classRingOscillatorNoiseSource.html b/classRingOscillatorNoiseSource.html index 3f58578f..abaf1d61 100644 --- a/classRingOscillatorNoiseSource.html +++ b/classRingOscillatorNoiseSource.html @@ -253,7 +253,7 @@ Additional Inherited Members diff --git a/classSHA256-members.html b/classSHA256-members.html index 828dbc58..8f631c9e 100644 --- a/classSHA256-members.html +++ b/classSHA256-members.html @@ -110,7 +110,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classSHA256.html b/classSHA256.html index e0639229..0d6111b7 100644 --- a/classSHA256.html +++ b/classSHA256.html @@ -506,7 +506,7 @@ Additional Inherited Members diff --git a/classSHA3__256-members.html b/classSHA3__256-members.html index 93431bb2..56a1a00e 100644 --- a/classSHA3__256-members.html +++ b/classSHA3__256-members.html @@ -106,7 +106,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classSHA3__256.html b/classSHA3__256.html index 83ddab16..67d4850c 100644 --- a/classSHA3__256.html +++ b/classSHA3__256.html @@ -506,7 +506,7 @@ Additional Inherited Members diff --git a/classSHA3__512-members.html b/classSHA3__512-members.html index 3636a6b7..9e2de975 100644 --- a/classSHA3__512-members.html +++ b/classSHA3__512-members.html @@ -106,7 +106,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classSHA3__512.html b/classSHA3__512.html index 099e57bd..9bf19340 100644 --- a/classSHA3__512.html +++ b/classSHA3__512.html @@ -506,7 +506,7 @@ Additional Inherited Members diff --git a/classSHA512-members.html b/classSHA512-members.html index f5ef6b43..3517aad6 100644 --- a/classSHA512-members.html +++ b/classSHA512-members.html @@ -112,7 +112,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classSHA512.html b/classSHA512.html index 1b01b62f..69455d4b 100644 --- a/classSHA512.html +++ b/classSHA512.html @@ -513,7 +513,7 @@ Additional Inherited Members diff --git a/classSHAKE-members.html b/classSHAKE-members.html index 2faa0471..77c89bf8 100644 --- a/classSHAKE-members.html +++ b/classSHAKE-members.html @@ -104,7 +104,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classSHAKE.html b/classSHAKE.html index c37cb65c..2ebe3cb8 100644 --- a/classSHAKE.html +++ b/classSHAKE.html @@ -443,7 +443,7 @@ Protected Member Functions diff --git a/classSHAKE128-members.html b/classSHAKE128-members.html index bbcad846..4234aca2 100644 --- a/classSHAKE128-members.html +++ b/classSHAKE128-members.html @@ -106,7 +106,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classSHAKE128.html b/classSHAKE128.html index 171117e6..e79227aa 100644 --- a/classSHAKE128.html +++ b/classSHAKE128.html @@ -171,7 +171,7 @@ Additional Inherited Members diff --git a/classSHAKE256-members.html b/classSHAKE256-members.html index 02d6797f..81554e3b 100644 --- a/classSHAKE256-members.html +++ b/classSHAKE256-members.html @@ -106,7 +106,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classSHAKE256.html b/classSHAKE256.html index 806fe668..58642c87 100644 --- a/classSHAKE256.html +++ b/classSHAKE256.html @@ -171,7 +171,7 @@ Additional Inherited Members diff --git a/classShell-members.html b/classShell-members.html index 6be146f9..68ceadb4 100644 --- a/classShell-members.html +++ b/classShell-members.html @@ -174,7 +174,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classShell.html b/classShell.html index 02c17b10..0591ca40 100644 --- a/classShell.html +++ b/classShell.html @@ -837,7 +837,7 @@ Additional Inherited Members diff --git a/classShellArguments-members.html b/classShellArguments-members.html index 46a036c1..4dc0228c 100644 --- a/classShellArguments-members.html +++ b/classShellArguments-members.html @@ -96,7 +96,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classShellArguments.html b/classShellArguments.html index a65597e9..a453fa2f 100644 --- a/classShellArguments.html +++ b/classShellArguments.html @@ -182,7 +182,7 @@ class Shell diff --git a/classSoftI2C-members.html b/classSoftI2C-members.html index 3b79298c..4cc1b915 100644 --- a/classSoftI2C-members.html +++ b/classSoftI2C-members.html @@ -101,7 +101,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classSoftI2C.html b/classSoftI2C.html index c0325937..b6d43d9b 100644 --- a/classSoftI2C.html +++ b/classSoftI2C.html @@ -346,7 +346,7 @@ unsigned int  diff --git a/classSpeck-members.html b/classSpeck-members.html index e5198ce0..26fb9265 100644 --- a/classSpeck-members.html +++ b/classSpeck-members.html @@ -103,7 +103,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classSpeck.html b/classSpeck.html index 0928b712..d6ec54c8 100644 --- a/classSpeck.html +++ b/classSpeck.html @@ -227,7 +227,7 @@ Public Member Functions

Implements BlockCipher.

-

Definition at line 611 of file Speck.cpp.

+

Definition at line 550 of file Speck.cpp.

@@ -275,7 +275,7 @@ Public Member Functions

Implements BlockCipher.

-

Definition at line 457 of file Speck.cpp.

+

Definition at line 425 of file Speck.cpp.

@@ -323,7 +323,7 @@ Public Member Functions

Implements BlockCipher.

-

Definition at line 306 of file Speck.cpp.

+

Definition at line 303 of file Speck.cpp.

@@ -415,7 +415,7 @@ Public Member Functions diff --git a/classSpeckSmall-members.html b/classSpeckSmall-members.html index 74837d9d..72ab8f1f 100644 --- a/classSpeckSmall-members.html +++ b/classSpeckSmall-members.html @@ -105,7 +105,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classSpeckSmall.html b/classSpeckSmall.html index 08ebe7ca..e5f2d531 100644 --- a/classSpeckSmall.html +++ b/classSpeckSmall.html @@ -210,7 +210,7 @@ Public Member Functions

Implements BlockCipher.

-

Definition at line 648 of file SpeckSmall.cpp.

+

Definition at line 582 of file SpeckSmall.cpp.

@@ -319,7 +319,7 @@ Public Member Functions diff --git a/classSpeckTiny-members.html b/classSpeckTiny-members.html index 7b54a262..ad7c92ec 100644 --- a/classSpeckTiny-members.html +++ b/classSpeckTiny-members.html @@ -104,7 +104,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classSpeckTiny.html b/classSpeckTiny.html index 069597de..08cbffaa 100644 --- a/classSpeckTiny.html +++ b/classSpeckTiny.html @@ -240,7 +240,7 @@ class SpeckSmall<

Implements BlockCipher.

-

Definition at line 532 of file SpeckTiny.cpp.

+

Definition at line 453 of file SpeckTiny.cpp.

@@ -288,7 +288,7 @@ class SpeckSmall<

Implements BlockCipher.

-

Definition at line 527 of file SpeckTiny.cpp.

+

Definition at line 448 of file SpeckTiny.cpp.

@@ -428,7 +428,7 @@ class SpeckSmall< diff --git a/classTerminal-members.html b/classTerminal-members.html index 7f509598..c9c5939d 100644 --- a/classTerminal-members.html +++ b/classTerminal-members.html @@ -156,7 +156,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classTerminal.html b/classTerminal.html index 906a3326..f2152bac 100644 --- a/classTerminal.html +++ b/classTerminal.html @@ -1443,7 +1443,7 @@ Static Public Member Functions diff --git a/classTextField-members.html b/classTextField-members.html index dae0eb31..45abb018 100644 --- a/classTextField-members.html +++ b/classTextField-members.html @@ -109,7 +109,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classTextField.html b/classTextField.html index 4f27f154..5dfd063f 100644 --- a/classTextField.html +++ b/classTextField.html @@ -343,7 +343,7 @@ LiquidCrystal *  diff --git a/classTimeField-members.html b/classTimeField-members.html index a90dbaed..0aa8958d 100644 --- a/classTimeField-members.html +++ b/classTimeField-members.html @@ -113,7 +113,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classTimeField.html b/classTimeField.html index 4127bedd..477717ac 100644 --- a/classTimeField.html +++ b/classTimeField.html @@ -541,7 +541,7 @@ LiquidCrystal *  diff --git a/classTransistorNoiseSource-members.html b/classTransistorNoiseSource-members.html index c7f13fe4..c5726e40 100644 --- a/classTransistorNoiseSource-members.html +++ b/classTransistorNoiseSource-members.html @@ -101,7 +101,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classTransistorNoiseSource.html b/classTransistorNoiseSource.html index 1938cc92..2a545a84 100644 --- a/classTransistorNoiseSource.html +++ b/classTransistorNoiseSource.html @@ -280,7 +280,7 @@ Additional Inherited Members diff --git a/classXOF-members.html b/classXOF-members.html index be11f7b7..4ae9569e 100644 --- a/classXOF-members.html +++ b/classXOF-members.html @@ -102,7 +102,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classXOF.html b/classXOF.html index ca0c8101..c96e43d3 100644 --- a/classXOF.html +++ b/classXOF.html @@ -508,7 +508,7 @@ Public Member Functions diff --git a/classXTS-members.html b/classXTS-members.html index b611f474..fcaae164 100644 --- a/classXTS-members.html +++ b/classXTS-members.html @@ -107,7 +107,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classXTS.html b/classXTS.html index be7ebf61..96702d77 100644 --- a/classXTS.html +++ b/classXTS.html @@ -220,7 +220,7 @@ template<typename T1, typename T2 = T1> diff --git a/classXTSCommon-members.html b/classXTSCommon-members.html index 6fc5fc72..d24ebc34 100644 --- a/classXTSCommon-members.html +++ b/classXTSCommon-members.html @@ -106,7 +106,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classXTSCommon.html b/classXTSCommon.html index 5f1497f2..11db097c 100644 --- a/classXTSCommon.html +++ b/classXTSCommon.html @@ -497,7 +497,7 @@ class XTSSingleKeyCommon diff --git a/classXTSSingleKey-members.html b/classXTSSingleKey-members.html index 62087af7..0fcd20ba 100644 --- a/classXTSSingleKey-members.html +++ b/classXTSSingleKey-members.html @@ -109,7 +109,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classXTSSingleKey.html b/classXTSSingleKey.html index e49d7753..22c7429e 100644 --- a/classXTSSingleKey.html +++ b/classXTSSingleKey.html @@ -218,7 +218,7 @@ template<typename T > diff --git a/classXTSSingleKeyCommon-members.html b/classXTSSingleKeyCommon-members.html index 9b4af14b..5ae0ce38 100644 --- a/classXTSSingleKeyCommon-members.html +++ b/classXTSSingleKeyCommon-members.html @@ -107,7 +107,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/classXTSSingleKeyCommon.html b/classXTSSingleKeyCommon.html index 6f71f59b..3344f5ba 100644 --- a/classXTSSingleKeyCommon.html +++ b/classXTSSingleKeyCommon.html @@ -257,7 +257,7 @@ Protected Member Functions diff --git a/classes.html b/classes.html index 0ceff76d..c8f9ebdb 100644 --- a/classes.html +++ b/classes.html @@ -139,7 +139,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/crypto-rng-ring_8dox.html b/crypto-rng-ring_8dox.html index 572505ff..aa98fd74 100644 --- a/crypto-rng-ring_8dox.html +++ b/crypto-rng-ring_8dox.html @@ -87,7 +87,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/crypto-rng_8dox.html b/crypto-rng_8dox.html index e0bc7b44..a9b0e261 100644 --- a/crypto-rng_8dox.html +++ b/crypto-rng_8dox.html @@ -87,7 +87,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/crypto.html b/crypto.html index baf62af6..98883999 100644 --- a/crypto.html +++ b/crypto.html @@ -123,23 +123,23 @@ Performance on AVR ChaCha (8 rounds)8.13us8.14us43.74us132 -Speck (128-bit key, ECB mode)10.72us11.09us287.02us275 +Speck (128-bit key, ECB mode)9.74us10.12us253.94us275 -Speck (192-bit key, ECB mode)11.03us11.42us298.21us275 +Speck (192-bit key, ECB mode)10.03us10.41us264.63us275 -Speck (256-bit key, ECB mode)11.35us11.74us309.66us275 +Speck (256-bit key, ECB mode)10.31us10.71us275.26us275 -SpeckSmall (128-bit key, ECB mode)35.25us36.46us207.66us67 +SpeckSmall (128-bit key, ECB mode)33.93us34.82us207.66us67 -SpeckSmall (192-bit key, ECB mode)36.56us37.56us220.55us67 +SpeckSmall (192-bit key, ECB mode)35.20us35.88us220.55us67 -SpeckSmall (256-bit key, ECB mode)37.87us38.67us233.32us67 +SpeckSmall (256-bit key, ECB mode)36.46us36.93us233.32us67 -SpeckTiny (128-bit key, ECB mode)35.25us10.22us35 +SpeckTiny (128-bit key, ECB mode)33.93us10.22us35 -SpeckTiny (192-bit key, ECB mode)36.56us13.62us35 +SpeckTiny (192-bit key, ECB mode)35.20us13.62us35 -SpeckTiny (256-bit key, ECB mode)37.87us16.89us35 +SpeckTiny (256-bit key, ECB mode)36.46us16.89us35 @@ -153,17 +153,17 @@ Performance on AVR GCM<AES256>123.04us122.59us1760.28us348 -GCM<Speck> (256-bit key)87.78us87.32us714.41us378 +GCM<Speck> (256-bit key)86.74us86.29us646.88us378 -GCM<SpeckTiny> (256-bit key)114.30us113.84us1270.32us138 +GCM<SpeckTiny> (256-bit key)112.90us112.44us1225.48us138 EAX<AES128>71.14us71.14us1311.97us268 EAX<AES256>97.80us97.80us1806.57us332 -EAX<Speck> (256-bit key)27.27us27.26us760.74us362 +EAX<Speck> (256-bit key)25.89us25.88us690.63us362 -EAX<SpeckTiny> (256-bit key)80.31us80.31us1316.60us122 +EAX<SpeckTiny> (256-bit key)78.20us78.20us1269.19us122 @@ -391,7 +391,7 @@ Performance on ARM diff --git a/crypto_8dox.html b/crypto_8dox.html index 15f27304..277c0d52 100644 --- a/crypto_8dox.html +++ b/crypto_8dox.html @@ -87,7 +87,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/crypto_rng.html b/crypto_rng.html index 4adedd7b..31b5ed8e 100644 --- a/crypto_rng.html +++ b/crypto_rng.html @@ -190,7 +190,7 @@ Destroying secret data diff --git a/crypto_rng_ring.html b/crypto_rng_ring.html index 3f2f8847..1a8e2c2b 100644 --- a/crypto_rng_ring.html +++ b/crypto_rng_ring.html @@ -151,7 +151,7 @@ Connecting to the Arduino diff --git a/dir_1586d320a3b1e622174530fde769cda9.html b/dir_1586d320a3b1e622174530fde769cda9.html index fb156f32..98f69c77 100644 --- a/dir_1586d320a3b1e622174530fde769cda9.html +++ b/dir_1586d320a3b1e622174530fde769cda9.html @@ -102,7 +102,7 @@ Files diff --git a/dir_1de32c476debcefedf4aa8bb43bea551.html b/dir_1de32c476debcefedf4aa8bb43bea551.html index 9b674c22..654bfc05 100644 --- a/dir_1de32c476debcefedf4aa8bb43bea551.html +++ b/dir_1de32c476debcefedf4aa8bb43bea551.html @@ -106,7 +106,7 @@ Files diff --git a/dir_3dd03323535933fb3f714c41ff7a94da.html b/dir_3dd03323535933fb3f714c41ff7a94da.html index 29b22213..0fb8614f 100644 --- a/dir_3dd03323535933fb3f714c41ff7a94da.html +++ b/dir_3dd03323535933fb3f714c41ff7a94da.html @@ -94,7 +94,7 @@ Files diff --git a/dir_470c03f38356b1f63943514897cb198b.html b/dir_470c03f38356b1f63943514897cb198b.html index 306acc77..6000583c 100644 --- a/dir_470c03f38356b1f63943514897cb198b.html +++ b/dir_470c03f38356b1f63943514897cb198b.html @@ -94,7 +94,7 @@ Files diff --git a/dir_48f64e79f12bd77ba047e9e436ec978c.html b/dir_48f64e79f12bd77ba047e9e436ec978c.html index 4148b909..6d22ca81 100644 --- a/dir_48f64e79f12bd77ba047e9e436ec978c.html +++ b/dir_48f64e79f12bd77ba047e9e436ec978c.html @@ -122,7 +122,7 @@ Files diff --git a/dir_5e87a7229a108582288ef7eda1233dc3.html b/dir_5e87a7229a108582288ef7eda1233dc3.html index 3652aee5..01d62c36 100644 --- a/dir_5e87a7229a108582288ef7eda1233dc3.html +++ b/dir_5e87a7229a108582288ef7eda1233dc3.html @@ -94,7 +94,7 @@ Files diff --git a/dir_6591a2127a29f6cea3994dcb5b0596d1.html b/dir_6591a2127a29f6cea3994dcb5b0596d1.html index bbda6af9..75fbc6d3 100644 --- a/dir_6591a2127a29f6cea3994dcb5b0596d1.html +++ b/dir_6591a2127a29f6cea3994dcb5b0596d1.html @@ -106,7 +106,7 @@ Files diff --git a/dir_7e6ab9b017486261fe80629d442521f0.html b/dir_7e6ab9b017486261fe80629d442521f0.html index 99e7461f..5f7069af 100644 --- a/dir_7e6ab9b017486261fe80629d442521f0.html +++ b/dir_7e6ab9b017486261fe80629d442521f0.html @@ -94,7 +94,7 @@ Files diff --git a/dir_9a34040863d1190c0e01b23e6b44de01.html b/dir_9a34040863d1190c0e01b23e6b44de01.html index c910ef3b..b29b1cdb 100644 --- a/dir_9a34040863d1190c0e01b23e6b44de01.html +++ b/dir_9a34040863d1190c0e01b23e6b44de01.html @@ -96,7 +96,7 @@ Files diff --git a/dir_bc0718b08fb2015b8e59c47b2805f60c.html b/dir_bc0718b08fb2015b8e59c47b2805f60c.html index 864d8471..c9beb9cd 100644 --- a/dir_bc0718b08fb2015b8e59c47b2805f60c.html +++ b/dir_bc0718b08fb2015b8e59c47b2805f60c.html @@ -116,7 +116,7 @@ Directories diff --git a/dir_be059bf9978ae156837504b1b8a7568c.html b/dir_be059bf9978ae156837504b1b8a7568c.html index 1a107615..64ed8ebf 100644 --- a/dir_be059bf9978ae156837504b1b8a7568c.html +++ b/dir_be059bf9978ae156837504b1b8a7568c.html @@ -94,7 +94,7 @@ Files diff --git a/dir_e2ce51835550ba18edf07a8311722290.html b/dir_e2ce51835550ba18edf07a8311722290.html index 42264c3c..1798c024 100644 --- a/dir_e2ce51835550ba18edf07a8311722290.html +++ b/dir_e2ce51835550ba18edf07a8311722290.html @@ -240,7 +240,7 @@ Files diff --git a/dir_f34881fcf60f680b800190d5274dfaea.html b/dir_f34881fcf60f680b800190d5274dfaea.html index 2f568a1d..a2998b43 100644 --- a/dir_f34881fcf60f680b800190d5274dfaea.html +++ b/dir_f34881fcf60f680b800190d5274dfaea.html @@ -106,7 +106,7 @@ Files diff --git a/dir_f9b96888882c2691b8eeaeafd1b9501d.html b/dir_f9b96888882c2691b8eeaeafd1b9501d.html index 71730376..d29893d0 100644 --- a/dir_f9b96888882c2691b8eeaeafd1b9501d.html +++ b/dir_f9b96888882c2691b8eeaeafd1b9501d.html @@ -102,7 +102,7 @@ Files diff --git a/dmd-demo_8dox.html b/dmd-demo_8dox.html index bee8c4e6..2723153d 100644 --- a/dmd-demo_8dox.html +++ b/dmd-demo_8dox.html @@ -87,7 +87,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/dmd-running-figure_8dox.html b/dmd-running-figure_8dox.html index 53f36ab6..ca20374e 100644 --- a/dmd-running-figure_8dox.html +++ b/dmd-running-figure_8dox.html @@ -87,7 +87,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/dmd_demo.html b/dmd_demo.html index 67bb1edd..73fa7dcb 100644 --- a/dmd_demo.html +++ b/dmd_demo.html @@ -236,7 +236,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/dmd_running_figure.html b/dmd_running_figure.html index d1c246d5..aeb77960 100644 --- a/dmd_running_figure.html +++ b/dmd_running_figure.html @@ -430,7 +430,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/files.html b/files.html index 1852f736..056716de 100644 --- a/files.html +++ b/files.html @@ -231,7 +231,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions.html b/functions.html index 1b83d08e..31320321 100644 --- a/functions.html +++ b/functions.html @@ -193,7 +193,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_b.html b/functions_b.html index 95ac17b7..08fff64c 100644 --- a/functions_b.html +++ b/functions_b.html @@ -208,7 +208,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_c.html b/functions_c.html index d506d1a9..fe06c667 100644 --- a/functions_c.html +++ b/functions_c.html @@ -261,7 +261,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_d.html b/functions_d.html index b6197209..7760e041 100644 --- a/functions_d.html +++ b/functions_d.html @@ -300,7 +300,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_e.html b/functions_e.html index 9168e124..9b8a016e 100644 --- a/functions_e.html +++ b/functions_e.html @@ -219,7 +219,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_enum.html b/functions_enum.html index 511ae1ab..268b092d 100644 --- a/functions_enum.html +++ b/functions_enum.html @@ -114,7 +114,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_eval.html b/functions_eval.html index 3bb44817..321357dc 100644 --- a/functions_eval.html +++ b/functions_eval.html @@ -168,7 +168,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_f.html b/functions_f.html index d64b4015..86a6efb7 100644 --- a/functions_f.html +++ b/functions_f.html @@ -187,7 +187,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_func.html b/functions_func.html index adfd4863..472264ba 100644 --- a/functions_func.html +++ b/functions_func.html @@ -186,7 +186,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_func_b.html b/functions_func_b.html index b9bf3701..fde803d0 100644 --- a/functions_func_b.html +++ b/functions_func_b.html @@ -194,7 +194,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_func_c.html b/functions_func_c.html index 43fc1d10..a77bdeec 100644 --- a/functions_func_c.html +++ b/functions_func_c.html @@ -253,7 +253,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_func_d.html b/functions_func_d.html index 0981a161..6603f8a8 100644 --- a/functions_func_d.html +++ b/functions_func_d.html @@ -262,7 +262,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_func_e.html b/functions_func_e.html index b509bdbd..232fc250 100644 --- a/functions_func_e.html +++ b/functions_func_e.html @@ -218,7 +218,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_func_f.html b/functions_func_f.html index 94ff46b8..505525a5 100644 --- a/functions_func_f.html +++ b/functions_func_f.html @@ -180,7 +180,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_func_g.html b/functions_func_g.html index af2417c0..e76ba3d4 100644 --- a/functions_func_g.html +++ b/functions_func_g.html @@ -144,7 +144,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_func_h.html b/functions_func_h.html index 3e817ab0..38f4039b 100644 --- a/functions_func_h.html +++ b/functions_func_h.html @@ -161,7 +161,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_func_i.html b/functions_func_i.html index 9e747128..66624444 100644 --- a/functions_func_i.html +++ b/functions_func_i.html @@ -202,7 +202,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_func_k.html b/functions_func_k.html index e0f74345..da422ae7 100644 --- a/functions_func_k.html +++ b/functions_func_k.html @@ -153,7 +153,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_func_l.html b/functions_func_l.html index 3b593040..3cc4d998 100644 --- a/functions_func_l.html +++ b/functions_func_l.html @@ -157,7 +157,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_func_m.html b/functions_func_m.html index a5ed966d..8e375a45 100644 --- a/functions_func_m.html +++ b/functions_func_m.html @@ -160,7 +160,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_func_n.html b/functions_func_n.html index 1e578f4f..f8055743 100644 --- a/functions_func_n.html +++ b/functions_func_n.html @@ -143,7 +143,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_func_o.html b/functions_func_o.html index f2f778e1..ae448a96 100644 --- a/functions_func_o.html +++ b/functions_func_o.html @@ -149,7 +149,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_func_p.html b/functions_func_p.html index cefbd2bc..658320fa 100644 --- a/functions_func_p.html +++ b/functions_func_p.html @@ -179,7 +179,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_func_r.html b/functions_func_r.html index 89752f23..67b00abb 100644 --- a/functions_func_r.html +++ b/functions_func_r.html @@ -228,7 +228,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_func_s.html b/functions_func_s.html index 96353537..1dddbace 100644 --- a/functions_func_s.html +++ b/functions_func_s.html @@ -427,7 +427,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_func_t.html b/functions_func_t.html index 48f58726..005d18d5 100644 --- a/functions_func_t.html +++ b/functions_func_t.html @@ -161,7 +161,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_func_u.html b/functions_func_u.html index 6323fb3f..c07f911b 100644 --- a/functions_func_u.html +++ b/functions_func_u.html @@ -167,7 +167,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_func_v.html b/functions_func_v.html index 4d18e9ed..7cb0fc43 100644 --- a/functions_func_v.html +++ b/functions_func_v.html @@ -139,7 +139,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_func_w.html b/functions_func_w.html index ce8ee67d..1615cddd 100644 --- a/functions_func_w.html +++ b/functions_func_w.html @@ -166,7 +166,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_func_x.html b/functions_func_x.html index d7890a49..bf09d53c 100644 --- a/functions_func_x.html +++ b/functions_func_x.html @@ -143,7 +143,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_func_~.html b/functions_func_~.html index bbf66b87..74c75f74 100644 --- a/functions_func_~.html +++ b/functions_func_~.html @@ -242,7 +242,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_g.html b/functions_g.html index 3658c9af..394a2ed3 100644 --- a/functions_g.html +++ b/functions_g.html @@ -148,7 +148,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_h.html b/functions_h.html index 6daaec61..36666a28 100644 --- a/functions_h.html +++ b/functions_h.html @@ -166,7 +166,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_i.html b/functions_i.html index 5b850151..781cff23 100644 --- a/functions_i.html +++ b/functions_i.html @@ -206,7 +206,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_k.html b/functions_k.html index 8498b8e7..7429a374 100644 --- a/functions_k.html +++ b/functions_k.html @@ -154,7 +154,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_l.html b/functions_l.html index a4fcf214..d22ae388 100644 --- a/functions_l.html +++ b/functions_l.html @@ -161,7 +161,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_m.html b/functions_m.html index d079c298..4991da90 100644 --- a/functions_m.html +++ b/functions_m.html @@ -174,7 +174,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_n.html b/functions_n.html index 5b7f85be..bba54974 100644 --- a/functions_n.html +++ b/functions_n.html @@ -150,7 +150,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_o.html b/functions_o.html index be817c78..a654d0e4 100644 --- a/functions_o.html +++ b/functions_o.html @@ -150,7 +150,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_p.html b/functions_p.html index 2b4366dc..2b67cd6b 100644 --- a/functions_p.html +++ b/functions_p.html @@ -183,7 +183,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_r.html b/functions_r.html index f7fb5ebe..5f709270 100644 --- a/functions_r.html +++ b/functions_r.html @@ -235,7 +235,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_rela.html b/functions_rela.html index 6df85f18..343e3685 100644 --- a/functions_rela.html +++ b/functions_rela.html @@ -102,7 +102,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_s.html b/functions_s.html index a09a6418..78898a4c 100644 --- a/functions_s.html +++ b/functions_s.html @@ -444,7 +444,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_t.html b/functions_t.html index 4eb695a3..d58ffc67 100644 --- a/functions_t.html +++ b/functions_t.html @@ -168,7 +168,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_type.html b/functions_type.html index e075d2fd..16aa4b64 100644 --- a/functions_type.html +++ b/functions_type.html @@ -108,7 +108,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_u.html b/functions_u.html index 8bdcddd2..6d4aa1f3 100644 --- a/functions_u.html +++ b/functions_u.html @@ -168,7 +168,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_v.html b/functions_v.html index 4895b6a7..0e30a370 100644 --- a/functions_v.html +++ b/functions_v.html @@ -143,7 +143,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_vars.html b/functions_vars.html index 6e3a5faa..633553de 100644 --- a/functions_vars.html +++ b/functions_vars.html @@ -157,7 +157,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_w.html b/functions_w.html index 562c7008..4dca23a0 100644 --- a/functions_w.html +++ b/functions_w.html @@ -174,7 +174,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_x.html b/functions_x.html index 6c11eb31..4691efe8 100644 --- a/functions_x.html +++ b/functions_x.html @@ -144,7 +144,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_y.html b/functions_y.html index 3bdaefde..c9c54ebb 100644 --- a/functions_y.html +++ b/functions_y.html @@ -135,7 +135,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/functions_~.html b/functions_~.html index c3e594b5..366efe43 100644 --- a/functions_~.html +++ b/functions_~.html @@ -243,7 +243,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/group__power__save.html b/group__power__save.html index b3dd18ab..63a904f0 100644 --- a/group__power__save.html +++ b/group__power__save.html @@ -201,7 +201,7 @@ void  diff --git a/hierarchy.html b/hierarchy.html index 232e22f3..214e4352 100644 --- a/hierarchy.html +++ b/hierarchy.html @@ -179,7 +179,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/index.html b/index.html index ec1bc237..595456ae 100644 --- a/index.html +++ b/index.html @@ -165,7 +165,7 @@ Other diff --git a/ir-dumpir_8dox.html b/ir-dumpir_8dox.html index 5ab07b8f..30d62ee4 100644 --- a/ir-dumpir_8dox.html +++ b/ir-dumpir_8dox.html @@ -87,7 +87,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/ir-snake_8dox.html b/ir-snake_8dox.html index 7157aca8..0787068c 100644 --- a/ir-snake_8dox.html +++ b/ir-snake_8dox.html @@ -87,7 +87,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/ir_dumpir.html b/ir_dumpir.html index bc850256..cccbcc79 100644 --- a/ir_dumpir.html +++ b/ir_dumpir.html @@ -283,7 +283,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/ir_snake.html b/ir_snake.html index 73743ff3..9c87439f 100644 --- a/ir_snake.html +++ b/ir_snake.html @@ -273,7 +273,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/lcd-form_8dox.html b/lcd-form_8dox.html index 2c82e353..0391fba3 100644 --- a/lcd-form_8dox.html +++ b/lcd-form_8dox.html @@ -87,7 +87,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/lcd-helloworld_8dox.html b/lcd-helloworld_8dox.html index 21155eac..191598db 100644 --- a/lcd-helloworld_8dox.html +++ b/lcd-helloworld_8dox.html @@ -87,7 +87,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/lcd_form.html b/lcd_form.html index 464b8692..81dfd2a6 100644 --- a/lcd_form.html +++ b/lcd_form.html @@ -216,7 +216,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/lcd_hello_world.html b/lcd_hello_world.html index 9b73738c..d936f273 100644 --- a/lcd_hello_world.html +++ b/lcd_hello_world.html @@ -166,7 +166,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/mainpage_8dox.html b/mainpage_8dox.html index 72976aea..a7b484c1 100644 --- a/mainpage_8dox.html +++ b/mainpage_8dox.html @@ -87,7 +87,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/modules.html b/modules.html index 960a6656..76d8b3f6 100644 --- a/modules.html +++ b/modules.html @@ -87,7 +87,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/newhope-small_8dox.html b/newhope-small_8dox.html index b30744b6..d60d607d 100644 --- a/newhope-small_8dox.html +++ b/newhope-small_8dox.html @@ -87,7 +87,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/newhope_small.html b/newhope_small.html index 125b9740..b78174ba 100644 --- a/newhope_small.html +++ b/newhope_small.html @@ -250,7 +250,7 @@ Summary diff --git a/pages.html b/pages.html index 946b1e78..cf857287 100644 --- a/pages.html +++ b/pages.html @@ -103,7 +103,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/shell-serial_8dox.html b/shell-serial_8dox.html index 4a0cc7a6..d581d577 100644 --- a/shell-serial_8dox.html +++ b/shell-serial_8dox.html @@ -87,7 +87,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/shell-telnet_8dox.html b/shell-telnet_8dox.html index 4f7bdf98..e003df0d 100644 --- a/shell-telnet_8dox.html +++ b/shell-telnet_8dox.html @@ -87,7 +87,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/shell_serial.html b/shell_serial.html index 6a385eda..baea5474 100644 --- a/shell_serial.html +++ b/shell_serial.html @@ -156,7 +156,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/shell_telnet.html b/shell_telnet.html index 6a163292..d9e67dfe 100644 --- a/shell_telnet.html +++ b/shell_telnet.html @@ -165,7 +165,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/structNewHopePrivateKey.html b/structNewHopePrivateKey.html index 3f5700ab..a6a3a48e 100644 --- a/structNewHopePrivateKey.html +++ b/structNewHopePrivateKey.html @@ -104,7 +104,7 @@ var searchBox = new SearchBox("searchBox", "search",false,'Search'); diff --git a/structRTCAlarm.html b/structRTCAlarm.html index 457f6e79..0a75092c 100644 --- a/structRTCAlarm.html +++ b/structRTCAlarm.html @@ -200,7 +200,7 @@ uint8_t  diff --git a/structRTCDate.html b/structRTCDate.html index 8c8ea468..aaf002d9 100644 --- a/structRTCDate.html +++ b/structRTCDate.html @@ -123,7 +123,7 @@ uint8_t  diff --git a/structRTCTime.html b/structRTCTime.html index 68f6fcd5..8ba6533c 100644 --- a/structRTCTime.html +++ b/structRTCTime.html @@ -123,7 +123,7 @@ uint8_t