[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [tor/master] Move crypto_add_spaces_to_fp() to crypto_rsa.c
commit 8e2df9886003c12b0624c54b950090c8fc36396b
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date: Wed Jul 11 13:51:26 2018 -0400
Move crypto_add_spaces_to_fp() to crypto_rsa.c
---
src/lib/crypt_ops/crypto.c | 20 --------------------
src/lib/crypt_ops/crypto.h | 2 --
src/lib/crypt_ops/crypto_rsa.c | 20 ++++++++++++++++++++
src/lib/crypt_ops/crypto_rsa.h | 1 +
4 files changed, 21 insertions(+), 22 deletions(-)
diff --git a/src/lib/crypt_ops/crypto.c b/src/lib/crypt_ops/crypto.c
index d988473f4..e4f092c80 100644
--- a/src/lib/crypt_ops/crypto.c
+++ b/src/lib/crypt_ops/crypto.c
@@ -129,26 +129,6 @@ crypto_cipher_free_(crypto_cipher_t *env)
aes_cipher_free(env);
}
-/** Copy <b>in</b> to the <b>outlen</b>-byte buffer <b>out</b>, adding spaces
- * every four characters. */
-void
-crypto_add_spaces_to_fp(char *out, size_t outlen, const char *in)
-{
- int n = 0;
- char *end = out+outlen;
- tor_assert(outlen < SIZE_T_CEILING);
-
- while (*in && out<end) {
- *out++ = *in++;
- if (++n == 4 && *in && out<end) {
- n = 0;
- *out++ = ' ';
- }
- }
- tor_assert(out<end);
- *out = '\0';
-}
-
/* symmetric crypto */
/** Encrypt <b>fromlen</b> bytes from <b>from</b> using the cipher
diff --git a/src/lib/crypt_ops/crypto.h b/src/lib/crypt_ops/crypto.h
index 6034c8417..993a65fb0 100644
--- a/src/lib/crypt_ops/crypto.h
+++ b/src/lib/crypt_ops/crypto.h
@@ -59,6 +59,4 @@ int crypto_cipher_decrypt_with_iv(const char *key,
char *to, size_t tolen,
const char *from, size_t fromlen);
-void crypto_add_spaces_to_fp(char *out, size_t outlen, const char *in);
-
#endif /* !defined(TOR_CRYPTO_H) */
diff --git a/src/lib/crypt_ops/crypto_rsa.c b/src/lib/crypt_ops/crypto_rsa.c
index 5ec69d731..f0fd6d5f4 100644
--- a/src/lib/crypt_ops/crypto_rsa.c
+++ b/src/lib/crypt_ops/crypto_rsa.c
@@ -976,6 +976,26 @@ crypto_pk_get_hashed_fingerprint(crypto_pk_t *pk, char *fp_out)
return 0;
}
+/** Copy <b>in</b> to the <b>outlen</b>-byte buffer <b>out</b>, adding spaces
+ * every four characters. */
+void
+crypto_add_spaces_to_fp(char *out, size_t outlen, const char *in)
+{
+ int n = 0;
+ char *end = out+outlen;
+ tor_assert(outlen < SIZE_T_CEILING);
+
+ while (*in && out<end) {
+ *out++ = *in++;
+ if (++n == 4 && *in && out<end) {
+ n = 0;
+ *out++ = ' ';
+ }
+ }
+ tor_assert(out<end);
+ *out = '\0';
+}
+
/** Check a siglen-byte long signature at <b>sig</b> against
* <b>datalen</b> bytes of data at <b>data</b>, using the public key
* in <b>env</b>. Return 0 if <b>sig</b> is a correct signature for
diff --git a/src/lib/crypt_ops/crypto_rsa.h b/src/lib/crypt_ops/crypto_rsa.h
index 51fc97482..c70e01c3f 100644
--- a/src/lib/crypt_ops/crypto_rsa.h
+++ b/src/lib/crypt_ops/crypto_rsa.h
@@ -88,6 +88,7 @@ int crypto_pk_asn1_encode(const crypto_pk_t *pk, char *dest, size_t dest_len);
crypto_pk_t *crypto_pk_asn1_decode(const char *str, size_t len);
int crypto_pk_get_fingerprint(crypto_pk_t *pk, char *fp_out,int add_space);
int crypto_pk_get_hashed_fingerprint(crypto_pk_t *pk, char *fp_out);
+void crypto_add_spaces_to_fp(char *out, size_t outlen, const char *in);
MOCK_DECL(int, crypto_pk_public_checksig_digest,(crypto_pk_t *env,
const char *data, size_t datalen, const char *sig, size_t siglen));
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits