aboutsummaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2012-03-27 17:57:18 -0400
committerNick Mathewson <nickm@torproject.org>2012-03-27 22:38:06 -0400
commit01905a6ef9f00705e9db95cf134f1a08787ab92f (patch)
tree1a8c42aecee77f23cbe6eaf46ae5029d765532d0 /src/common
parent55c3e29669214e7a51b16c7273caf30b29079157 (diff)
downloadtor-01905a6ef9f00705e9db95cf134f1a08787ab92f.tar
tor-01905a6ef9f00705e9db95cf134f1a08787ab92f.tar.gz
Excise PK_NO_PADDING entirely: Unpadded RSA is silly.
We never use it, so having it around is pointless. Suggested by Sebastian
Diffstat (limited to 'src/common')
-rw-r--r--src/common/crypto.c5
-rw-r--r--src/common/crypto.h6
2 files changed, 2 insertions, 9 deletions
diff --git a/src/common/crypto.c b/src/common/crypto.c
index 2bd2e1e4d..e79666f95 100644
--- a/src/common/crypto.c
+++ b/src/common/crypto.c
@@ -140,7 +140,6 @@ crypto_get_rsa_padding_overhead(int padding)
{
switch (padding)
{
- case RSA_NO_PADDING: return 0;
case RSA_PKCS1_OAEP_PADDING: return 42;
case RSA_PKCS1_PADDING: return 11;
default: tor_assert(0); return -1;
@@ -154,7 +153,6 @@ crypto_get_rsa_padding(int padding)
{
switch (padding)
{
- case PK_NO_PADDING: return RSA_NO_PADDING;
case PK_PKCS1_PADDING: return RSA_PKCS1_PADDING;
case PK_PKCS1_OAEP_PADDING: return RSA_PKCS1_OAEP_PADDING;
default: tor_assert(0); return -1;
@@ -991,8 +989,6 @@ crypto_pk_private_sign_digest(crypto_pk_t *env, char *to, size_t tolen,
* bytes of data from <b>from</b>, with padding type 'padding',
* storing the results on <b>to</b>.
*
- * (Padding is required; the PK_NO_PADDING value is not supported.)
- *
* Returns the number of bytes written on success, -1 on failure.
*
* The encrypted data consists of:
@@ -1019,7 +1015,6 @@ crypto_pk_public_hybrid_encrypt(crypto_pk_t *env,
tor_assert(from);
tor_assert(to);
tor_assert(fromlen < SIZE_T_CEILING);
- tor_assert(padding != PK_NO_PADDING);
overhead = crypto_get_rsa_padding_overhead(crypto_get_rsa_padding(padding));
pkeylen = crypto_pk_keysize(env);
diff --git a/src/common/crypto.h b/src/common/crypto.h
index 00ac26ba2..0482e1af6 100644
--- a/src/common/crypto.h
+++ b/src/common/crypto.h
@@ -69,11 +69,9 @@
* signs removed. */
#define BASE64_DIGEST256_LEN 43
-/** Constants used to indicate no padding for public-key encryption */
-#define PK_NO_PADDING 60000
-/** Constants used to indicate PKCS1 padding for public-key encryption */
+/** Constant used to indicate PKCS1 padding for public-key encryption */
#define PK_PKCS1_PADDING 60001
-/** Constants used to indicate OAEP padding for public-key encryption */
+/** Constant used to indicate OAEP padding for public-key encryption */
#define PK_PKCS1_OAEP_PADDING 60002
/** Number of bytes added for PKCS1 padding. */