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

Fix indentation.

parent c451bd82
Loading
Loading
Loading
Loading
+60 −48
Original line number Diff line number Diff line
@@ -392,7 +392,6 @@ static int capi_init(ENGINE *e)

static int capi_destroy(ENGINE *e)
	{

	ERR_unload_CAPI_strings();
	return 1;
	}
@@ -693,7 +692,8 @@ int capi_rsa_sign(int dtype, const unsigned char *m, unsigned int m_len,
		return -1;
		}
/* Convert the signature type to a CryptoAPI algorithm ID */
	switch(dtype) {
	switch(dtype)
		{
	case NID_sha1:
		alg = CALG_SHA1;
		break;
@@ -718,14 +718,16 @@ int capi_rsa_sign(int dtype, const unsigned char *m, unsigned int m_len,


/* Create the hash object */
	if(!CryptCreateHash(capi_key->hprov, alg, 0, 0, &hash)) {
	if(!CryptCreateHash(capi_key->hprov, alg, 0, 0, &hash))
		{
		CAPIerr(CAPI_F_CAPI_RSA_SIGN, CAPI_R_CANT_CREATE_HASH_OBJECT);
		capi_addlasterror();
		return -1;
		}
/* Set the hash value to the value passed */

	if(!CryptSetHashParam(hash, HP_HASHVAL, (unsigned char *)m, 0)) {
	if(!CryptSetHashParam(hash, HP_HASHVAL, (unsigned char *)m, 0))
		{
		CAPIerr(CAPI_F_CAPI_RSA_SIGN, CAPI_R_CANT_SET_HASH_VALUE);
		capi_addlasterror();
		goto err;
@@ -734,14 +736,18 @@ int capi_rsa_sign(int dtype, const unsigned char *m, unsigned int m_len,

/* Finally sign it */
	slen = RSA_size(rsa);
	if(!CryptSignHash(hash, capi_key->keyspec, NULL, 0, sigret, &slen)) {
	if(!CryptSignHash(hash, capi_key->keyspec, NULL, 0, sigret, &slen))
		{
		CAPIerr(CAPI_F_CAPI_RSA_SIGN, CAPI_R_ERROR_SIGNING_HASH);
		capi_addlasterror();
		goto err;
	} else {
		}
	else
		{
		ret = 1;
		/* Inplace byte reversal of signature */
		for(i = 0; i < slen / 2; i++) {
		for(i = 0; i < slen / 2; i++)
			{
			unsigned char c;
			c = sigret[i];
			sigret[i] = sigret[slen - i - 1];
@@ -851,14 +857,16 @@ static DSA_SIG *capi_dsa_do_sign(const unsigned char *digest, int dlen,
		}

	/* Create the hash object */
	if(!CryptCreateHash(capi_key->hprov, CALG_SHA1, 0, 0, &hash)) {
	if(!CryptCreateHash(capi_key->hprov, CALG_SHA1, 0, 0, &hash))
		{
		CAPIerr(CAPI_F_CAPI_DSA_DO_SIGN, CAPI_R_CANT_CREATE_HASH_OBJECT);
		capi_addlasterror();
		return NULL;
		}

	/* Set the hash value to the value passed */
	if(!CryptSetHashParam(hash, HP_HASHVAL, (unsigned char *)digest, 0)) {
	if(!CryptSetHashParam(hash, HP_HASHVAL, (unsigned char *)digest, 0))
		{
		CAPIerr(CAPI_F_CAPI_DSA_DO_SIGN, CAPI_R_CANT_SET_HASH_VALUE);
		capi_addlasterror();
		goto err;
@@ -1258,7 +1266,8 @@ static PCCERT_CONTEXT capi_find_cert(CAPI_CTX *ctx, const char *id, HCERTSTORE h
	switch(ctx->lookup_method)
		{
		case CAPI_LU_SUBSTR:
			return CertFindCertificateInStore(hstore, X509_ASN_ENCODING, 0, 
			return CertFindCertificateInStore(hstore,
					X509_ASN_ENCODING, 0,
					CERT_FIND_SUBJECT_STR_A, id, NULL);
		case CAPI_LU_FNAME:
			for(;;)
@@ -1323,7 +1332,8 @@ static CAPI_KEY *capi_get_cert_key(CAPI_CTX *ctx, PCCERT_CONTEXT cert)
	if (!provname || !contname)
		return 0;

	key = capi_get_key(ctx, contname, provname, pinfo->dwProvType, pinfo->dwKeySpec);
	key = capi_get_key(ctx, contname, provname,
				pinfo->dwProvType, pinfo->dwKeySpec);

	err:
	if (pinfo)
@@ -1357,7 +1367,8 @@ CAPI_KEY *capi_find_key(CAPI_CTX *ctx, const char *id)
		break;

		case CAPI_LU_CONTNAME:
		key = capi_get_key(ctx, id, ctx->cspname, ctx->csptype, ctx->keytype);
		key = capi_get_key(ctx, id, ctx->cspname, ctx->csptype,
							ctx->keytype);
		break;
		}

@@ -1416,7 +1427,8 @@ static int capi_ctx_set_provname(CAPI_CTX *ctx, LPSTR pname, DWORD type, int che
	if (check)
		{
		HCRYPTPROV hprov;
		if (!CryptAcquireContext(&hprov, NULL, pname, type, CRYPT_VERIFYCONTEXT))
		if (!CryptAcquireContext(&hprov, NULL, pname, type,
						CRYPT_VERIFYCONTEXT))
			{
			CAPIerr(CAPI_F_CAPI_CTX_SET_PROVNAME, CAPI_R_CRYPTACQUIRECONTEXT_ERROR);
			capi_addlasterror();