summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/objects/obj_dat.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/objects/obj_dat.c')
-rw-r--r--src/lib/libcrypto/objects/obj_dat.c33
1 files changed, 3 insertions, 30 deletions
diff --git a/src/lib/libcrypto/objects/obj_dat.c b/src/lib/libcrypto/objects/obj_dat.c
index 786bed6c7a..bcb7ee2dbb 100644
--- a/src/lib/libcrypto/objects/obj_dat.c
+++ b/src/lib/libcrypto/objects/obj_dat.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: obj_dat.c,v 1.48 2022/03/02 11:28:00 jsing Exp $ */ 1/* $OpenBSD: obj_dat.c,v 1.49 2022/03/19 17:49:32 jsing Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -485,12 +485,7 @@ OBJ_obj2nid(const ASN1_OBJECT *a)
485ASN1_OBJECT * 485ASN1_OBJECT *
486OBJ_txt2obj(const char *s, int no_name) 486OBJ_txt2obj(const char *s, int no_name)
487{ 487{
488 int nid = NID_undef; 488 int nid;
489 ASN1_OBJECT *op = NULL;
490 unsigned char *buf;
491 unsigned char *p;
492 const unsigned char *cp;
493 int i, j;
494 489
495 if (!no_name) { 490 if (!no_name) {
496 if (((nid = OBJ_sn2nid(s)) != NID_undef) || 491 if (((nid = OBJ_sn2nid(s)) != NID_undef) ||
@@ -498,29 +493,7 @@ OBJ_txt2obj(const char *s, int no_name)
498 return OBJ_nid2obj(nid); 493 return OBJ_nid2obj(nid);
499 } 494 }
500 495
501 /* Work out size of content octets */ 496 return t2i_ASN1_OBJECT_internal(s);
502 i = a2d_ASN1_OBJECT(NULL, 0, s, -1);
503 if (i <= 0) {
504 /* Don't clear the error */
505 /*ERR_clear_error();*/
506 return NULL;
507 }
508 /* Work out total size */
509 j = ASN1_object_size(0, i, V_ASN1_OBJECT);
510
511 if ((buf = malloc(j)) == NULL)
512 return NULL;
513
514 p = buf;
515 /* Write out tag+length */
516 ASN1_put_object(&p, 0, i, V_ASN1_OBJECT, V_ASN1_UNIVERSAL);
517 /* Write out contents */
518 a2d_ASN1_OBJECT(p, i, s, -1);
519
520 cp = buf;
521 op = d2i_ASN1_OBJECT(NULL, &cp, j);
522 free(buf);
523 return op;
524} 497}
525 498
526int 499int