summaryrefslogtreecommitdiffstats
path: root/demos/maurice
diff options
context:
space:
mode:
authorBodo Möller <bodo@openssl.org>1999-05-27 23:52:31 +0000
committerBodo Möller <bodo@openssl.org>1999-05-27 23:52:31 +0000
commit71f080935a50c3fd795f0c3ccb6ee0dd7c453de1 (patch)
treef77d763433b57eb64f6d445d5faba2913497de9f /demos/maurice
parente95f626827bf98fe0c0b792464202d325f4cf8b9 (diff)
Updated some demos.
Submitted by: Sean O Riordain <Sean.ORiordain@cyrona.com>
Diffstat (limited to 'demos/maurice')
-rw-r--r--demos/maurice/Makefile39
-rw-r--r--demos/maurice/example2.c4
-rw-r--r--demos/maurice/example3.c9
-rw-r--r--demos/maurice/example4.c7
4 files changed, 47 insertions, 12 deletions
diff --git a/demos/maurice/Makefile b/demos/maurice/Makefile
index c05039850a..f9bf62276e 100644
--- a/demos/maurice/Makefile
+++ b/demos/maurice/Makefile
@@ -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
diff --git a/demos/maurice/example2.c b/demos/maurice/example2.c
index 06c325832e..57bce10b5e 100644
--- a/demos/maurice/example2.c
+++ b/demos/maurice/example2.c
@@ -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;
}
-
-
diff --git a/demos/maurice/example3.c b/demos/maurice/example3.c
index fcaff00c37..c8462a47c3 100644
--- a/demos/maurice/example3.c
+++ b/demos/maurice/example3.c
@@ -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);
}
-
-
diff --git a/demos/maurice/example4.c b/demos/maurice/example4.c
index d436a20019..ce629848b7 100644
--- a/demos/maurice/example4.c
+++ b/demos/maurice/example4.c
@@ -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);