Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.
|
Forum Index : Microcontroller and PC projects : PicoMite V6.00.01 release candidates - please test thoroughly
Page 20 of 21 | |||||
Author | Message | ||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 9297 |
Harm Please check this PicoMite.zip |
||||
twofingers Guru Joined: 02/06/2014 Location: GermanyPosts: 1316 |
Hi Peter, I think there is a problem with "Autosave append" and the heap memory. If I cancel "autosave append" with CTRL-C, I only have 3328k heap memory instead of 183kB. Only after a "NEW" do I have 183KB again > memory Program: 3K ( 1%) Program (162 lines) 177K (99%) Free Saved Variables: 16K (100%) Free RAM: 0K ( 0%) 0 Variables 0K ( 0%) General 228K (100%) Free > ? mm.info(heap) 183808 > autosave append > ? mm.info(heap) 3328 > memory Program: 3K ( 1%) Program (162 lines) 177K (99%) Free Saved Variables: 16K (100%) Free RAM: 0K ( 0%) 0 Variables 176K (77%) General 52K (23%) Free > new > ? mm.info(heap) 183808 > autosave append > ? mm.info(heap) 3328 > autosave append Error : Not enough Heap memory > I think this is a low priority issue. I just wanted you to know about it. If you don't know the reason and the problem suddenly occurs, it's confusing. Regards Michael Edited 2024-12-22 21:25 by twofingers causality ≠ correlation ≠ coincidence |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 9297 |
Michael: thanks for the report - easily fixed Note to Harm BAD If MM.Device$ = "PicoMiteVGA" Then GOOD if instr(MM.Device$, "PicoMiteVGA") Then Edited 2024-12-22 22:23 by matherp |
||||
homa Guru Joined: 05/11/2021 Location: GermanyPosts: 384 |
> option list PicoMiteHDMI MMBasic USB RP2350A Edition V6.00.01RC9 OPTION SERIAL CONSOLE COM2,GP8,GP9 OPTION SYSTEM I2C GP20,GP21 OPTION FLASH SIZE 4194304 OPTION COLOURCODE ON OPTION KEYBOARD GR OPTION CPUSPEED (KHz) 315000 OPTION DISPLAY 30, 53 OPTION SDCARD GP22, GP26, GP27, GP28 OPTION AUDIO GP10,GP11', ON PWM CHANNEL 5 OPTION RTC AUTO ENABLE OPTION MODBUFF ENABLE 192 OPTION PLATFORM HDMIUSB > files A:/ <DIR> . <DIR> .. 15:12 22-12-2024 19340 book.txt 14:44 22-12-2024 4 bootcount 14:57 22-12-2024 22542 fm.bas 15:12 22-12-2024 38216 picochess4.bas 15:12 22-12-2024 28854 small.bmp 2 directories, 5 files, 2260992 bytes free > Sprite Loadbmp 1, "small.bmp",x,y,18,18 Error : Could not find the file > Is this possibly a bug? I have added .bmp, I have copied it to "a:" and I have also tried 'a:small.bmp' and 'a:/small.bmp'... I came across this in ‘picochess4.bas’. Matthias |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 9297 |
bug - will fix |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 9297 |
V6.00.01RC10 PicoMiteRP2040V6.00.01RC10.zip PicoMiteRP2350V6.00.01RC10.zip Please, please if reporting any issues specify the exact version used and list all options set Bug fixes Bug in SPRITE LOADBMP not finding the file Memory leak when AUTOSAVE APPEND is exited with Ctrl-C Crashes in WebMite2040 caused by system heap being exceeded (in since 5.09) Bug in VGA RP2040 caused by system/firmware memory overrun Modifications Tweaks the PSRAM timings to allow 372MHz operation of Pimoroni boards with RP2350B and 8Mb PSRAM. This enables 1280P resolution with a RP2350B running HDMI firmware New functionality LONGSTRING AES128 ENCRYPT/DECRYPT CBC/ECB/CTR key$/key[!/%](), in%(), out%() [,iv$/iv[!/%]()] Encrypts or decrypts the longstring in in%() putting the answer in out%() For CBC and CTR modes the encryption will generate a random initialisation vector and prepend out%() with the IV. If an explicit IV is specified this will be used instead of the random vector and this will be prepended to out%() For CBC and CTR decryption the firmware assumes that the first 16 bytes of in%() are the initialisation vector. In the case where you want to transmit a message without IV you can use LONGSTRING RIGHT to remove the IV before sending the message. In this case the recipient must know the IV as well as the key and create a complete longstring before using DECRYPT. This can be done by using LONGSTRING CONCAT to add the incoming message to a longstring containing the IV. LONGSTRING BASE64 ENCODE/DECODE in%(), out%() This BASE64 encodes or decodes the longstring in in%() placing the answer in out%(). The array used as the output must be big enough relative to the input and the direction. Encoding increases length by 4/3 and decoding decreases it by 3/4 Function MATH(BASE64 ENCODE/DECODE in$/in(), out$/out()) Returns the length of out$/out(). This base64 encodes or decodes the data in 'in' and puts the result in 'out'. Where arrays are used as the output they must be big enough relative to the input and the direction. Encryption increases length by 4/3 and decryption decreases it by 3/4 Command MATH AES128 ENCRYPT/DECRYPT CBC/ECB/CTR key$/key(), in$/in(), out$/out() [,iv$/iv() This command encrypts or decrypts the data in 'in' and puts the answer in 'out' using the AES128 encryption method specified The parameters can each be either a string, integer array, or float array with any mix possible The key must be 16 elements long (16*8=128bits) in and out must be a multiple of 16 elements long. In the case of out being specified as a string (e.g. out$), the string variable must exist and should be set to empty (DIM out$="") The maximum number of elements in 'in' and 'out' is limited by memory when defined as arrays. Strings for encrypting are limited to 240bytes (EBR) and 224bytes (CTR and CBC). For CBC and CTR encryption you can optionally specify an initialisation vector 'iv'. 'iv' must be 16 elements long (16*8=128bits). If an initialisation vector is not specified encryption will generate a random initialisation vector. In both cases the output is prepended with the IV. For CBC and CTR, decryption requires that the first 16 elements of the input are the initialisation vector. In the case where you want to transmit a message without IV you should remove the IV before sending the message using standard MMBasic manipulations. In this case the recipient must know the IV as well as the key and create a complete message before using DECRYPT by prepending the IV to the incoming message. Edited 2024-12-23 03:00 by matherp |
||||
javavi Guru Joined: 01/10/2023 Location: UkrainePosts: 301 |
PicoMiteHDMI MMBasic RP2350A Edition V6.00.01RC10 OK! PSRAM (ESP-PSRAM64H 133MHz) works in 640 & 1024 HDMI resolutions 640 @315MHz | 1024 @324MHz | When changing the HDMI resolution to 1280, the following message appears at startup: Invalid clock speed - reset to default the resolution is reset to 640 but the default font settings remain FONT 3 All these innovations are already reaching the minor version PicoMite V6.01 Edited 2024-12-23 03:35 by javavi |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 9297 |
Just do Option RESET to clear up. The test for working just attempts to get the firmware to run and doesn't try to tidy up. |
||||
javavi Guru Joined: 01/10/2023 Location: UkrainePosts: 301 |
In my case, this reset leads to the need to configure all the options again. This is especially difficult on PicoMite USB editions, since my board does not have USB-UART on the pins by default. Although there is the ability to connect an external USB Hub. Edited 2024-12-23 04:03 by javavi |
||||
twofingers Guru Joined: 02/06/2014 Location: GermanyPosts: 1316 |
About: V6.00.01RC10 Hi Peter, AFAIK is there an issue with Math aes128 decrypt ctr key$,out$,comp$,iv$ I suspect that only the IV$ part (initialisation vector) is affected. If "IV$" is commented out it works (iv_enabled=0). The longstring DEcrypt version also works! LongString AES128 DECRYPT CTR key$, lout%(), lcomp%() ,iv$ Demo code. ' Peters aes demo program for Picomites ' modified for ascii input by twofingers@TBS Option explicit CLS Const iv_enabled = 0 ' IV on/OFF <<<<<<<<<<<<<------------------- Dim string in$="",out$="",comp$="" Dim integer i Dim key$ ="0123456789ABCDEF" 'Your "Password" Dim IV$ ="0123456789012345" 'initialisation vector 'convert the message to a string version of the message Input "Your message (max 224): ", in$ Inc in$,String$((16-Len(in$) Mod 16)Mod 16,0) ' encrypt the message If iv_enabled Then Math aes128 encrypt ctr key$,in$,out$,iv$ Else Math aes128 encrypt ctr key$,in$,out$',iv$ EndIf IV$=Left$(out$,16) Print "1> "out$,Len(IV$),Len(out$) If iv_enabled Then out$=Mid$(out$,17) Print "2> "out$,Len(IV$),Len(out$) 'decrypt the message If iv_enabled Then Math aes128 decrypt ctr key$,out$,comp$,iv$ Else Math aes128 decrypt ctr key$,out$,comp$',iv$ EndIf Print out$ Print comp$ 'check for errors If in$<>comp$ Then Print "WTF" Else Print "Okay" End Regards Michael This is a working example using "Longstring AES ..." for decrypting: ' Peters aes demo program for Picomites ' modified for ascii input by twofingers@TBS Option explicit CLS Dim string in$="",out$="",comp$="" Dim integer i Dim key$ ="0123456789ABCDEF" 'Your "Password" Dim IV$ ="0123456789012345" 'initialisation vector Dim lout%(2048),lcomp%(2048) 'convert the message to a string version of the message Input "Your message (max 224): ", in$ Inc in$,String$((16-Len(in$) Mod 16)Mod 16,0) ' encrypt the message Math aes128 encrypt ctr key$,in$,out$,iv$ LongString append lout%(),out$ 'decrypt the message LongString AES128 DECRYPT CTR key$, lout%(), lcomp%() ,iv$ comp$ = LGetStr$(lcomp%(), 1, Len(in$)) 'Math aes128 decrypt ctr key$,out$,comp$,iv$ Print out$ Print comp$ 'check for errors If in$<>comp$ Then Print "WTF" Else Print "Okay" End Edited 2024-12-23 07:30 by twofingers causality ≠ correlation ≠ coincidence |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 9297 |
Please read my post. Decrypt no longer has a iv option |
||||
twofingers Guru Joined: 02/06/2014 Location: GermanyPosts: 1316 |
@Peter Thanks. Works! I'm just wondering how MATH AES DECRYPT detects if the message was sent with or without IV, hence my confusion. Michael I'm guessing it sets a flag in the output file? ' Peters aes demo program for Picomites ' modified for ascii input by twofingers@TBS Option explicit CLS Const iv_enabled = 1 ' IV on/OFF <<<<<<<<<<<<<------------------- Dim string in$="",out$="",comp$="" Dim integer i Dim key$ ="0123456789ABCDEF" 'Your "Password" Dim IV$ ="0123456789012345" 'initialisation vector 'convert the message to a string version of the message Input "Your message (max 224): ", in$ Inc in$,String$((16-Len(in$) Mod 16)Mod 16,0) ' encrypt the message If iv_enabled Then Math aes128 encrypt ctr key$,in$,out$,iv$ Else Math aes128 encrypt ctr key$,in$,out$ 'without initialisation vector EndIf 'decrypt the message Math aes128 decrypt ctr key$,out$,comp$ ' Print ">"comp$"<" 'check for errors If in$<>comp$ Then Print "WTF" Else Print "Okay" End Edited 2024-12-23 09:09 by twofingers causality ≠ correlation ≠ coincidence |
||||
phil99 Guru Joined: 11/02/2018 Location: AustraliaPosts: 2183 |
My understanding is an IV is always prepended to the message. If you don't specify one a random one is used. If you supply an IV at the decryption end the prepended one is ignored. Edit. Perhaps I haven't understood the question. If the IV has been removed before sending it is up to the receiving end program to add the IV before decrypting. There is no automatic mechanism to determine if the IV has been removed before sending. Edited 2024-12-23 09:44 by phil99 |
||||
twofingers Guru Joined: 02/06/2014 Location: GermanyPosts: 1316 |
Very true. That's exactly how it is! "Out$" is always the same length. Michael And the program on the receiving end must know that it is required to add the IV. Edited 2024-12-23 09:56 by twofingers causality ≠ correlation ≠ coincidence |
||||
Michal Senior Member Joined: 02/02/2022 Location: PolandPosts: 125 |
> option list PicoMite MMBasic RP2350A Edition V6.00.01RC10 OPTION FLASH SIZE 4194304 OPTION CPUSPEED 150000 'KHz > run MMBASIC benchmark (C) KnivD 2016 Calculating... [8] randomize Timer Error : Unknown command |
||||
twofingers Guru Joined: 02/06/2014 Location: GermanyPosts: 1316 |
Hi Michal, I think "RANDOMIZE nbr" is no longer available on the Pico 2. Maybe and can help? Regards Michael Edited 2024-12-23 19:43 by twofingers causality ≠ correlation ≠ coincidence |
||||
Volhout Guru Joined: 05/03/2018 Location: NetherlandsPosts: 4357 |
Peter, Thanks, PLAY WAV works now on 2040 VGA. Volhout Edited 2024-12-23 19:42 by Volhout PicomiteVGA PETSCII ROBOTS |
||||
Michal Senior Member Joined: 02/02/2022 Location: PolandPosts: 125 |
Yes, MATH RANDOMIZE TIMER in place of RANDOMIZE TIMER works on both. |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 9297 |
Randomize is not needed on the rp2350 because the chip uses a H/W mechanism to generate entropy. The RP2040 uses the standard C rand() software function. MATH RANDOMIZE uses a completely different and better software function than the standard C version. If you use MATH RANDOMIZE you must also use MATH(RAND) and not RND or you are achieving nothing |
||||
Geoffg Guru Joined: 06/06/2011 Location: AustraliaPosts: 3233 |
It would be handy if the RP2350 version simply ignored the RANDOMIZE command rather than generate an error. That would allow many programs to run unchanged on either platform. Geoff Geoff Graham - http://geoffg.net |
||||
Page 20 of 21 |
Print this page |