]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
updated file structure
authorNikos Mavrogiannopoulos <nmav@gnutls.org>
Fri, 20 Jul 2001 18:59:24 +0000 (18:59 +0000)
committerNikos Mavrogiannopoulos <nmav@gnutls.org>
Fri, 20 Jul 2001 18:59:24 +0000 (18:59 +0000)
15 files changed:
configure.in
lib/Makefile.am
lib/cert_asn1.c
lib/cert_asn1.h
lib/gnutls.h.in
lib/gnutls_global.c
lib/pkcs1.asn [new file with mode: 0644]
lib/pkcs1_asn1_tab.c
lib/pkix.asn [moved from src/pkix.asn with 100% similarity]
src/Makefile.am
src/asn1c.c [moved from src/PkixTabExample.c with 90% similarity]
src/cli.c
src/serv.c
src/srp/Makefile.am [new file with mode: 0644]
src/x509/Makefile.am [new file with mode: 0644]

index fbefe534dfd40e91687c80622e9650580d43a3d2..c7fbfe86ae8a991047bea0ab2bba1e39df7ce8f6 100644 (file)
@@ -153,5 +153,6 @@ AC_CONFIG_COMMANDS([default],[[
  chmod +x lib/libgnutls-config
 ]],[[]])
 
-AC_CONFIG_FILES([Makefile src/Makefile lib/Makefile lib/libgnutls-config lib/gnutls.h doc/Makefile])
+AC_CONFIG_FILES([Makefile src/Makefile lib/Makefile lib/libgnutls-config \
+lib/gnutls.h doc/Makefile src/x509/Makefile src/srp/Makefile ])
 AC_OUTPUT
index bea7d8fee2615ac7f47b3b3c6021c6c89a2a8f06..489eb01c6f428d39c8185f7d83b814ee91cd301c 100644 (file)
@@ -4,7 +4,7 @@ bin_SCRIPTS = libgnutls-config
 m4datadir = $(datadir)/aclocal
 m4data_DATA = libgnutls.m4
 
-EXTRA_DIST = debug.h gnutls_compress.h defines.h \
+EXTRA_DIST = debug.h gnutls_compress.h defines.h pkcs1.asn pkix.asn \
        gnutls_cipher.h gnutls_buffers.h gnutls_errors.h gnutls_int.h \
        gnutls_handshake.h gnutls_num.h gnutls_algorithms.h gnutls_dh.h \
        gnutls_kx.h gnutls_hash_int.h gnutls_cipher_int.h gnutls_db.h \
@@ -29,6 +29,12 @@ libgnutls_la_SOURCES = gnutls_record.c gnutls_compress.c debug.c \
        cert_ASN.y cert_asn1.c cert_der.c gnutls_datum.c auth_rsa.c \
        gnutls_gcry.c ext_dnsname.c gnutls_pk.c gnutls_cert.c cert_verify.c\
        gnutls_global.c gnutls_privkey.c gnutls_constate.c gnutls_anon_cred.c \
-       gnutls_sig_check.c
+       gnutls_sig_check.c  pkix_asn1_tab.c pkcs1_asn1_tab.c
 libgnutls_la_LDFLAGS = -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE)
 
+pkix_asn1_tab.c: pkix.asn
+       ../src/asn1c pkix.asn pkix_asn1_tab.c
+
+pkcs1_asn1_tab.c: pkcs1.asn
+       ../src/asn1c pkcs1.asn pkcs1_asn1_tab.c
+
index e0569b964045cdd6c64b0bcf5cb3559974c5f444..1bd5a972af178575ae998b0003cc549cd30d71f4 100755 (executable)
@@ -371,7 +371,7 @@ asn1_create_tree(static_asn *root,node_asn **pointer)
 
 
 int
-_asn1_create_static_structure(node_asn *pointer,char *file_name)
+_asn1_create_static_structure(node_asn *pointer,char *file_name, char* out_name)
 {
   FILE *file;  
   node_asn *p;
@@ -397,11 +397,14 @@ _asn1_create_static_structure(node_asn *pointer,char *file_name)
   structure_name[dot_p-slash_p]=0;
   strcat(structure_name,"_asn1_tab");
 
-  memcpy(file_out_name,file_name,dot_p-file_name);
-  file_out_name[dot_p-file_name]=0;
-  strcat(file_out_name,"_asn1_tab.c");
-
-  file=fopen(file_out_name,"w");
+  if (out_name==NULL) {
+         memcpy(file_out_name,file_name,dot_p-file_name);
+         file_out_name[dot_p-file_name]=0;
+         strcat(file_out_name,"_asn1_tab.c");
+  } else {
+         strncpy( file_out_name, out_name, sizeof(file_out_name));
+  }
+  file=fopen( file_out_name,"w");
 
   if(file==NULL) return ASN_FILE_NOT_FOUND;
 
index 7e963b9e3b9c7ec41357b0af99e2a3fedc5adca5..0011b7af5d7074951b6ae043a64bdf95e690431c 100755 (executable)
@@ -174,6 +174,8 @@ asn1_write_value(node_asn *root,char *name,unsigned char *value,int len);
 int 
 asn1_read_value(node_asn *root,char *name,unsigned char *value,int *len);
 
+int
+asn1_create_tree(static_asn *root,node_asn **pointer);
 
 #endif
 
index 63500c969852455a9432d8d73de347346c4a467b..17938fcd01044249a55361e885940a0f30f40e41 100644 (file)
@@ -226,7 +226,7 @@ int gnutls_set_x509_trust( X509PKI_CREDENTIALS res, char* CAFILE, char* CRLFILE)
  * This will not be the case in the final version. These files 
  * are located in the src/ directory of gnutls distribution.
  */
-int gnutls_global_init(char* PKIX, char* PKCS1);
+int gnutls_global_init();
 void gnutls_global_deinit();
 
 
index 51b81a88c9500ef8f23c041bc4380b64ec950fe1..723bece6f98e554d70e53be13ab3480258f11f17 100644 (file)
 # include <signal.h>
 #endif
 
+/* created by asn1c */
+extern const static_asn pkcs1_asn1_tab[];
+extern const static_asn pkix_asn1_tab[];
+
 static void* old_sig_handler;
 ssize_t (*recv_func)( SOCKET, void*, size_t, int);
 ssize_t (*send_func)( SOCKET,const void*, size_t, int);
@@ -52,7 +56,7 @@ int gnutls_is_secure_memory(const void* mem) {
   * You must call gnutls_global_deinit() when gnutls usage is no longer needed
   * Returns zero on success.
   **/
-int gnutls_global_init(char* PKIX, char* PKCS1)
+int gnutls_global_init()
 {
        int result;
 
@@ -74,15 +78,16 @@ int gnutls_global_init(char* PKIX, char* PKCS1)
         * version.
         */
        
-       result = asn1_parser_asn1(PKIX, &PKIX1_ASN);
-
+//     result=asn1_create_tree( (void*)pkix_asn1_tab, &PKIX1_ASN);
+       result=asn1_parser_asn1( "/home/nmav/cvs/gnutls/lib/pkix.asn", &PKIX1_ASN);
        if (result != ASN_OK) {
                return GNUTLS_E_ASN1_PARSING_ERROR;
        }
-       
-       result = asn1_parser_asn1(PKCS1, &PKCS1_ASN);
 
+//     result=asn1_create_tree( (void*)pkcs1_asn1_tab, &PKCS1_ASN);
+       result=asn1_parser_asn1( "/home/nmav/cvs/gnutls/lib/pkcs1.asn" , &PKCS1_ASN);
        if (result != ASN_OK) {
+               asn1_delete_structure( PKIX1_ASN);
                return GNUTLS_E_PARSING_ERROR;
        }
        
diff --git a/lib/pkcs1.asn b/lib/pkcs1.asn
new file mode 100644 (file)
index 0000000..d04daca
--- /dev/null
@@ -0,0 +1,64 @@
+PKCS-1 {iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs-1(1)  modules(0) pkcs-1(1)}
+
+DEFINITIONS EXPLICIT TAGS ::=
+
+BEGIN
+
+
+-- Main structures
+
+RSAPublicKey ::= SEQUENCE {
+        modulus                 INTEGER, -- n
+        publicExponent          INTEGER  -- e 
+}
+
+-- 
+-- Representation of RSA private key with information for the 
+-- CRT algorithm.
+--
+RSAPrivateKey ::= SEQUENCE {
+        version                Version,
+        modulus                INTEGER, -- (Usually large) n
+        publicExponent         INTEGER, -- (Usually small) e
+        privateExponent        INTEGER, -- (Usually large) d
+        prime1                 INTEGER, -- (Usually large) p
+       prime2                  INTEGER, -- (Usually large) q
+       exponent1               INTEGER, -- (Usually large) d mod (p-1)
+       exponent2               INTEGER, -- (Usually large) d mod (q-1)
+       coefficient             INTEGER, -- (Usually large) (inverse of q) mod p
+       otherPrimeInfos         OtherPrimeInfos OPTIONAL
+}
+
+Version ::= INTEGER { two-prime(0), multi(1) }
+--     (CONSTRAINED BY {-- version must be multi if otherPrimeInfos present --})
+
+OtherPrimeInfos ::= SEQUENCE SIZE(1..MAX) OF OtherPrimeInfo
+
+OtherPrimeInfo ::= SEQUENCE {
+       prime INTEGER,  -- ri
+       exponent INTEGER, -- di
+       coefficient INTEGER -- ti 
+}
+
+-- for signature calculation
+-- added by nmav
+
+AlgorithmIdentifier ::= SEQUENCE  {
+     algorithm               OBJECT IDENTIFIER,
+     parameters              ANY DEFINED BY algorithm OPTIONAL  
+}
+                                -- contains a value of the type
+                                -- registered for use with the
+                                -- algorithm object identifier value
+
+DigestInfo ::= SEQUENCE {
+     digestAlgorithm DigestAlgorithmIdentifier,
+     digest Digest 
+}
+
+DigestAlgorithmIdentifier ::= AlgorithmIdentifier
+
+Digest ::= OCTET STRING
+
+
+END
\ No newline at end of file
index ae5db3a57f2ededc67bdd1e6b0fdecdf2a78b398..2fe359872d81b74e18ea470fab16364104fd81e6 100644 (file)
@@ -32,9 +32,18 @@ const static_asn pkcs1_asn1_tab[]={
   {"OtherPrimeInfos",1612709899,0},
   {"MAX",1074266122,"1"},
   {0,2,"OtherPrimeInfo"},
-  {"OtherPrimeInfo",536870917,0},
+  {"OtherPrimeInfo",1610612741,0},
   {"prime",1073741827,0},
   {"exponent",1073741827,0},
   {"coefficient",3,0},
+  {"AlgorithmIdentifier",1610612741,0},
+  {"algorithm",1073741836,0},
+  {"parameters",541081613,0},
+  {"algorithm",1,0},
+  {"DigestInfo",1610612741,0},
+  {"digestAlgorithm",1073741826,"DigestAlgorithmIdentifier"},
+  {"digest",2,"Digest"},
+  {"DigestAlgorithmIdentifier",1073741826,"AlgorithmIdentifier"},
+  {"Digest",7,0},
   {0,0,0}
 };
similarity index 100%
rename from src/pkix.asn
rename to lib/pkix.asn
index 930d44c6c4828acd05bb7f87451715dd76e8dae4..da384da816ffd3e27962a4036305d9f48f3bade7 100644 (file)
@@ -1,10 +1,10 @@
 EXTRA_DIST = port.h prime.gaa crypt.gaa crypt-gaa.h README.crypt prime-gaa.h \
-               README tpasswd tpasswd.conf pkcs1.asn pkix.asn cert.pem \
-               key.pem ca.pem
+               README 
+SUBDIRS = srp x509
 
 INCLUDES = -I../lib
 
-noinst_PROGRAMS = serv cli crypt prime CertificateExample
+noinst_PROGRAMS = serv cli crypt prime asn1c CertificateExample
 serv_SOURCES = serv.c
 serv_LDADD = ../lib/libgnutls.la $(LIBGCRYPT_LIBS)
 crypt_SOURCES = crypt-gaa.c crypt.c
@@ -14,9 +14,11 @@ prime_LDADD = ../lib/libgnutls.la $(LIBGCRYPT_LIBS)
 cli_SOURCES = cli.c
 cli_LDADD = ../lib/libgnutls.la $(LIBGCRYPT_LIBS)
 
-CertificateExample_SOURCES = CertificateExample.c
+CertificateExample_SOURCES = CertificateExample.c  
 CertificateExample_LDADD = ../lib/libgnutls.la $(LIBGCRYPT_LIBS)
 
+asn1c_SOURCES = asn1c.c
+asn1c_LDADD = ../lib/libgnutls.la $(LIBGCRYPT_LIBS)
 
 crypt-gaa.c: crypt.gaa
        gaa crypt.gaa -o crypt-gaa.c -i crypt-gaa.h
similarity index 90%
rename from src/PkixTabExample.c
rename to src/asn1c.c
index 8100f3c6d6d23159826664abc45084dd5465966d..547332a87187575f9daccd3e4e762ca226036c4c 100644 (file)
@@ -34,14 +34,14 @@ int
 main(int argc,char *argv[])
 {
   int result;
-  char file_name[128];
-
-  if(argc==2) strcpy(file_name,argv[1]);
-  else file_name[0]=0;
-
-  strcat(file_name,"pkix.asn");
-
-  result=asn1_parser_asn1_file_c(file_name);
+  FILE* tmp;
+  
+  if(argc!=3) {
+       fprintf(stderr, "Usage: %s: input.asn output.c\n", argv[0]);
+       exit(1);
+  }
+  result=asn1_parser_asn1_file_c( argv[1], argv[2]);
 
   if(result==ASN_SYNTAX_ERROR){
     printf("PARSE ERROR\n");
index cd05b825c4426782621a75416b0fc228aa04679d..e57a541d8ca30ae82e404c2820bede6c96dacf08 100644 (file)
--- a/src/cli.c
+++ b/src/cli.c
@@ -133,7 +133,7 @@ int main(int argc, char** argv)
                exit(1);
        }
        
-       if (gnutls_global_init("pkix.asn", "pkcs1.asn") < 0) {
+       if (gnutls_global_init() < 0) {
                fprintf(stderr, "global state initialization error\n");
                exit(1);
        }
index d648e47e3f99004434e3473e60af1c2f162b4279..772023725aa32e1ffcdd36afc449ff4e4db70184 100644 (file)
@@ -293,7 +293,7 @@ int main(int argc, char **argv)
                }
        }
        
-       if (gnutls_global_init("pkix.asn", "pkcs1.asn") < 0) {
+       if (gnutls_global_init() < 0) {
                fprintf(stderr, "global state initialization error\n");
                exit(1);
        }
diff --git a/src/srp/Makefile.am b/src/srp/Makefile.am
new file mode 100644 (file)
index 0000000..a489bd2
--- /dev/null
@@ -0,0 +1 @@
+EXTRA_DIST = tpasswd tpasswd.conf
diff --git a/src/x509/Makefile.am b/src/x509/Makefile.am
new file mode 100644 (file)
index 0000000..2dec0d7
--- /dev/null
@@ -0,0 +1 @@
+EXTRA_DIST = ca.pem cert.pem key.pem