summaryrefslogtreecommitdiffabout
authorMichael Krelin <hacker@klever.net>2008-02-19 10:51:12 (UTC)
committer Michael Krelin <hacker@klever.net>2008-02-19 10:51:12 (UTC)
commita3db32747e8370cab8cfdcc382fee875613b7b77 (patch) (unidiff)
tree2d11728a195a85907f06c3f920e405f1d1c769cd
parentc18b77c610d0f963a274420a6558629d198818ee (diff)
downloadlibopkele-a3db32747e8370cab8cfdcc382fee875613b7b77.zip
libopkele-a3db32747e8370cab8cfdcc382fee875613b7b77.tar.gz
libopkele-a3db32747e8370cab8cfdcc382fee875613b7b77.tar.bz2
use local array for hmac when calculating signature
Signed-off-by: Michael Krelin <hacker@klever.net>
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--lib/util.cc11
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/util.cc b/lib/util.cc
index b85a377..bb8a2e8 100644
--- a/lib/util.cc
+++ b/lib/util.cc
@@ -8,10 +8,12 @@
8#include <algorithm> 8#include <algorithm>
9#include <openssl/bio.h> 9#include <openssl/bio.h>
10#include <openssl/evp.h> 10#include <openssl/evp.h>
11#include <openssl/sha.h>
11#include <openssl/hmac.h> 12#include <openssl/hmac.h>
12#include <curl/curl.h> 13#include <curl/curl.h>
13#include "opkele/util.h" 14#include <opkele/util.h>
14#include "opkele/exception.h" 15#include <opkele/exception.h>
16#include <opkele/debug.h>
15 17
16#include <config.h> 18#include <config.h>
17#ifdef HAVE_DEMANGLE 19#ifdef HAVE_DEMANGLE
@@ -420,10 +422,11 @@ namespace opkele {
420 else 422 else
421 throw unsupported(OPKELE_CP_ "unknown association type"); 423 throw unsupported(OPKELE_CP_ "unknown association type");
422 unsigned int md_len = 0; 424 unsigned int md_len = 0;
423 unsigned char *md = HMAC(evpmd, 425 unsigned char md[SHA256_DIGEST_LENGTH];
426 HMAC(evpmd,
424 &(secret.front()),secret.size(), 427 &(secret.front()),secret.size(),
425 (const unsigned char*)kv.data(),kv.length(), 428 (const unsigned char*)kv.data(),kv.length(),
426 0,&md_len); 429 md,&md_len);
427 return encode_base64(md,md_len); 430 return encode_base64(md,md_len);
428 } 431 }
429 432