]> www.wagner.pp.ru Git - openssl-gost/engine.git/blob - obj_create.c
Added system to create new NIDs on demand
[openssl-gost/engine.git] / obj_create.c
1 #include "gost_lcl.h"
2 #include <openssl/objects.h>
3 #include <string.h>
4
5 int gost_add_obj(const char *oid, const char *sn, const char *ln)
6 {
7         int nid;
8         char *oidtemp=NULL,*sntemp=NULL,*lntemp=NULL;
9         
10         if (oid) {
11                 nid = OBJ_txt2nid(oid);
12         } else {
13                 nid = OBJ_txt2nid(sn);
14         }
15         if (nid != NID_undef) {
16                 return nid;
17         }
18         if (oid) {
19                 oidtemp=OPENSSL_malloc(strlen(oid) + 2);
20                 strcpy(oidtemp, oid);
21         }
22
23         if (sn) {
24                 sntemp=OPENSSL_malloc(strlen(sn) + 2);
25                 strcpy(sntemp, sn);
26         }
27
28         if (ln) {
29                 lntemp=OPENSSL_malloc(strlen(ln) + 2);
30                 strcpy(lntemp, ln);
31         }
32         return OBJ_create(oid,sn,ln);
33 }
34