diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/libcrypto/objects/obj_dat.c | 84 |
1 files changed, 42 insertions, 42 deletions
diff --git a/src/lib/libcrypto/objects/obj_dat.c b/src/lib/libcrypto/objects/obj_dat.c index 5a2c34278e..a70f4cf5b4 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.69 2023/12/14 14:33:23 tb Exp $ */ | 1 | /* $OpenBSD: obj_dat.c,v 1.70 2023/12/14 14:45:45 tb 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 | * |
| @@ -374,47 +374,6 @@ OBJ_obj2nid(const ASN1_OBJECT *aobj) | |||
| 374 | } | 374 | } |
| 375 | LCRYPTO_ALIAS(OBJ_obj2nid); | 375 | LCRYPTO_ALIAS(OBJ_obj2nid); |
| 376 | 376 | ||
| 377 | /* Convert an object name into an ASN1_OBJECT | ||
| 378 | * if "noname" is not set then search for short and long names first. | ||
| 379 | * This will convert the "dotted" form into an object: unlike OBJ_txt2nid | ||
| 380 | * it can be used with any objects, not just registered ones. | ||
| 381 | */ | ||
| 382 | |||
| 383 | ASN1_OBJECT * | ||
| 384 | OBJ_txt2obj(const char *s, int no_name) | ||
| 385 | { | ||
| 386 | int nid; | ||
| 387 | |||
| 388 | if (!no_name) { | ||
| 389 | if ((nid = OBJ_sn2nid(s)) != NID_undef || | ||
| 390 | (nid = OBJ_ln2nid(s)) != NID_undef) | ||
| 391 | return OBJ_nid2obj(nid); | ||
| 392 | } | ||
| 393 | |||
| 394 | return t2i_ASN1_OBJECT_internal(s); | ||
| 395 | } | ||
| 396 | LCRYPTO_ALIAS(OBJ_txt2obj); | ||
| 397 | |||
| 398 | int | ||
| 399 | OBJ_obj2txt(char *buf, int buf_len, const ASN1_OBJECT *aobj, int no_name) | ||
| 400 | { | ||
| 401 | return i2t_ASN1_OBJECT_internal(aobj, buf, buf_len, no_name); | ||
| 402 | } | ||
| 403 | LCRYPTO_ALIAS(OBJ_obj2txt); | ||
| 404 | |||
| 405 | int | ||
| 406 | OBJ_txt2nid(const char *s) | ||
| 407 | { | ||
| 408 | ASN1_OBJECT *obj; | ||
| 409 | int nid; | ||
| 410 | |||
| 411 | obj = OBJ_txt2obj(s, 0); | ||
| 412 | nid = OBJ_obj2nid(obj); | ||
| 413 | ASN1_OBJECT_free(obj); | ||
| 414 | return nid; | ||
| 415 | } | ||
| 416 | LCRYPTO_ALIAS(OBJ_txt2nid); | ||
| 417 | |||
| 418 | static int | 377 | static int |
| 419 | ln_objs_cmp(const void *ln, const void *b) | 378 | ln_objs_cmp(const void *ln, const void *b) |
| 420 | { | 379 | { |
| @@ -530,6 +489,47 @@ OBJ_bsearch_ex_(const void *key, const void *base_, int num, int size, | |||
| 530 | return (p); | 489 | return (p); |
| 531 | } | 490 | } |
| 532 | 491 | ||
| 492 | /* Convert an object name into an ASN1_OBJECT | ||
| 493 | * if "noname" is not set then search for short and long names first. | ||
| 494 | * This will convert the "dotted" form into an object: unlike OBJ_txt2nid | ||
| 495 | * it can be used with any objects, not just registered ones. | ||
| 496 | */ | ||
| 497 | |||
| 498 | ASN1_OBJECT * | ||
| 499 | OBJ_txt2obj(const char *s, int no_name) | ||
| 500 | { | ||
| 501 | int nid; | ||
| 502 | |||
| 503 | if (!no_name) { | ||
| 504 | if ((nid = OBJ_sn2nid(s)) != NID_undef || | ||
| 505 | (nid = OBJ_ln2nid(s)) != NID_undef) | ||
| 506 | return OBJ_nid2obj(nid); | ||
| 507 | } | ||
| 508 | |||
| 509 | return t2i_ASN1_OBJECT_internal(s); | ||
| 510 | } | ||
| 511 | LCRYPTO_ALIAS(OBJ_txt2obj); | ||
| 512 | |||
| 513 | int | ||
| 514 | OBJ_obj2txt(char *buf, int buf_len, const ASN1_OBJECT *aobj, int no_name) | ||
| 515 | { | ||
| 516 | return i2t_ASN1_OBJECT_internal(aobj, buf, buf_len, no_name); | ||
| 517 | } | ||
| 518 | LCRYPTO_ALIAS(OBJ_obj2txt); | ||
| 519 | |||
| 520 | int | ||
| 521 | OBJ_txt2nid(const char *s) | ||
| 522 | { | ||
| 523 | ASN1_OBJECT *obj; | ||
| 524 | int nid; | ||
| 525 | |||
| 526 | obj = OBJ_txt2obj(s, 0); | ||
| 527 | nid = OBJ_obj2nid(obj); | ||
| 528 | ASN1_OBJECT_free(obj); | ||
| 529 | return nid; | ||
| 530 | } | ||
| 531 | LCRYPTO_ALIAS(OBJ_txt2nid); | ||
| 532 | |||
| 533 | int | 533 | int |
| 534 | OBJ_create_objects(BIO *in) | 534 | OBJ_create_objects(BIO *in) |
| 535 | { | 535 | { |
