This is an update of the patch made by Antti Tapio for 0.9.8a - ticket
#1261
Index: apps/smime.c
===
RCS file: /home/john/cvsroot/openssl/apps/smime.c,v
retrieving revision 1.1.1.1
retrieving revision 1.1.1.1.2.1
diff -u -p -r1.1.1.1 -r1.1.1.1.2.1
--- apps/smime.c 14 Oct 2011 11:17:40 - 1.1.1.1
+++ apps/smime.c 20 Oct 2011 07:16:06 - 1.1.1.1.2.1
@@ -78,7 +78,7 @@ static int smime_cb(int ok, X509_STORE_C
#define SMIME_ENCRYPT (1 | SMIME_OP)
#define SMIME_DECRYPT (2 | SMIME_IP)
#define SMIME_SIGN (3 | SMIME_OP | SMIME_SIGNERS)
-#define SMIME_VERIFY (4 | SMIME_IP)
+#define SMIME_VERIFY (4 | SMIME_IP | SMIME_OP)
#define SMIME_PK7OUT (5 | SMIME_IP | SMIME_OP)
#define SMIME_RESIGN (6 | SMIME_IP | SMIME_OP | SMIME_SIGNERS)
@@ -365,6 +365,23 @@ int MAIN(int argc, char **argv)
goto argerr;
contfile = *++args;
}
+ else if (!strcmp(*args, "-transenc") || !strcmp (*args, "-transferencoding"))
+ {
+ if (args[1])
+{
+if (!strcmp(args[1], "binary"))
+ flags |= SMIME_TRANSFER_ENCODING_BINARY;
+else if (!strcmp(args[1], "base64"))
+ ;
+else {
+ BIO_printf(bio_err, "Supported transfer encodings are base64 and binary\n");
+ badarg = 1;
+}
+args++;
+}
+ else
+badarg = 1;
+ }
else if (args_verify(&args, NULL, &badarg, bio_err, &vpm))
continue;
else if ((cipher = EVP_get_cipherbyname(*args + 1)) == NULL)
@@ -488,6 +505,7 @@ int MAIN(int argc, char **argv)
BIO_printf(bio_err, "-rand file%cfile%c...\n", LIST_SEPARATOR_CHAR, LIST_SEPARATOR_CHAR);
BIO_printf(bio_err, " load the file (or the files in the directory) into\n");
BIO_printf(bio_err, " the random number generator\n");
+ BIO_printf(bio_err, "-transenc enc transfer encoding to use (base64 or binary)\n");
BIO_printf (bio_err, "cert.pem recipient certificate(s) for encryption\n");
goto end;
}
Index: crypto/asn1/asn1.h
===
RCS file: /home/john/cvsroot/openssl/crypto/asn1/asn1.h,v
retrieving revision 1.1.1.1
retrieving revision 1.1.1.1.2.1
diff -u -p -r1.1.1.1 -r1.1.1.1.2.1
--- crypto/asn1/asn1.h 14 Oct 2011 11:17:40 - 1.1.1.1
+++ crypto/asn1/asn1.h 15 Oct 2011 09:36:51 - 1.1.1.1.2.1
@@ -161,6 +161,7 @@ extern "C" {
#define SMIME_OLDMIME 0x400
#define SMIME_CRLFEOL 0x800
#define SMIME_STREAM 0x1000
+#define SMIME_TRANSFER_ENCODING_BINARY 0x2000
struct X509_algor_st;
DECLARE_STACK_OF(X509_ALGOR)
@@ -1222,6 +1223,8 @@ void ERR_load_ASN1_strings(void);
#define ASN1_F_ASN1_VERIFY 137
#define ASN1_F_B64_READ_ASN1 209
#define ASN1_F_B64_WRITE_ASN1 210
+#define ASN1_F_BINARY_READ_ASN1 219
+#define ASN1_F_BINARY_WRITE_ASN1 220
#define ASN1_F_BIO_NEW_NDEF 208
#define ASN1_F_BITSTR_CB 180
#define ASN1_F_BN_TO_ASN1_ENUMERATED 138
@@ -1335,6 +1338,7 @@ void ERR_load_ASN1_strings(void);
#define ASN1_R_INVALID_OBJECT_ENCODING 216
#define ASN1_R_INVALID_SEPARATOR 131
#define ASN1_R_INVALID_TIME_FORMAT 132
+#define ASN1_R_INVALID_TRANSFER_ENCODING 217
#define ASN1_R_INVALID_UNIVERSALSTRING_LENGTH 133
#define ASN1_R_INVALID_UTF8STRING 134
#define ASN1_R_IV_TOO_LARGE 135
Index: crypto/asn1/asn1_err.c
===
RCS file: /home/john/cvsroot/openssl/crypto/asn1/asn1_err.c,v
retrieving revision 1.1.1.1
retrieving revision 1.1.1.1.2.1
diff -u -p -r1.1.1.1 -r1.1.1.1.2.1
--- crypto/asn1/asn1_err.c 14 Oct 2011 11:17:40 - 1.1.1.1
+++ crypto/asn1/asn1_err.c 15 Oct 2011 09:36:51 - 1.1.1.1.2.1
@@ -135,6 +135,8 @@ static ERR_STRING_DATA ASN1_str_functs[]
{ERR_FUNC(ASN1_F_ASN1_VERIFY), "ASN1_verify"},
{ERR_FUNC(ASN1_F_B64_READ_ASN1), "B64_READ_ASN1"},
{ERR_FUNC(ASN1_F_B64_WRITE_ASN1), "B64_WRITE_ASN1"},
+{ERR_FUNC(ASN1_F_BINARY_READ_ASN1), "BINARY_READ_ASN1"},
+{ERR_FUNC(ASN1_F_BINARY_WRITE_ASN1), "BINARY_WRITE_ASN1"},
{ERR_FUNC(ASN1_F_BIO_NEW_NDEF), "BIO_new_NDEF"},
{ERR_FUNC(ASN1_F_BITSTR_CB), "BITSTR_CB"},
{ERR_FUNC(ASN1_F_BN_TO_ASN1_ENUMERATED), "BN_to_ASN1_ENUMERATED"},
Index: crypto/asn1/asn_mime.c
===
RCS file: /home/john/cvsroot/openssl/crypto/asn1/asn_mime.c,v
retrieving revision 1.1.1.1
retrieving revision 1.1.1.1.2.2
diff -u -p -r1.1.1.1 -r1.1.1.1.2.2
--- crypto/asn1/asn_mime.c 14 Oct 2011 11:17:40 - 1.1.1.1
+++ crypto/asn1/asn_mime.c 20 Oct 2011 07:16:07 - 1.1.1.1.2.2
@@ -100,7 +100,6 @@ static int mime_hdr_cmp(const MIME_HEADE
static int mime_param_cmp(const MIME_PARAM * const *a,
const MIME_PARAM * const *b);
static void mime_param_free(MIME_PARAM *param);
-static int mime_bound_check(char *line, int linelen, char *bound, int blen);
static int multi_split(BIO *bio, char *bound, STACK_OF(BIO) **ret);
static int strip_eol(char *linebuf, int *plen);
static MIME_HEADER *mime_hdr_find(STACK_OF(