-/* $OpenBSD: crypto.c,v 1.64 2014/07/12 18:50:00 tedu Exp $ */
+/* $OpenBSD: crypto.c,v 1.65 2014/07/13 23:24:47 deraadt Exp $ */
/*
* The author of this code is Angelos D. Keromytis (angelos@cis.upenn.edu)
*
if (crypto_drivers_num == 0) {
crypto_drivers_num = CRYPTO_DRIVERS_INITIAL;
- crypto_drivers = malloc(crypto_drivers_num *
+ crypto_drivers = mallocarray(crypto_drivers_num,
sizeof(struct cryptocap), M_CRYPTO_DATA, M_NOWAIT);
if (crypto_drivers == NULL) {
crypto_drivers_num = 0;
return -1;
}
- newdrv = malloc(2 * crypto_drivers_num *
- sizeof(struct cryptocap), M_CRYPTO_DATA, M_NOWAIT);
+ newdrv = mallocarray(crypto_drivers_num,
+ 2 * sizeof(struct cryptocap), M_CRYPTO_DATA, M_NOWAIT);
if (newdrv == NULL) {
splx(s);
return -1;
-/* $OpenBSD: cryptosoft.c,v 1.70 2014/07/12 18:50:00 tedu Exp $ */
+/* $OpenBSD: cryptosoft.c,v 1.71 2014/07/13 23:24:47 deraadt Exp $ */
/*
* The author of this code is Angelos D. Keromytis (angelos@cis.upenn.edu)
} else
swcr_sesnum *= 2;
- swd = malloc(swcr_sesnum * sizeof(struct swcr_data *),
+ swd = mallocarray(swcr_sesnum, sizeof(struct swcr_data *),
M_CRYPTO_DATA, M_NOWAIT | M_ZERO);
if (swd == NULL) {
/* Reset session number */