diff options
author | Stef Walter <stefw@gnome.org> | 2013-03-20 08:59:49 +0100 |
---|---|---|
committer | Stef Walter <stefw@gnome.org> | 2013-03-20 09:31:50 +0100 |
commit | 1dc227b4fce16fcc721276925492f4ba4db00b4f (patch) | |
tree | 1a0b070061e27e967c07208f2f21891c29969986 /trust | |
parent | ef8c54a355d3f9814cc53a0aad72d61247b169a0 (diff) |
hash: Rename file and functions for hashes
We're going to be adding other hashes. Also build as part of a
different common library.
Diffstat (limited to 'trust')
-rw-r--r-- | trust/builder.c | 16 | ||||
-rw-r--r-- | trust/parser.c | 4 | ||||
-rw-r--r-- | trust/tests/test-builder.c | 6 | ||||
-rw-r--r-- | trust/tests/test-module.c | 10 |
4 files changed, 18 insertions, 18 deletions
diff --git a/trust/builder.c b/trust/builder.c index 85abe5b..f4ababa 100644 --- a/trust/builder.c +++ b/trust/builder.c @@ -40,9 +40,9 @@ #include "asn1.h" #include "attrs.h" #include "builder.h" -#include "checksum.h" #include "constants.h" #include "debug.h" +#include "hash.h" #include "index.h" #include "library.h" #include "oid.h" @@ -222,8 +222,8 @@ calc_check_value (const unsigned char *data, size_t length, CK_BYTE *check_value) { - unsigned char checksum[P11_CHECKSUM_SHA1_LENGTH]; - p11_checksum_sha1 (checksum, data, length, NULL); + unsigned char checksum[P11_HASH_SHA1_LEN]; + p11_hash_sha1 (checksum, data, length, NULL); memcpy (check_value, checksum, 3); } @@ -412,7 +412,7 @@ certificate_value_attrs (CK_ATTRIBUTE *attrs, const unsigned char *der, size_t der_len) { - unsigned char checksum[P11_CHECKSUM_SHA1_LENGTH]; + unsigned char checksum[P11_HASH_SHA1_LEN]; CK_BBOOL falsev = CK_FALSE; CK_ULONG zero = 0UL; CK_BYTE checkv[3]; @@ -1057,8 +1057,8 @@ replace_nss_trust_object (p11_builder *builder, CK_RV rv; CK_OBJECT_CLASS klassv = CKO_NSS_TRUST; - CK_BYTE sha1v[P11_CHECKSUM_SHA1_LENGTH]; - CK_BYTE md5v[P11_CHECKSUM_MD5_LENGTH]; + CK_BYTE sha1v[P11_HASH_SHA1_LEN]; + CK_BYTE md5v[P11_HASH_MD5_LEN]; CK_BBOOL generatedv = CK_FALSE; CK_BBOOL falsev = CK_FALSE; @@ -1094,8 +1094,8 @@ replace_nss_trust_object (p11_builder *builder, md5_hash.type = CKA_INVALID; sha1_hash.type = CKA_INVALID; } else { - p11_checksum_md5 (md5v, value, length, NULL); - p11_checksum_sha1 (sha1v, value, length, NULL); + p11_hash_md5 (md5v, value, length, NULL); + p11_hash_sha1 (sha1v, value, length, NULL); } if (!issuer) issuer = &invalid; diff --git a/trust/parser.c b/trust/parser.c index 42d74fc..91fd5e8 100644 --- a/trust/parser.c +++ b/trust/parser.c @@ -37,10 +37,10 @@ #include "array.h" #include "asn1.h" #include "attrs.h" -#include "checksum.h" #define P11_DEBUG_FLAG P11_DEBUG_TRUST #include "debug.h" #include "dict.h" +#include "hash.h" #include "library.h" #include "module.h" #include "oid.h" @@ -71,7 +71,7 @@ struct _p11_parser { int flags; }; -#define ID_LENGTH P11_CHECKSUM_SHA1_LENGTH +#define ID_LENGTH P11_HASH_SHA1_LEN typedef int (* parser_func) (p11_parser *parser, const unsigned char *data, diff --git a/trust/tests/test-builder.c b/trust/tests/test-builder.c index 536d7dc..bbc731a 100644 --- a/trust/tests/test-builder.c +++ b/trust/tests/test-builder.c @@ -41,7 +41,7 @@ #include "attrs.h" #include "builder.h" -#include "checksum.h" +#include "hash.h" #include "debug.h" #include "index.h" #include "library.h" @@ -187,7 +187,7 @@ test_build_certificate (CuTest *cu) static void test_build_certificate_empty (CuTest *cu) { - unsigned char checksum[P11_CHECKSUM_SHA1_LENGTH]; + unsigned char checksum[P11_HASH_SHA1_LEN]; CK_ULONG domain = 0; CK_ULONG category = 0; @@ -225,7 +225,7 @@ test_build_certificate_empty (CuTest *cu) setup (cu); - p11_checksum_sha1 (checksum, test_cacert3_ca_der, sizeof (test_cacert3_ca_der), NULL); + p11_hash_sha1 (checksum, test_cacert3_ca_der, sizeof (test_cacert3_ca_der), NULL); attrs = NULL; merge = p11_attrs_dup (input); diff --git a/trust/tests/test-module.c b/trust/tests/test-module.c index 57df78e..1d97f9b 100644 --- a/trust/tests/test-module.c +++ b/trust/tests/test-module.c @@ -42,8 +42,8 @@ #define CRYPTOKI_EXPORTS #include "attrs.h" -#include "checksum.h" #include "debug.h" +#include "hash.h" #include "library.h" #include "pkcs11x.h" #include "test-data.h" @@ -385,8 +385,8 @@ check_trust_object_hashes (CuTest *cu, CK_OBJECT_HANDLE trust, CK_ATTRIBUTE *cert) { - unsigned char sha1[P11_CHECKSUM_SHA1_LENGTH]; - unsigned char md5[P11_CHECKSUM_MD5_LENGTH]; + unsigned char sha1[P11_HASH_SHA1_LEN]; + unsigned char md5[P11_HASH_MD5_LEN]; unsigned char check[128]; CK_ATTRIBUTE *value; CK_RV rv; @@ -403,10 +403,10 @@ check_trust_object_hashes (CuTest *cu, value = p11_attrs_find_valid (cert, CKA_VALUE); CuAssertPtrNotNull (cu, value); - p11_checksum_md5 (check, value->pValue, value->ulValueLen, NULL); + p11_hash_md5 (check, value->pValue, value->ulValueLen, NULL); CuAssertTrue (cu, memcmp (md5, check, sizeof (md5)) == 0); - p11_checksum_sha1 (check, value->pValue, value->ulValueLen, NULL); + p11_hash_sha1 (check, value->pValue, value->ulValueLen, NULL); CuAssertTrue (cu, memcmp (sha1, check, sizeof (sha1)) == 0); } |