projects
/
openssl.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
make sure .rnd exists
[openssl.git]
/
apps
/
rsautl.c
diff --git
a/apps/rsautl.c
b/apps/rsautl.c
index ba95229e1a1667132f0e0dc54cdd639d80a7c6d2..c04a2fcb9b861614fde98157f9ded560d9f8581c 100644
(file)
--- a/
apps/rsautl.c
+++ b/
apps/rsautl.c
@@
-55,6
+55,9
@@
* Hudson (tjh@cryptsoft.com).
*
*/
* Hudson (tjh@cryptsoft.com).
*
*/
+
+#ifndef OPENSSL_NO_RSA
+
#include "apps.h"
#include <string.h>
#include <openssl/err.h>
#include "apps.h"
#include <string.h>
#include <openssl/err.h>
@@
-79,8
+82,10
@@
int MAIN(int argc, char **);
int MAIN(int argc, char **argv)
{
int MAIN(int argc, char **argv)
{
+ ENGINE *e = NULL;
BIO *in = NULL, *out = NULL;
char *infile = NULL, *outfile = NULL;
BIO *in = NULL, *out = NULL;
char *infile = NULL, *outfile = NULL;
+ char *engine = NULL;
char *keyfile = NULL;
char rsa_mode = RSA_VERIFY, key_type = KEY_PRIVKEY;
int keyform = FORMAT_PEM;
char *keyfile = NULL;
char rsa_mode = RSA_VERIFY, key_type = KEY_PRIVKEY;
int keyform = FORMAT_PEM;
@@
-114,6
+119,9
@@
int MAIN(int argc, char **argv)
} else if(!strcmp(*argv, "-inkey")) {
if (--argc < 1) badarg = 1;
keyfile = *(++argv);
} else if(!strcmp(*argv, "-inkey")) {
if (--argc < 1) badarg = 1;
keyfile = *(++argv);
+ } else if(!strcmp(*argv, "-engine")) {
+ if (--argc < 1) badarg = 1;
+ engine = *(++argv);
} else if(!strcmp(*argv, "-pubin")) {
key_type = KEY_PUBKEY;
} else if(!strcmp(*argv, "-certin")) {
} else if(!strcmp(*argv, "-pubin")) {
key_type = KEY_PUBKEY;
} else if(!strcmp(*argv, "-certin")) {
@@
-148,20
+156,25
@@
int MAIN(int argc, char **argv)
goto end;
}
goto end;
}
+ e = setup_engine(bio_err, engine, 0);
+
/* FIXME: seed PRNG only if needed */
app_RAND_load_file(NULL, bio_err, 0);
switch(key_type) {
case KEY_PRIVKEY:
/* FIXME: seed PRNG only if needed */
app_RAND_load_file(NULL, bio_err, 0);
switch(key_type) {
case KEY_PRIVKEY:
- pkey = load_key(bio_err, keyfile, keyform, NULL);
+ pkey = load_key(bio_err, keyfile, keyform,
+ NULL, e, "Private Key");
break;
case KEY_PUBKEY:
break;
case KEY_PUBKEY:
- pkey = load_pubkey(bio_err, keyfile, keyform);
+ pkey = load_pubkey(bio_err, keyfile, keyform,
+ NULL, e, "Public Key");
break;
case KEY_CERT:
break;
case KEY_CERT:
- x = load_cert(bio_err, keyfile, keyform);
+ x = load_cert(bio_err, keyfile, keyform,
+ NULL, e, "Certificate");
if(x) {
pkey = X509_get_pubkey(x);
X509_free(x);
if(x) {
pkey = X509_get_pubkey(x);
X509_free(x);
@@
-170,7
+183,6
@@
int MAIN(int argc, char **argv)
}
if(!pkey) {
}
if(!pkey) {
- BIO_printf(bio_err, "Error loading key\n");
return 1;
}
return 1;
}
@@
-198,7
+210,15
@@
int MAIN(int argc, char **argv)
ERR_print_errors(bio_err);
goto end;
}
ERR_print_errors(bio_err);
goto end;
}
- } else out = BIO_new_fp(stdout, BIO_NOCLOSE);
+ } else {
+ out = BIO_new_fp(stdout, BIO_NOCLOSE);
+#ifdef OPENSSL_SYS_VMS
+ {
+ BIO *tmpbio = BIO_new(BIO_f_linebuffer());
+ out = BIO_push(tmpbio, out);
+ }
+#endif
+ }
keysize = RSA_size(rsa);
keysize = RSA_size(rsa);
@@
-255,7
+275,7
@@
int MAIN(int argc, char **argv)
end:
RSA_free(rsa);
BIO_free(in);
end:
RSA_free(rsa);
BIO_free(in);
- BIO_free(out);
+ BIO_free
_all
(out);
if(rsa_in) OPENSSL_free(rsa_in);
if(rsa_out) OPENSSL_free(rsa_out);
return ret;
if(rsa_in) OPENSSL_free(rsa_in);
if(rsa_out) OPENSSL_free(rsa_out);
return ret;
@@
-280,3
+300,4
@@
static void usage()
BIO_printf(bio_err, "-hexdump hex dump output\n");
}
BIO_printf(bio_err, "-hexdump hex dump output\n");
}
+#endif