diff options
Diffstat (limited to 'src/lib/libcrypto/pkcs7/enc.c')
-rw-r--r-- | src/lib/libcrypto/pkcs7/enc.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/lib/libcrypto/pkcs7/enc.c b/src/lib/libcrypto/pkcs7/enc.c index 43bfd10a23..2b56c2eff3 100644 --- a/src/lib/libcrypto/pkcs7/enc.c +++ b/src/lib/libcrypto/pkcs7/enc.c | |||
@@ -56,6 +56,7 @@ | |||
56 | * [including the GNU Public Licence.] | 56 | * [including the GNU Public Licence.] |
57 | */ | 57 | */ |
58 | #include <stdio.h> | 58 | #include <stdio.h> |
59 | #include <string.h> | ||
59 | #include <openssl/bio.h> | 60 | #include <openssl/bio.h> |
60 | #include <openssl/x509.h> | 61 | #include <openssl/x509.h> |
61 | #include <openssl/pem.h> | 62 | #include <openssl/pem.h> |
@@ -76,7 +77,7 @@ char *argv[]; | |||
76 | const EVP_CIPHER *cipher=NULL; | 77 | const EVP_CIPHER *cipher=NULL; |
77 | STACK_OF(X509) *recips=NULL; | 78 | STACK_OF(X509) *recips=NULL; |
78 | 79 | ||
79 | SSLeay_add_all_algorithms(); | 80 | OpenSSL_add_all_algorithms(); |
80 | 81 | ||
81 | data=BIO_new(BIO_s_file()); | 82 | data=BIO_new(BIO_s_file()); |
82 | while(argc > 1) | 83 | while(argc > 1) |
@@ -98,7 +99,8 @@ char *argv[]; | |||
98 | argc-=2; | 99 | argc-=2; |
99 | argv+=2; | 100 | argv+=2; |
100 | if (!(in=BIO_new_file(keyfile,"r"))) goto err; | 101 | if (!(in=BIO_new_file(keyfile,"r"))) goto err; |
101 | if (!(x509=PEM_read_bio_X509(in,NULL,NULL))) goto err; | 102 | if (!(x509=PEM_read_bio_X509(in,NULL,NULL,NULL))) |
103 | goto err; | ||
102 | if(!recips) recips = sk_X509_new_null(); | 104 | if(!recips) recips = sk_X509_new_null(); |
103 | sk_X509_push(recips, x509); | 105 | sk_X509_push(recips, x509); |
104 | BIO_free(in); | 106 | BIO_free(in); |
@@ -125,7 +127,14 @@ char *argv[]; | |||
125 | #else | 127 | #else |
126 | PKCS7_set_type(p7,NID_pkcs7_enveloped); | 128 | PKCS7_set_type(p7,NID_pkcs7_enveloped); |
127 | #endif | 129 | #endif |
128 | if(!cipher) cipher = EVP_des_ede3_cbc(); | 130 | if(!cipher) { |
131 | #ifndef NO_DES | ||
132 | cipher = EVP_des_ede3_cbc(); | ||
133 | #else | ||
134 | fprintf(stderr, "No cipher selected\n"); | ||
135 | goto err; | ||
136 | #endif | ||
137 | } | ||
129 | 138 | ||
130 | if (!PKCS7_set_cipher(p7,cipher)) goto err; | 139 | if (!PKCS7_set_cipher(p7,cipher)) goto err; |
131 | for(i = 0; i < sk_X509_num(recips); i++) { | 140 | for(i = 0; i < sk_X509_num(recips); i++) { |