summaryrefslogtreecommitdiff
path: root/src/common/crypto.h
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2004-05-01 20:46:28 +0000
committerNick Mathewson <nickm@torproject.org>2004-05-01 20:46:28 +0000
commit908ccb9dcdff19c6015a31726d2db5db5fef3ede (patch)
tree087a63bb6c490291ec12ae4f2e6f5c3dfc984ca4 /src/common/crypto.h
parentac4cb9bdd19bee938d1cb4cb9def727f92c8d2fc (diff)
downloadtor-908ccb9dcdff19c6015a31726d2db5db5fef3ede.tar.gz
tor-908ccb9dcdff19c6015a31726d2db5db5fef3ede.zip
Handle windows socket errors correctly; comment most of common.
svn:r1756
Diffstat (limited to 'src/common/crypto.h')
-rw-r--r--src/common/crypto.h19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/common/crypto.h b/src/common/crypto.h
index 510954a852..d867d4d601 100644
--- a/src/common/crypto.h
+++ b/src/common/crypto.h
@@ -7,21 +7,29 @@
#include <stdio.h>
+/* Length of the output of our message digest. */
#define DIGEST_LEN 20
+/* Length of our symmetric cipher's keys. */
#define CIPHER_KEY_LEN 16
-#define PK_BITS 1024
-#define PK_BYTES (PK_BITS/8)
-#define DH_BITS 1024
-#define DH_BYTES (DH_BITS/8)
-#define CRYPTO_DH_SIZE DH_BYTES
+/* Length of our public keys. */
+#define PK_BYTES (1024/8)
+/* Length of our DH keys. */
+#define DH_BYTES (1024/8)
+/* Constants used to indicate disired public-key padding functions. */
#define PK_NO_PADDING 60000
#define PK_PKCS1_PADDING 60001
#define PK_PKCS1_OAEP_PADDING 60002
+/* Bytes added for PKCS1 padding. */
#define PKCS1_PADDING_OVERHEAD 11
+/* Bytes added for PKCS1-OAEP padding. */
#define PKCS1_OAEP_PADDING_OVERHEAD 42
+/* Length of encoded public key fingerprints, including space and NUL. */
+#define FINGERPRINT_LEN 49
+
+
typedef struct crypto_pk_env_t crypto_pk_env_t;
typedef struct crypto_cipher_env_t crypto_cipher_env_t;
typedef struct crypto_digest_env_t crypto_digest_env_t;
@@ -64,7 +72,6 @@ int crypto_pk_private_hybrid_decrypt(crypto_pk_env_t *env,
const unsigned char *from, int fromlen,
unsigned char *to,int padding);
-#define FINGERPRINT_LEN 49
int crypto_pk_asn1_encode(crypto_pk_env_t *pk, char *dest, int dest_len);
crypto_pk_env_t *crypto_pk_asn1_decode(const char *str, int len);
int crypto_pk_get_digest(crypto_pk_env_t *pk, char *digest_out);