413
414
/* Work out size of content octets */
414
415
i=a2d_ASN1_OBJECT(NULL,0,s,-1);
416
/* Clear the error */
417
/* Don't clear the error */
418
/*ERR_clear_error();*/
420
421
/* Work out total size */
437
438
int OBJ_obj2txt(char *buf, int buf_len, const ASN1_OBJECT *a, int no_name)
439
int i,idx=0,n=0,len,nid;
440
int i,n=0,len,nid, first, use_bn;
441
443
unsigned char *p;
443
444
char tbuf[DECIMAL_SIZE(i)+DECIMAL_SIZE(l)+2];
445
if (buf_len <= 0) return(0);
447
446
if ((a == NULL) || (a->data == NULL)) {
452
if (no_name || (nid=OBJ_obj2nid(a)) == NID_undef) {
458
while (idx < a->length) {
460
if (!(p[idx] & 0x80)) break;
469
BIO_snprintf(tbuf,sizeof tbuf,"%d.%lu",i,l);
471
BUF_strlcpy(buf,tbuf,buf_len);
477
for (; idx<len; idx++) {
479
if (!(p[idx] & 0x80)) {
480
BIO_snprintf(tbuf,sizeof tbuf,".%lu",l);
483
BUF_strlcpy(buf,tbuf,buf_len);
452
if (!no_name && (nid=OBJ_obj2nid(a)) != NID_undef)
492
455
s=OBJ_nid2ln(nid);
494
457
s=OBJ_nid2sn(nid);
495
BUF_strlcpy(buf,s,buf_len);
459
BUF_strlcpy(buf,s,buf_len);
477
unsigned char c = *p++;
479
if ((len == 0) && (c & 0x80))
483
if (!BN_add_word(bl, c & 0x7f))
490
if (!use_bn && (l > (ULONG_MAX >> 7L)))
492
if (!bl && !(bl = BN_new()))
494
if (!BN_set_word(bl, l))
500
if (!BN_lshift(bl, bl, 7))
515
if (!BN_sub_word(bl, 80))
526
if (buf && (buf_len > 0))
537
bndec = BN_bn2dec(bl);
548
BUF_strlcpy(buf,bndec,buf_len);
566
BIO_snprintf(tbuf,sizeof tbuf,".%lu",l);
568
if (buf && (buf_len > 0))
570
BUF_strlcpy(buf,tbuf,buf_len);
501
597
int OBJ_txt2nid(const char *s)