[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] fix formatting in crypto.c for my sanity
Update of /home/or/cvsroot/src/common
In directory moria.mit.edu:/home2/arma/work/onion/cvs/src/common
Modified Files:
crypto.c
Log Message:
fix formatting in crypto.c for my sanity
Index: crypto.c
===================================================================
RCS file: /home/or/cvsroot/src/common/crypto.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -d -r1.29 -r1.30
--- crypto.c 12 Aug 2003 03:08:40 -0000 1.29
+++ crypto.c 25 Aug 2003 07:06:12 -0000 1.30
@@ -115,16 +115,15 @@
switch(type) {
case CRYPTO_PK_RSA:
- env->key = (unsigned char *)RSA_new();
- if (!env->key) {
- free((void *)env);
- return NULL;
- }
- break;
+ env->key = (unsigned char *)RSA_new();
+ if (!env->key) {
+ free(env);
+ return NULL;
+ }
+ break;
default:
- free((void *)env);
- return NULL;
- break;
+ free(env);
+ return NULL;
}
return env;
@@ -139,15 +138,14 @@
switch(env->type) {
case CRYPTO_PK_RSA:
- if (env->key)
- RSA_free((RSA *)env->key);
- break;
+ if (env->key)
+ RSA_free((RSA *)env->key);
+ break;
default:
- break;
+ break;
}
- free((void *)env);
- return;
+ free(env);
}
@@ -429,13 +427,13 @@
switch(env->type) {
case CRYPTO_PK_RSA:
- if (!env->key)
- return -1;
- if (PEM_write_RSAPrivateKey(dest, (RSA *)env->key, NULL, NULL, 0,0, NULL) == 0)
- return -1;
- break;
+ if (!env->key)
+ return -1;
+ if (PEM_write_RSAPrivateKey(dest, (RSA *)env->key, NULL, NULL, 0,0, NULL) == 0)
+ return -1;
+ break;
default :
- return -1;
+ return -1;
}
return 0;
@@ -446,13 +444,13 @@
switch(env->type) {
case CRYPTO_PK_RSA:
- if (!env->key)
- return -1;
- if (PEM_write_RSAPublicKey(dest, (RSA *)env->key) == 0)
- return -1;
- break;
+ if (!env->key)
+ return -1;
+ if (PEM_write_RSAPublicKey(dest, (RSA *)env->key) == 0)
+ return -1;
+ break;
default :
- return -1;
+ return -1;
}
return 0;
@@ -484,13 +482,13 @@
switch(a->type) {
case CRYPTO_PK_RSA:
- assert(((RSA *)a->key)->n && ((RSA *)a->key)->e && ((RSA *)b->key)->n && ((RSA *)b->key)->e);
- result = BN_cmp(((RSA *)a->key)->n, ((RSA *)b->key)->n);
- if (result)
- return result;
- return BN_cmp(((RSA *)a->key)->e, ((RSA *)b->key)->e);
+ assert(((RSA *)a->key)->n && ((RSA *)a->key)->e && ((RSA *)b->key)->n && ((RSA *)b->key)->e);
+ result = BN_cmp(((RSA *)a->key)->n, ((RSA *)b->key)->n);
+ if (result)
+ return result;
+ return BN_cmp(((RSA *)a->key)->e, ((RSA *)b->key)->e);
default:
- return -1;
+ return -1;
}
}
@@ -521,9 +519,9 @@
switch(env->type) {
case CRYPTO_PK_RSA:
- return RSA_public_encrypt(fromlen, from, to, (RSA *)env->key, padding);
+ return RSA_public_encrypt(fromlen, from, to, (RSA *)env->key, padding);
default:
- return -1;
+ return -1;
}
}
@@ -532,12 +530,12 @@
assert(env && from && to);
switch(env->type) {
- case CRYPTO_PK_RSA:
- if (!(((RSA*)env->key)->p))
- return -1;
- return RSA_private_decrypt(fromlen, from, to, (RSA *)env->key, padding);
+ case CRYPTO_PK_RSA:
+ if (!(((RSA*)env->key)->p))
+ return -1;
+ return RSA_private_decrypt(fromlen, from, to, (RSA *)env->key, padding);
default:
- return -1;
+ return -1;
}
}
@@ -546,11 +544,11 @@
assert(env && from && to);
switch(env->type) {
- case CRYPTO_PK_RSA:
- return RSA_public_decrypt(fromlen, from, to, (RSA *)env->key,
+ case CRYPTO_PK_RSA:
+ return RSA_public_decrypt(fromlen, from, to, (RSA *)env->key,
RSA_PKCS1_PADDING);
default:
- return -1;
+ return -1;
}
}
@@ -559,13 +557,13 @@
assert(env && from && to);
switch(env->type) {
- case CRYPTO_PK_RSA:
- if (!(((RSA*)env->key)->p))
- return -1;
- return RSA_private_encrypt(fromlen, from, to, (RSA *)env->key,
+ case CRYPTO_PK_RSA:
+ if (!(((RSA*)env->key)->p))
+ return -1;
+ return RSA_private_encrypt(fromlen, from, to, (RSA *)env->key,
RSA_PKCS1_PADDING);
default:
- return -1;
+ return -1;
}
}