p += a->length;
int i2d_ASN1_INTEGER(ASN1_INTEGER *a, unsigned char **pp)	{	int pad=0,ret,r,i,t;	unsigned char *p,*n,pb=0;	if ((a == NULL) || (a->data == NULL)) return(0);	t=a->type;	if (a->length == 0)		ret=1;	else		{		ret=a->length;		i=a->data[0];		if ((t == V_ASN1_INTEGER) && (i > 127)) {			pad=1;			pb=0;		} else if(t == V_ASN1_NEG_INTEGER) {			if(i>128) {				pad=1;				pb=0xFF;			} else if(i == 128) {			/*			 * Special case: if any other bytes non zero we pad:			 * otherwise we don't.			 */				for(i = 1; i < a->length; i++) if(a->data[i]) {						pad=1;						pb=0xFF;						break;				}			}		}		ret+=pad;		}	r=ASN1_object_size(0,ret,V_ASN1_INTEGER);	if (pp == NULL) return(r);	p= *pp;	ASN1_put_object(&p,0,ret,V_ASN1_INTEGER,V_ASN1_UNIVERSAL);	if (pad) *(p++)=pb;	if (a->length == 0)		*(p++)=0;	else if (t == V_ASN1_INTEGER)		{		memcpy(p,a->data,(unsigned int)a->length);		p+=a->length;		}	else {		/* Begin at the end of the encoding */		n=a->data + a->length - 1;		p += a->length - 1;		i = a->length;		/* Copy zeros to destination as long as source is zero */		while(!*n) {			*(p--) = 0;			n--;			i--;		}		/* Complement and increment next octet */		*(p--) = ((*(n--)) ^ 0xff) + 1;		i--;		/* Complement any octets left */		for(;i > 0; i--) *(p--) = *(n--) ^ 0xff;		p += a->length;	}	*pp=p;	return(r);	}