Commit Graph

457 Commits

Author SHA1 Message Date
Sean Cross b168784fa0 aesio: add basic AES encryption and decryption
This adds initial support for an AES module named aesio.  This
implementation supports only a subset of AES modes, namely
ECB, CBC, and CTR modes.

Example usage:

```
>>> import aesio
>>>
>>> key = b'Sixteen byte key'
>>> cipher = aesio.AES(key, aesio.MODE_ECB)
>>> output = bytearray(16)
>>> cipher.encrypt_into(b'Circuit Python!!', output)
>>> output
bytearray(b'E\x14\x85\x18\x9a\x9c\r\x95>\xa7kV\xa2`\x8b\n')
>>>
```

This key is 16-bytes, so it uses AES128.  If your key is 24- or 32-
bytes long, it will switch to AES192 or AES256 respectively.

This has been tested with many of the official NIST test vectors,
such as those used in `pycryptodome` at
39626a5b01/lib/Crypto/SelfTest/Cipher/test_vectors/AES

CTR has not been tested as NIST does not provide test vectors for it.

Signed-off-by: Sean Cross <sean@xobs.io>
2020-05-06 17:40:06 +08:00
hierophect c311b5c002
Merge pull request #2842 from hierophect/stm32-h7-displayio
STM32: Add displayio to F7/H7
2020-05-05 12:37:08 -04:00
Dan Halbert bae7a5e433 make translate again 2020-05-04 17:26:59 -04:00
Lucian Copeland 61b0994631 Fix flag typo 2020-05-01 14:46:06 -04:00
Lucian Copeland 4f71bd295d Make PulseIO optional within DisplayIO 2020-04-30 14:47:50 -04:00
Dan Halbert fbc8719fad ringbuf tested 2020-04-21 22:40:12 -04:00
Dan Halbert 77cd93ac2d merge from adafruit 2020-04-21 17:47:51 -04:00
Dan Halbert 38ec3bc574 further ringbuf cleanup 2020-04-21 17:38:20 -04:00
Scott Shawcroft bebf27e733
Merge remote-tracking branch 'adafruit/master' into lower_power
This isn't perfect and needs a bit more testing.
2020-04-20 18:25:13 -07:00
Jeff Epler 9bfe6b7197 framebufferio: update copyright information 2020-04-17 18:44:07 -05:00
Jeff Epler 5fcc6d6286 RGBMatrix: finish renaming from Protomatter
This gets all the purely internal references.  Some uses of
protomatter/Protomatter/PROTOMATTER remain, as they are references
to symbols in the Protomatter C library itself.
2020-04-17 18:44:07 -05:00
Jeff Epler 57ce2d1f41 framebufferio: get width, etc., from protocol, not object property 2020-04-17 18:43:57 -05:00
Jeff Epler 3d6258f63d Rename Protomatter -> RGBMatrix
This is a quick rename, it changes the user-facing names but not the
internal names of things.
2020-04-17 18:43:57 -05:00
Jeff Epler 64c3968a2e protomatter: move get_width/height to common_hal 2020-04-17 18:43:57 -05:00
Jeff Epler a32337718d Rename _protomatter -> protomatter
I originally believed that there would be a wrapper library around it,
like with _pixelbuf; but this proves not to be the case, as there's
too little for the library to do.
2020-04-17 18:43:57 -05:00
Scott Shawcroft abd340a8e4
Remove tick.h from merged file. 2020-04-16 11:35:19 -07:00
Scott Shawcroft b580b34cbf
Merge remote-tracking branch 'adafruit/master' into lower_power 2020-04-14 17:14:44 -07:00
Jeff Epler d8362ef654 displayio: swap colors in palettes too
.. change the in-rom palette to be in RGB565 order
2020-04-14 18:25:00 -05:00
Jeff Epler 880fff80e9 protomatter: Respond to review comments
- rename oe_pin -> output_enable_pin
 - improve and reorganize docstrings
 - rename swapbuffers->refresh
 - rename "paused" -> "brightness", change semantics slightly
 - common_hal several functions
 - clarify why the common_hal routines can't be used directly in the
   protocol's function pointers
 - whitespace cleanups
 - remove prototypes for nonexistent functions
2020-04-14 18:24:59 -05:00
Jeff Epler ba20bc8b43 framebufferio: move backlight down to the underlying framebuffer 2020-04-14 18:24:58 -05:00
Jeff Epler e4c6b241a9 protomatter: Use low end of supervisor heap
Per @tannewt, this area "sees more churn", so it's probably the right
choice here
2020-04-14 18:24:58 -05:00
Jeff Epler 5dae23c0e7 protomatter: release the protomatter object during release_displays() 2020-04-14 18:24:58 -05:00
Jeff Epler 0ca270172f protomatter: allocator: Never supervisor-alloc while gc available
This may have been contributing to fragmentation of the supervisor
heap
2020-04-14 18:24:58 -05:00
Jeff Epler baf04b7738 FramebufferDisplay: remove probably not needed constructor arguments 2020-04-14 18:24:58 -05:00
Jeff Epler a663a7dd30 _protomatter: move get/set paused into shared-module 2020-04-14 18:24:58 -05:00
Jeff Epler caea4e010f deinit: Work harder to ensure storage is released at deinit 2020-04-14 18:24:58 -05:00
Jeff Epler 1f3821220e fix build for non-displayio & non-protomatter targets 2020-04-14 18:24:58 -05:00
Jeff Epler 3a94412cd3 protomatter: more memory allocation fixes
- bump supervisor alloc count by 4 (we actually use 5)
 - move reconstruct to after gc heap is reset
 - destroy protomatter object entirely if not used by a FramebufferDisplay
 - ensure previous supervisor allocations are released
 - zero out pointers so GC can collect them
2020-04-14 18:24:58 -05:00
Jeff Epler 09dc46a984 Add Protomatter and FramebufferDisplay 2020-04-14 18:24:54 -05:00
Jeff Epler 8cba145c90 displayio: implement, use allocate_new_display_bus_or_raise 2020-04-14 18:24:54 -05:00
Jeff Epler 6378d600c4 displayio: implement, use allocate_display_or_raise 2020-04-14 18:24:54 -05:00
caternuson a9fb34eb93 make packed word and copy it in 2020-04-13 16:48:27 -07:00
caternuson dc75746842 add docstring, clean up 2020-04-09 08:59:26 -07:00
caternuson 49fff2d9b4 initial working fill 2020-04-09 08:43:50 -07:00
Scott Shawcroft 4ee6754ccd
Save backlight_on_high correctly.
Fixes #2750
2020-04-08 10:32:54 -07:00
Scott Shawcroft 8fe512c7e9
Merge remote-tracking branch 'adafruit/master' into lower_power 2020-03-31 15:13:58 -07:00
Jeff Epler 54e8c63b4f
Merge pull request #2730 from tannewt/fix_fourwire_phase_polarity
Add polarity and phase to FourWire.
2020-03-28 07:28:37 -05:00
siddacious 9e0c00dfd4 adding a backlight polarity flag to Display 2020-03-25 22:51:20 -07:00
Scott Shawcroft 6b7acc65b6
Add polarity and phase to FourWire.
It was fixed as 0/0 even though it used to get it from the current
SPI state. This makes it more explicit with kwargs.

Thanks to magpie_lark and kmatocha on the Adafruit Support forum
for finding the issue: https://forums.adafruit.com/viewtopic.php?f=60&t=162515
2020-03-25 11:22:46 -07:00
Jeff Epler 310f2ccdf4 Pixelbuf: subscr: Get correct pixel value
Previously, the 0th pixel's value was always returned
2020-03-18 10:25:20 -05:00
Scott Shawcroft 6db11cf68b
Fix up Spresense build. It doesn't sleep. 2020-03-17 14:21:45 -07:00
Scott Shawcroft 48b5f2a384
Initial work on SAMD 2020-03-13 11:16:41 -07:00
Scott Shawcroft 6f60afe8c5
First try at lowering the power consumption 2020-03-13 11:12:30 -07:00
Dan Halbert 817b5be320 rename routines to be clearer; fix wiznet arg types 2020-03-05 16:35:31 -05:00
Dan Halbert b6206406de new pin validation routines; don't use mp_const_none if NULL will do 2020-02-28 23:43:04 -05:00
Dave Marples d41cf2e926 Fix incorrect initialisation of default UART 2020-02-23 11:16:24 +00:00
Dave Marples d388899985 Addition of RS485 support 2020-02-18 23:16:40 +00:00
Dave Marples 84ad3d8393 Addition of RTS/CTS/RS485 UART functionality 2020-02-18 23:16:40 +00:00
Scott Shawcroft e97b0cfc61
Merge pull request #2581 from jamesbowman/master
First draft of eveL, the low-level module of the Gameduino bindings
2020-02-13 11:21:32 -08:00
Gadi Rotenberg 07708f1518 Added fix to allow remount when usb enabled but msc is ejected 2020-02-12 09:57:58 +02:00