Commit e84240d4 authored by Dr. Stephen Henson's avatar Dr. Stephen Henson
Browse files

New functions sk_set, sk_value and sk_num to replace existing macros: this is

to minimise the effects on existing code.
parent 054810ec
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -10,6 +10,18 @@
                                   [23-Dec-1998] down below; but in later
                                   versions, these hyphens are gone.]

  *) New functions sk_num, sk_value and sk_set to replace the previous macros.
     These are required because of the typesafe stack would otherwise break 
     existing code. If old code used a structure member which used to be STACK
     and is now STACK_OF (for example cert in a PKCS7_SIGNED structure) with
     sk_num or sk_value it would produce an error because the num, data members
     are not present in STACK_OF. Now it just produces a warning. sk_set
     replaces the old method of assigning a value to sk_value
     (e.g. sk_value(x, i) = y) which the library used in a few cases. Any code
     that does this will no longer work (and should use sk_set instead) but
     this could be regarded as a "questionable" behaviour anyway.
     [Steve Henson]

  *) Fix most of the other PKCS#7 bugs. The "experimental" code can now
     correctly handle encrypted S/MIME data.
     [Steve Henson]
+3 −3
Original line number Diff line number Diff line
@@ -69,7 +69,6 @@

EVP_CIPHER *enc;

#define _ITER_ 2048

#define NOKEYS		0x1
#define NOCERTS 	0x2
@@ -99,7 +98,7 @@ int MAIN(int argc, char **argv)
    int options = 0;
    int chain = 0;
    int badarg = 0;
    int iter = _ITER_;
    int iter = PKCS12_DEFAULT_ITER;
    int maciter = 1;
    int twopass = 0;
    int keytype = 0;
@@ -140,7 +139,8 @@ int MAIN(int argc, char **argv)
#endif
		else if (!strcmp (*args, "-des3")) enc = EVP_des_ede3_cbc();
		else if (!strcmp (*args, "-noiter")) iter = 1;
		else if (!strcmp (*args, "-maciter")) maciter = _ITER_;
		else if (!strcmp (*args, "-maciter"))
					 maciter = PKCS12_DEFAULT_ITER;
		else if (!strcmp (*args, "-nodes")) enc=NULL;
		else if (!strcmp (*args, "-inkey")) {
		    if (args[1]) {
+2 −2
Original line number Diff line number Diff line
@@ -97,7 +97,7 @@ int CRYPTO_get_ex_new_index(int idx, STACK **skp, long argl, char *argp,
			goto err;
			}
		}
	sk_value(*skp,idx)=(char *)a;
	sk_set(*skp,idx, (char *)a);
	ret=idx;
err:
	MemCheck_on();
@@ -127,7 +127,7 @@ int CRYPTO_set_ex_data(CRYPTO_EX_DATA *ad, int idx, char *val)
			}
		i++;
		}
	sk_value(ad->sk,idx)=val;
	sk_set(ad->sk,idx,val);
	return(1);
	}

+3 −3
Original line number Diff line number Diff line
@@ -56,11 +56,11 @@ int OBJ_NAME_new_index(unsigned long (*hash_func)(), int (*cmp_func)(),
		MemCheck_on();
		}
	if (hash_func != NULL)
		sk_value(names_hash,ret)=(char *)hash_func;
		sk_set(names_hash,ret,(char *)hash_func);
	if (cmp_func != NULL)
		sk_value(names_cmp,ret)= (char *)cmp_func;
		sk_set(names_cmp,ret,(char *)cmp_func);
	if (free_func != NULL)
		sk_value(names_free,ret)=(char *)free_func;
		sk_set(names_free,ret,(char *)free_func);
	return(ret);
	}

+1 −1
Original line number Diff line number Diff line
@@ -77,7 +77,7 @@ PKCS12 *PKCS12_create(char *pass, char *name, EVP_PKEY *pkey, X509 *cert,
	/* Set defaults */
	if(!nid_cert) nid_cert = NID_pbe_WithSHA1And40BitRC2_CBC;
	if(!nid_key) nid_key = NID_pbe_WithSHA1And3_Key_TripleDES_CBC;
	if(!iter) iter = 2048;
	if(!iter) iter = PKCS12_DEFAULT_ITER;
	if(!mac_iter) mac_iter = 1;

	if(!pkey || !cert) {
Loading