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) (side-by-side diff)
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
@@ -5,16 +5,18 @@
#include <vector>
#include <string>
#include <stack>
#include <algorithm>
#include <openssl/bio.h>
#include <openssl/evp.h>
+#include <openssl/sha.h>
#include <openssl/hmac.h>
#include <curl/curl.h>
-#include "opkele/util.h"
-#include "opkele/exception.h"
+#include <opkele/util.h>
+#include <opkele/exception.h>
+#include <opkele/debug.h>
#include <config.h>
#ifdef HAVE_DEMANGLE
# include <cxxabi.h>
#endif
@@ -417,16 +419,17 @@ namespace opkele {
evpmd = EVP_sha256();
else if(at=="HMAC-SHA1")
evpmd = EVP_sha1();
else
throw unsupported(OPKELE_CP_ "unknown association type");
unsigned int md_len = 0;
- unsigned char *md = HMAC(evpmd,
+ unsigned char md[SHA256_DIGEST_LENGTH];
+ HMAC(evpmd,
&(secret.front()),secret.size(),
(const unsigned char*)kv.data(),kv.length(),
- 0,&md_len);
+ md,&md_len);
return encode_base64(md,md_len);
}
}
}