diff options
| author | Karel Klic <kklic@redhat.com> | 2010-01-12 14:26:46 +0100 |
|---|---|---|
| committer | Karel Klic <kklic@redhat.com> | 2010-01-12 14:26:46 +0100 |
| commit | 745c2265e8e2c1c76288900811696478f0b04cfd (patch) | |
| tree | 6dffdb591b4e5677c0795d544670a64417f91862 /lib/Plugins/CCpp.cpp | |
| parent | 71fb2d7e690640b391b76b5432f07b4a81351c8b (diff) | |
| parent | 763b311bbfec96404f1d555347a33a1fad7f8995 (diff) | |
| download | abrt-745c2265e8e2c1c76288900811696478f0b04cfd.tar.gz abrt-745c2265e8e2c1c76288900811696478f0b04cfd.tar.xz abrt-745c2265e8e2c1c76288900811696478f0b04cfd.zip | |
Merge branch 'master' of ssh://git.fedorahosted.org/git/abrt
Diffstat (limited to 'lib/Plugins/CCpp.cpp')
| -rw-r--r-- | lib/Plugins/CCpp.cpp | 39 |
1 files changed, 32 insertions, 7 deletions
diff --git a/lib/Plugins/CCpp.cpp b/lib/Plugins/CCpp.cpp index 8b0c2b8..6c200d0 100644 --- a/lib/Plugins/CCpp.cpp +++ b/lib/Plugins/CCpp.cpp @@ -24,9 +24,8 @@ #include <sstream> #include <set> #include <iomanip> -#include <nss.h> -#include <sechash.h> -#include <sysexits.h> +//#include <nss.h> +//#include <sechash.h> #include "abrtlib.h" #include "CCpp.h" #include "ABRTException.h" @@ -34,6 +33,8 @@ #include "CommLayerInner.h" #include "Polkit.h" +#include "CCpp_sha1.h" + using namespace std; #define CORE_PATTERN_IFACE "/proc/sys/kernel/core_pattern" @@ -54,11 +55,13 @@ CAnalyzerCCpp::CAnalyzerCCpp() : static string CreateHash(const char *pInput) { - string ret; - HASHContext* hc; - unsigned char hash[SHA1_LENGTH]; unsigned int len; +#if 0 +{ + char hash_str[SHA1_LENGTH*2 + 1]; + unsigned char hash[SHA1_LENGTH]; + HASHContext *hc; hc = HASH_Create(HASH_AlgSHA1); if (!hc) { @@ -69,7 +72,6 @@ static string CreateHash(const char *pInput) HASH_End(hc, hash, &len, sizeof(hash)); HASH_Destroy(hc); - char hash_str[SHA1_LENGTH*2 + 1]; char *d = hash_str; unsigned char *s = hash; while (len) @@ -80,6 +82,29 @@ static string CreateHash(const char *pInput) len--; } *d = '\0'; +//log("hash1:%s str:'%s'", hash_str, pInput); +} +#endif + + char hash_str[SHA1_RESULT_LEN*2 + 1]; + unsigned char hash2[SHA1_RESULT_LEN]; + sha1_ctx_t sha1ctx; + sha1_begin(&sha1ctx); + sha1_hash(pInput, strlen(pInput), &sha1ctx); + sha1_end(hash2, &sha1ctx); + len = SHA1_RESULT_LEN; + + char *d = hash_str; + unsigned char *s = hash2; + while (len) + { + *d++ = "0123456789abcdef"[*s >> 4]; + *d++ = "0123456789abcdef"[*s & 0xf]; + s++; + len--; + } + *d = '\0'; +//log("hash2:%s str:'%s'", hash_str, pInput); return hash_str; } |
