Updated some demos.
authorBodo Möller <bodo@openssl.org>
Thu, 27 May 1999 23:52:31 +0000 (23:52 +0000)
committerBodo Möller <bodo@openssl.org>
Thu, 27 May 1999 23:52:31 +0000 (23:52 +0000)
Submitted by: Sean O Riordain <Sean.ORiordain@cyrona.com>

12 files changed:
CHANGES
demos/bio/Makefile [new file with mode: 0644]
demos/bio/sconnect.c
demos/eay/Makefile [new file with mode: 0644]
demos/eay/conn.c
demos/maurice/Makefile
demos/maurice/example2.c
demos/maurice/example3.c
demos/maurice/example4.c
demos/prime/Makefile [new file with mode: 0644]
demos/sign/Makefile [new file with mode: 0644]
demos/sign/sign.c

diff --git a/CHANGES b/CHANGES
index d370427a4c8c1be9cf5d52ec1237b53a3d82ad57..7228510654efba4d164ab6c178440144b842ca61 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -5,6 +5,9 @@
 
  Changes between 0.9.3 and 0.9.3a [?]  [xx May? 1999]
 
+  *) Updated some demos.
+     [Sean O Riordain]
+
   *) Add missing BIO_free at exit of pkcs12 application.
      [Wu Zhigang]
 
diff --git a/demos/bio/Makefile b/demos/bio/Makefile
new file mode 100644 (file)
index 0000000..4351540
--- /dev/null
@@ -0,0 +1,16 @@
+CC=cc
+CFLAGS= -g -I../../include
+LIBS= -L../.. ../../libssl.a ../../libcrypto.a
+EXAMPLES=saccept sconnect
+
+all: $(EXAMPLES) 
+
+saccept: saccept.o
+       $(CC) -o saccept saccept.o $(LIBS)
+
+sconnect: sconnect.o
+       $(CC) -o sconnect sconnect.o $(LIBS)
+
+clean: 
+       rm -f $(EXAMPLES) *.o
+
index 8fb6302b9459bc37247d39a2bf6506f24b89e112..59fab1985e451c814966a8cb77ccde86cbc034b6 100644 (file)
@@ -9,6 +9,7 @@
  */
 #include <stdio.h>
 #include <stdlib.h>
+#include <unistd.h>
 #include <openssl/err.h>
 #include <openssl/ssl.h>
 
diff --git a/demos/eay/Makefile b/demos/eay/Makefile
new file mode 100644 (file)
index 0000000..2d22eac
--- /dev/null
@@ -0,0 +1,24 @@
+CC=cc
+CFLAGS= -g -I../../include
+#LIBS=  -L../.. -lcrypto -lssl
+LIBS= -L../.. ../../libssl.a ../../libcrypto.a
+
+# the file conn.c requires a file "proxy.h" which I couldn't find...
+#EXAMPLES=base64 conn loadrsa
+EXAMPLES=base64 loadrsa
+
+all: $(EXAMPLES) 
+
+base64: base64.o
+       $(CC) -o base64 base64.o $(LIBS)
+#
+# sorry... can't find "proxy.h"
+#conn: conn.o
+#      $(CC) -o conn conn.o $(LIBS)
+
+loadrsa: loadrsa.o
+       $(CC) -o loadrsa loadrsa.o $(LIBS)
+
+clean: 
+       rm -f $(EXAMPLES) *.o
+
index ac121db278cc8da2b85f842fbafec0c1d6833b2a..c4b8f5163e1154fae3efc18475e80bf20d1c4d02 100644 (file)
@@ -9,7 +9,7 @@
 #include <stdlib.h>
 #include <openssl/err.h>
 #include <openssl/bio.h>
-#include "proxy.h"
+/* #include "proxy.h" */
 
 extern int errno;
 
index c05039850a9340033ae61c7ea83b0a4009e0c5d8..f9bf62276e83ad2bba25c0b2450efa613041c1d3 100644 (file)
@@ -1,5 +1,5 @@
 CC=cc
-CFLAGS= -g -I../../include
+CFLAGS= -g -I../../include -Wall
 LIBS=  -L../.. -lcrypto
 EXAMPLES=example1 example2 example3 example4
 
@@ -20,3 +20,40 @@ example4: example4.o
 clean: 
        rm -f $(EXAMPLES) *.o
 
+test: all
+       @echo
+       @echo Example 1 Demonstrates the sealing and opening APIs
+       @echo Doing the encrypt side...
+       ./example1 <README >t.t
+       @echo Doing the decrypt side...
+       ./example1 -d <t.t >t.2
+       diff t.2 README
+       rm -f t.t t.2
+       @echo  example1 is OK
+
+       @echo
+       @echo Example2 Demonstrates rsa encryption and decryption
+       @echo   and it should just print \"This the clear text\"
+       ./example2
+
+       @echo
+       @echo Example3 Demonstrates the use of symmetric block ciphers
+       @echo in this case it uses EVP_des_ede3_cbc
+       @echo i.e. triple DES in Cipher Block Chaining mode
+       @echo Doing the encrypt side...
+       ./example3 ThisIsThePassword <README >t.t
+       @echo Doing the decrypt side...
+       ./example3 -d ThisIsThePassword <t.t >t.2
+       diff t.2 README
+       rm -f t.t t.2
+       @echo  example3 is OK
+
+       @echo
+       @echo Example4 Demonstrates base64 encoding and decoding
+       @echo Doing the encrypt side...
+       ./example4 <README >t.t
+       @echo Doing the decrypt side...
+       ./example4 -d <t.t >t.2
+       diff t.2 README
+       rm -f t.t t.2
+       @echo example4 is OK
index 06c325832efb1ebe5f266c660f92d1fe4a96346d..57bce10b5ed5ec37f8ee1d3a37b0394604732752 100644 (file)
@@ -33,7 +33,6 @@ int main()
        EVP_PKEY *pubKey;
        EVP_PKEY *privKey;
        int len;
-       FILE *fp;
 
         ERR_load_crypto_strings();
 
@@ -72,6 +71,5 @@ int main()
        EVP_PKEY_free(pubKey);
        free(buf);
        free(buf2);
+        return 0;
 }
-
-
index fcaff00c370b0f1ffe8f3eca9ea05e2da48b61ce..c8462a47c3716d6fdb15d98e9591c661089f4744 100644 (file)
@@ -8,9 +8,10 @@
 */
 
 #include <stdio.h>
+#include <unistd.h>
 #include <fcntl.h>
 #include <sys/stat.h>
-#include <evp.h>
+#include <openssl/evp.h>
 
 #define STDIN          0
 #define STDOUT         1
@@ -47,9 +48,9 @@ void do_cipher(char *pw, int operation)
 {
        char buf[BUFLEN];
        char ebuf[BUFLEN + 8];
-       unsigned int ebuflen, rc;
+       unsigned int ebuflen; /* rc; */
         unsigned char iv[EVP_MAX_IV_LENGTH], key[EVP_MAX_KEY_LENGTH];
-       unsigned int ekeylen, net_ekeylen; 
+       /* unsigned int ekeylen, net_ekeylen;  */
        EVP_CIPHER_CTX ectx;
         
        memcpy(iv, INIT_VECTOR, sizeof(iv));
@@ -82,5 +83,3 @@ void do_cipher(char *pw, int operation)
 
        write(STDOUT, ebuf, ebuflen); 
 }
-
-
index d436a20019591f4b3f01a1a45508b039825cdfb4..ce629848b74fc6617cce73ba87fc1e887ef79eeb 100644 (file)
@@ -8,9 +8,10 @@
 */
 
 #include <stdio.h>
+#include <unistd.h>
 #include <fcntl.h>
 #include <sys/stat.h>
-#include <evp.h>
+#include <openssl/evp.h>
 
 #define STDIN          0
 #define STDOUT         1
@@ -44,7 +45,7 @@ void do_encode()
 {
        char buf[BUFLEN];
        char ebuf[BUFLEN+24];
-       unsigned int ebuflen, rc;
+       unsigned int ebuflen;
        EVP_ENCODE_CTX ectx;
         
        EVP_EncodeInit(&ectx);
@@ -78,7 +79,7 @@ void do_decode()
 {
        char buf[BUFLEN];
        char ebuf[BUFLEN+24];
-       unsigned int ebuflen, rc;
+       unsigned int ebuflen;
        EVP_ENCODE_CTX ectx;
         
        EVP_DecodeInit(&ectx);
diff --git a/demos/prime/Makefile b/demos/prime/Makefile
new file mode 100644 (file)
index 0000000..0166cd4
--- /dev/null
@@ -0,0 +1,20 @@
+CC=cc
+CFLAGS= -g -I../../include -Wall
+LIBS=  -L../.. -lcrypto
+EXAMPLES=prime
+
+all: $(EXAMPLES) 
+
+prime: prime.o
+       $(CC) -o prime prime.o $(LIBS)
+
+clean: 
+       rm -f $(EXAMPLES) *.o
+
+test: all
+       @echo Test creating a 128-bit prime
+       ./prime 128
+       @echo Test creating a 256-bit prime
+       ./prime 256
+       @echo Test creating a 512-bit prime
+       ./prime 512
diff --git a/demos/sign/Makefile b/demos/sign/Makefile
new file mode 100644 (file)
index 0000000..e6d391e
--- /dev/null
@@ -0,0 +1,15 @@
+CC=cc
+CFLAGS= -g -I../../include -Wall
+LIBS=  -L../.. -lcrypto
+EXAMPLES=sign
+
+all: $(EXAMPLES) 
+
+sign: sign.o
+       $(CC) -o sign sign.o $(LIBS)
+
+clean: 
+       rm -f $(EXAMPLES) *.o
+
+test: all
+       ./sign
index 946c29c45e24726c7042eda6826be2e4c05299bb..64e72e7194878ba7c260af69e7f18f4a008a3818 100644 (file)
@@ -70,7 +70,7 @@
 #include <openssl/pem.h>
 #include <openssl/ssl.h>
 
-void main ()
+int main ()
 {
   int err;
   int sig_len;
@@ -134,4 +134,5 @@ void main ()
   if (err != 1) {  ERR_print_errors_fp (stderr);    exit (1);  }
   EVP_PKEY_free (pkey);
   printf ("Signature Verified Ok.\n");
+  return(0);
 }