diff options
author | Nick Mathewson <nickm@torproject.org> | 2009-09-16 12:34:44 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2009-10-15 15:17:13 -0400 |
commit | 5576a3a094de49246e501bb24d1b3dc3a5d610b9 (patch) | |
tree | 2be0e6253bac147ad07baa989a967edca38528a4 /src/common/crypto.c | |
parent | 3b2fc659a8ef83feedadcda32de49db06b80af10 (diff) | |
download | tor-5576a3a094de49246e501bb24d1b3dc3a5d610b9.tar tor-5576a3a094de49246e501bb24d1b3dc3a5d610b9.tar.gz |
Parse detached signature documents with multiple flavors and algorithms.
Diffstat (limited to 'src/common/crypto.c')
-rw-r--r-- | src/common/crypto.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/common/crypto.c b/src/common/crypto.c index ac0e628c4..f335f99ab 100644 --- a/src/common/crypto.c +++ b/src/common/crypto.c @@ -1481,6 +1481,18 @@ crypto_digest_algorithm_get_name(digest_algorithm_t alg) } } +/** DOCDOC */ +int +crypto_digest_algorithm_parse_name(const char *name) +{ + if (!strcmp(name, "sha1")) + return DIGEST_SHA1; + else if (!strcmp(name, "sha256")) + return DIGEST_SHA256; + else + return -1; +} + /** Intermediate information about the digest of a stream of data. */ struct crypto_digest_env_t { union { |