IETF-SSH archive

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

Re: uint64



"Joseph Galbraith" <galb-list%vandyke.com@localhost> writes:

> I think mpint would be a mistake.
> 
> This would be a new requirement for the sftp subsystem,
> which currently does not require a bignum library to
> implement.

You don't need a full bignum library just because you use the mpint
representation.

I'm imagining a decoding function that's somthing like

  off_t get_offset(input_buffer *b)
  {
    uint32_t length = get_uint32(b);
    uint32_t i;
    off_t offset;

    if (length > sizeof(off_t))
      /* Fail, preferably in some more graceful way */
      fatal();

    for (offset = 0, i = 0; i<length; i++)
      offset = (offset << 8) | get_uint8(i);
  
    return offset;
  }

Ok, I know that code is not quite correct (it would be if we had
mpuint rather than mpint), but I hope you get the idea.

With uint64, it seems I need explicit #ifdefs in order to handle
systems with different sizes of off_t.

So I believe that deleting uint64 would make the spec cleaner, and
without adding extra complexity to the implementation.

/Niels



Home | Main Index | Thread Index | Old Index