aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChia-chi Yeh <chiachi@android.com>2009-09-18 17:26:30 +0800
committerChia-chi Yeh <chiachi@android.com>2009-09-18 17:41:19 +0800
commit4fa9505300a7249a6c216da88a3180a3a37ef078 (patch)
treee0a94999e0491bab162fe31b372f6d0b011a4d79
parent051f86dfca525c160855397f7b6a4fb5ef8df2b5 (diff)
downloadipsec-tools-eclair-sholes-release.tar.gz
-rw-r--r--main.c10
-rw-r--r--src/racoon/crypto_openssl.c14
2 files changed, 8 insertions, 16 deletions
diff --git a/main.c b/main.c
index 7947984..75e09f8 100644
--- a/main.c
+++ b/main.c
@@ -266,12 +266,10 @@ vchar_t *privsep_getpsk(const char *key, int size)
{
vchar_t *p = NULL;
#ifdef ANDROID_CHANGES
- char *value = keystore_get(key, &size);
- if (value) {
- if ((p = vmalloc(size)) != NULL) {
- memcpy(p->v, value, p->l);
- }
- free(value);
+ char value[KEYSTORE_MESSAGE_SIZE];
+ int length = keystore_get(key, value);
+ if (length != -1 && (p = vmalloc(length)) != NULL) {
+ memcpy(p->v, value, length);
}
#else
if (key && (p = vmalloc(size)) != NULL) {
diff --git a/src/racoon/crypto_openssl.c b/src/racoon/crypto_openssl.c
index 0ec53cf..77d9ee9 100644
--- a/src/racoon/crypto_openssl.c
+++ b/src/racoon/crypto_openssl.c
@@ -440,16 +440,10 @@ eay_cmp_asn1dn(n1, n2)
static BIO *BIO_from_keystore(char *key)
{
BIO *bio = NULL;
- char *value;
- int size;
-
- value = keystore_get(key, &size);
- if (value) {
- bio = BIO_new(BIO_s_mem());
- if (bio) {
- BIO_write(bio, value, size);
- }
- free(value);
+ char value[KEYSTORE_MESSAGE_SIZE];
+ int length = keystore_get(key, value);
+ if (length != -1 && (bio = BIO_new(BIO_s_mem())) != NULL) {
+ BIO_write(bio, value, length);
}
return bio;
}