However, still I don't see any reason why this function increments its second argument ? And why to the first byte after the DER-encoded INTEGER (it's out of preallocated memory) ?

The usual reason for building library routines that bump an output pointer is to be able to use them in a chained fashion to build a composite output object:

char thingbuffer[256], *cp = thingbuffer;
...
   makeafoo(stuff,&cp);
   makeabar(other,&cp);
   {
      char *bp = baz;      /* pointer to a null-terminated baz */
      while ( *cp++ = *bp++ );
   }
   makeabletch(params,&cp);
   *cp = 0;                   /* null terminate it OR */
   len = cp - thingbuffer;    /* compute length made  */

If the make routines bump their second argument, it all
strings out nicely in memory.  Compare this to:

char thingbuffer[256], *cp = thingbuffer;
int len;
...
   makeafoo(stuff,cp);         /* fixed length item */
   cp += sizeof(foo);
   len = makeabar(other,cp);   /* variable length item */
   cp += len;
...
   makeabletch(params,cp);
   cp += computelengthofbletchat(cp);

The only real negative is remembering to put in the ampersand,
(I guess "references" removes even this, but am I correct in
remembering that "references" are really C++ and one should
not count on them being in plain vanilla C?  Or did references
get added to C in the ANSI standardization process???)

--
Charles B (Ben) Cranston
mailto: [EMAIL PROTECTED]
http://www.wam.umd.edu/~zben

______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to