SORT BY:

LIST ORDER
THREAD
AUTHOR
SUBJECT


SEARCH

IPS HOME


    [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

    Re: iSCSI: 12-97 Bit Rule



    Julian Satran wrote:
    > 
    > I took out completely the bit rule.
    > I reformulated the CRC text as:
    >
    > The CRC MUST be calculated by a method that produces the same results as the following process:
    > 
    >  - The PDU bits are considered as the coefficients of a polyno-mial M(x) of degree n-1; bit 7 of
    > the lowest numbered byte is considered the most significant bit (x^n-1), followed by bit 6 of the
    > lowest numbered byte and through bit 0 of the high-est numbered byte (x^0).
    
    This description, taken by itself, as you quote it here,
    mentions bit 7 of a byte. Normally, bit 7 of a byte is
    the Most Significant bit (MSb).
    
    But somewhere you MUST mention that bit 7 is, contrary to all
    intuition, the LSb, NOT, as many of us would assume, the MSb.
    (I.e. the _bit_ ordering as per the PDU template doesn't
    imply bit significance, or does it?)
    
    I.e. you need to mention that the bytes are mirrored.
    
    Here it is, again:
    
    1) The bytes of the message form a bit stream, ordered
       Most Significant Byte (MSB), Most Significant bit (MSb)
       in memory, i.e. Big endian on bytes, Big endian on bits.
       Call this bit stream P.
    
    2) The bytes of P are mirrored, thus forming byte 0, LSb
       first to MSb, then byte 1, LSb first to MSb, etc,
       (Big endian on Bytes, Little endian on bits), this forms the
       bit sequence A = {a_0, a_1, ..., a_(n-1)}.
    
    3) The first 32 bits of A are complemented (a_0 to a_31).
    
    4) The bits of A are considered coefficients of M(x),
       where M(x) = a_0 x^(n-1) + ... + a_(n-1) x^0.
    
    5) The polynomial M(x) is multiplied by x^32, then divided by G(x),
       where G(x) is the polynomial representation of 0x11edc6f41.
       This produces a remainder R(x) of degree <= 31.
    
    6) The coefficients of R(x) are considered a 32 bit sequence,
       R(x) = r_31 x^31 + ... + r_0 x^0.
    
    7) R(x) is complemented and mirrored, the result is CRC(x).
    
    8) The message sent is P and appended at the end are the
       bit coefficients of CRC(x), with x^31 bit coefficient
       first, then x^30, etc.
    
    9) A receiver of a "good" message sent as per step (8),
       will get the value 0x1c2d19ed as R(x) (steps (1) to (6)).
    
    Note that CRC(x) is a polynomial and independent of
    the machine's representation.
    
    For clarity, I've omitted the fact that x^0 = 1.
    
    So, steps 1 to 6 form ``R(x) = compute_crc(P)'',
    and steps 7 to 8 form ``Send_This = inject_crc(P, R(x))''.
    
    I.e. ``Magic_Value = compute_crc(inject_crc(P, compute_crc(P)))''
    
    Thus, one sends ``inject_crc(P, compute_crc(P))'',
    and the receiver does ``Magic_Value =?= compute_crc(message_received)'',
    which is step 9.
    
    -- 
    Luben
    


Home

Last updated: Thu Jun 13 18:18:47 2002
10772 messages in chronological order