projects
/
openssl.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix buggy if-condition (thomas poindessous <poinde_t@epita.fr>).
[openssl.git]
/
demos
/
maurice
/
example1.c
diff --git
a/demos/maurice/example1.c
b/demos/maurice/example1.c
index 77730d3232ef92df17130e28ce2c850fff6e5256..1ef829990065103d7573c6132747f845f50471cd 100644
(file)
--- a/
demos/maurice/example1.c
+++ b/
demos/maurice/example1.c
@@
-13,13
+13,13
@@
#include <strings.h>
#include <stdlib.h>
#include <strings.h>
#include <stdlib.h>
-#include
"rsa.h"
-#include
"evp.h"
-#include
"objects.h"
-#include
"x509.h"
-#include
"err.h"
-#include
"pem.h"
-#include
"ssl.h"
+#include
<openssl/rsa.h>
+#include
<openssl/evp.h>
+#include
<openssl/objects.h>
+#include
<openssl/x509.h>
+#include
<openssl/err.h>
+#include
<openssl/pem.h>
+#include
<openssl/ssl.h>
#include "loadkeys.h"
#include "loadkeys.h"
@@
-72,7
+72,7
@@
void main_encrypt(void)
pubKey[0] = ReadPublicKey(PUBFILE);
pubKey[0] = ReadPublicKey(PUBFILE);
- if(!pubKey)
+ if(!pubKey
[0]
)
{
fprintf(stderr,"Error: can't load public key");
exit(1);
{
fprintf(stderr,"Error: can't load public key");
exit(1);
@@
-126,11
+126,11
@@
void main_encrypt(void)
void main_decrypt(void)
{
void main_decrypt(void)
{
- char buf[5
12
];
+ char buf[5
20
];
char ebuf[512];
unsigned int buflen;
EVP_CIPHER_CTX ectx;
char ebuf[512];
unsigned int buflen;
EVP_CIPHER_CTX ectx;
- unsigned char iv[
8
];
+ unsigned char iv[
EVP_MAX_IV_LENGTH
];
unsigned char *encryptKey;
unsigned int ekeylen;
EVP_PKEY *privateKey;
unsigned char *encryptKey;
unsigned int ekeylen;
EVP_PKEY *privateKey;
@@
-164,7
+164,6
@@
void main_decrypt(void)
read(STDIN, encryptKey, ekeylen);
read(STDIN, iv, sizeof(iv));
read(STDIN, encryptKey, ekeylen);
read(STDIN, iv, sizeof(iv));
-
EVP_OpenInit(&ectx,
EVP_des_ede3_cbc(),
encryptKey,
EVP_OpenInit(&ectx,
EVP_des_ede3_cbc(),
encryptKey,
@@
-185,7
+184,6
@@
void main_decrypt(void)
}
EVP_OpenUpdate(&ectx, buf, &buflen, ebuf, readlen);
}
EVP_OpenUpdate(&ectx, buf, &buflen, ebuf, readlen);
-
write(STDOUT, buf, buflen);
}
write(STDOUT, buf, buflen);
}