• ZMODEM

    From deon@21:2/116.1 to Digital Man on Thursday, March 21, 2019 01:14:34
    Hey DM hoping you can help me (or anybody else really).

    I'm writing a ZMODEM implementation in PHP (my C is not as good as PHP), and I'm following this as a validation guide:

    https://stackoverflow.com/questions/9611000/understanding-the-zmodem-protocol

    I'm stuck at validating the CRC of the ZCRCW part after receving a ZFILE
    frame. I cant seem to calculate the same CRC (I was able to validate the CRC
    of the ZFILE frame though). The link above implies that it is a CRC - is that right? If so what is it calculated from? Here is my frame:

    0 : 2a 18 43 04 00 00 00 01 4b 61 a5 44 74 65 73 74 [*.C.....Ka.Dtest]
    10 : 2e 7a 69 70 00 31 31 38 38 31 20 31 33 33 31 32 [.zip.11881 13312]
    20 : 31 30 32 36 30 37 20 31 30 30 36 34 34 20 30 20 [102607 100644 0 ]
    30 : 32 20 31 31 38 38 31 00 18 6b ce 96 84 82 11 [2 11881..k.....]

    IE: I the CRC of the ZCRCW is 0x828496ce but what is used to create it?

    (I can validate the CRC of the ZBIN32 frame as 0x44a5614b.)

    (I know I probably shouldnt bother with TCP transfer, but I thought I would validate it for completeness.)

    Hoping you can help?

    ...deon

    _--_|\ | Deon George
    / \ | Chinwag BBS - A BBS on a PI in Docker!
    \_.__.*/ |
    V | Coming from the 'burbs of Melbourne, Australia

    --- Mystic BBS v1.12 A42 2018/12/27 (Raspberry Pi/32)
    * Origin: Chinwag | MysticBBS in Docker on a Pi! (21:2/116.1)
  • From Digital Man to deon on Wednesday, March 20, 2019 23:35:49
    Re: ZMODEM
    By: deon to Digital Man on Thu Mar 21 2019 01:14 am

    Hey DM hoping you can help me (or anybody else really).

    I'm writing a ZMODEM implementation in PHP (my C is not as good as PHP), and I'm following this as a validation guide:

    https://stackoverflow.com/questions/9611000/understanding-the-zmodem-protoco l

    I'm stuck at validating the CRC of the ZCRCW part after receving a ZFILE frame. I cant seem to calculate the same CRC (I was able to validate the CRC of the ZFILE frame though). The link above implies that it is a CRC - is that right? If so what is it calculated from? Here is my frame:

    0 : 2a 18 43 04 00 00 00 01 4b 61 a5 44 74 65 73 74 [*.C.....Ka.Dtest]
    10 : 2e 7a 69 70 00 31 31 38 38 31 20 31 33 33 31 32 [.zip.11881 13312]
    20 : 31 30 32 36 30 37 20 31 30 30 36 34 34 20 30 20 [102607 100644 0 ]
    30 : 32 20 31 31 38 38 31 00 18 6b ce 96 84 82 11 [2 11881..k.....]

    IE: I the CRC of the ZCRCW is 0x828496ce but what is used to create it?

    (I can validate the CRC of the ZBIN32 frame as 0x44a5614b.)

    (I know I probably shouldnt bother with TCP transfer, but I thought I would validate it for completeness.)

    Hoping you can help?

    The biggest help I can offer is probably this version of the ZMODEM spec: http://wiki.synchro.net/ref:zmodem

    I don't have every aspect of ZMODEM memorized, so I'd have to re-read it and refer to some source code to accurately answer your questions. But if you read my version of the spec and still have questions, let me know and I'll see what I can do to clarify things.

    digital man

    Synchronet/BBS Terminology Definition #21:
    DOVE = Domain/Vertrauen
    Norco, CA WX: 49.1°F, 92.0% humidity, 0 mph SW wind, 0.65 inches rain/24hrs
  • From deon@21:2/116.1 to Digital Man on Thursday, March 21, 2019 10:04:31
    On 20 Mar 2019, Digital Man said the following...
    I don't have every aspect of ZMODEM memorized, so I'd have to re-read it and refer to some source code to accurately answer your questions. But
    if you read my version of the spec and still have questions, let me know and I'll see what I can do to clarify things.

    I did see your version of the spec which prompted me to send a message. I
    also looked at your source code in Synchronet but it didnt help me :( In fact it looks like you arent validating that CRC (if it is a CRC) - I was hoping I missed though...

    The zmodem code is so hard to read (I've even looked through lrzsz and
    mystic's github source) and its a little complicated to trace.

    If it comes to mind, I'd appreciate the help - but I'll keep digging though...

    Thanks...
    ...deon

    _--_|\ | Deon George
    / \ | Chinwag BBS - A BBS on a PI in Docker!
    \_.__.*/ |
    V | Coming from the 'burbs of Melbourne, Australia

    --- Mystic BBS v1.12 A42 2018/12/27 (Raspberry Pi/32)
    * Origin: Chinwag | MysticBBS in Docker on a Pi! (21:2/116.1)
  • From tenser@21:1/188 to deon on Thursday, March 21, 2019 09:51:33
    On 21 Mar 2019, deon said the following...

    I'm stuck at validating the CRC of the ZCRCW part after receving a ZFILE frame. I cant seem to calculate the same CRC (I was able to validate the CRC of the ZFILE frame though). The link above implies that it is a CRC
    - is that right? If so what is it calculated from? Here is my frame:

    [snip]

    IE: I the CRC of the ZCRCW is 0x828496ce but what is used to create it?

    That link implies it's a 32-bit CRC. What value are you getting? Are
    you taking into account ZDLE encoding, if applicable?

    --- Mystic BBS v1.12 A42 2018/12/27 (Raspberry Pi/32)
    * Origin: ACiD Underworld // acidunderworld.com:31337 (21:1/188)
  • From Digital Man to deon on Thursday, March 21, 2019 13:55:35
    Re: Re: ZMODEM
    By: deon to Digital Man on Thu Mar 21 2019 10:04 am

    On 20 Mar 2019, Digital Man said the following...
    I don't have every aspect of ZMODEM memorized, so I'd have to re-read it and refer to some source code to accurately answer your questions. But
    if you read my version of the spec and still have questions, let me know and I'll see what I can do to clarify things.

    I did see your version of the spec which prompted me to send a message. I also looked at your source code in Synchronet but it didnt help me :( In fact it looks like you arent validating that CRC (if it is a CRC) - I was hoping I missed though...

    I'm pretty sure all the CRC values are validated.

    The zmodem code is so hard to read (I've even looked through lrzsz and mystic's github source) and its a little complicated to trace.

    Anything derived or inspired by Chuck Forsberg's code (RIP) is especially hard to read. Who thinks in octal these days?!?

    digital man

    Synchronet/BBS Terminology Definition #45:
    MUD = Multi-User Dungeon
    Norco, CA WX: 54.6°F, 80.0% humidity, 1 mph W wind, 0.69 inches rain/24hrs
  • From deon@21:2/116.1 to tenser on Thursday, March 21, 2019 23:34:23
    On 21 Mar 2019, tenser said the following...
    That link implies it's a 32-bit CRC. What value are you getting? Are
    you taking into account ZDLE encoding, if applicable?

    Well, it depends what you use to calculate that CRC. Is it of just the ZCRCW part (filename/sizes/date/batch details) or does it include the ZFILE parts as well (I think the former)? I've tried using the data parts of both frames and just the ZCRCW frame, but I cannot get the same result.

    Since there are decimal numbers, I'm wondering if they need to be converted
    to hex/oct before the CRC routines, and then if endianness comes into play.

    (I know my CRC routine is working, because I can confirm the CRC of the ZFILE frame.)

    ...deon

    _--_|\ | Deon George
    / \ | Chinwag BBS - A BBS on a PI in Docker!
    \_.__.*/ |
    V | Coming from the 'burbs of Melbourne, Australia

    --- Mystic BBS v1.12 A42 2018/12/27 (Raspberry Pi/32)
    * Origin: Chinwag | MysticBBS in Docker on a Pi! (21:2/116.1)
  • From deon@21:2/116.1 to Digital Man on Thursday, March 21, 2019 23:37:17
    On 21 Mar 2019, Digital Man said the following...
    I'm pretty sure all the CRC values are validated.

    Can you point me to where you do that in your code?

    Your wiki link (which is awesome too BTW), doesnt talk about the last 5 bytes of that "ZFILE FRAME FILE INFORMATION SUBPACKET". (which I'm lead to believe
    is the CRC32 + XON).

    ...deon

    _--_|\ | Deon George
    / \ | Chinwag BBS - A BBS on a PI in Docker!
    \_.__.*/ |
    V | Coming from the 'burbs of Melbourne, Australia

    --- Mystic BBS v1.12 A42 2018/12/27 (Raspberry Pi/32)
    * Origin: Chinwag | MysticBBS in Docker on a Pi! (21:2/116.1)
  • From Digital Man to deon on Thursday, March 21, 2019 17:16:15
    Re: Re: ZMODEM
    By: deon to Digital Man on Thu Mar 21 2019 11:37 pm

    On 21 Mar 2019, Digital Man said the following...
    I'm pretty sure all the CRC values are validated.

    Can you point me to where you do that in your code?

    The functions zmodem_recv_bin16_header(), zmodem_recv_bin32_header() and zmodem_recv_hex_header() of zmodem.c verify the CRC of every received ZMODEM frame header. The type of CRC (16 vs. 32-bit) and encoding (binary vs. hex) of the CRC depend on the header style (ZBIN, ZBIN32, or ZHEX).

    The functions zmodem_recv_data16() and zmodem_recv_data32() of zmodem.c verify the CRC of every received ZMODEM data subpacket.

    Your wiki link (which is awesome too BTW), doesnt talk about the last 5 bytes of that "ZFILE FRAME FILE INFORMATION SUBPACKET". (which I'm lead to believe
    is the CRC32 + XON).

    It would only be a CRC32 (a 32-bit CRC) if the frame header style was
    ZBIN32. Otherwise, it'd be a 16-bit CRC, either hex or binary encoded, depending again on the frame header style.

    digital man

    Synchronet "Real Fact" #78:
    Synchronet Match Maker had at one time over 4000 profiles of men and women. Norco, CA WX: 56.0°F, 69.0% humidity, 6 mph E wind, 0.38 inches rain/24hrs