Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/crypto/external/bsd/openssl/dist/engines avoid an alloca for...
details: https://anonhg.NetBSD.org/src/rev/ceacb713958d
branches: trunk
changeset: 780511:ceacb713958d
user: christos <christos%NetBSD.org@localhost>
date: Fri Jul 27 18:35:57 2012 +0000
description:
avoid an alloca for SSP
diffstat:
crypto/external/bsd/openssl/dist/engines/e_padlock.c | 14 ++++++++++----
1 files changed, 10 insertions(+), 4 deletions(-)
diffs (47 lines):
diff -r 463c6d14c79b -r ceacb713958d crypto/external/bsd/openssl/dist/engines/e_padlock.c
--- a/crypto/external/bsd/openssl/dist/engines/e_padlock.c Fri Jul 27 18:34:35 2012 +0000
+++ b/crypto/external/bsd/openssl/dist/engines/e_padlock.c Fri Jul 27 18:35:57 2012 +0000
@@ -915,7 +915,7 @@
{
struct padlock_cipher_data *cdata;
const void *inp;
- unsigned char *out;
+ unsigned char *out, *tofree;
void *iv;
int inp_misaligned, out_misaligned, realign_in_loop;
size_t chunk, allocated=0;
@@ -999,11 +999,15 @@
if (out_misaligned) {
/* optmize for small input */
allocated = (chunk<nbytes?PADLOCK_CHUNK:nbytes);
- out = alloca(0x10 + allocated);
- out = NEAREST_ALIGNED(out);
+ tofree = malloc(0x10 + allocated);
+ if (tofree == NULL)
+ return 0;
+ out = NEAREST_ALIGNED(tofree);
}
- else
+ else {
out = out_arg;
+ tofree = NULL;
+ }
cdata = ALIGNED_CIPHER_DATA(ctx);
padlock_verify_context(cdata);
@@ -1152,6 +1156,7 @@
break;
default:
+ free(tofree);
return 0;
}
@@ -1163,6 +1168,7 @@
}
memset(cdata->iv, 0, AES_BLOCK_SIZE);
+ free(tofree);
return 1;
}
Home |
Main Index |
Thread Index |
Old Index