]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Use calloc, not malloc(a*b), in ed25519 batch signature check fn
authorNick Mathewson <nickm@torproject.org>
Wed, 25 May 2016 12:59:08 +0000 (08:59 -0400)
committerNick Mathewson <nickm@torproject.org>
Wed, 25 May 2016 12:59:08 +0000 (08:59 -0400)
[Not a triggerable bug unless somebody is going to go checking
millions+ of signatures in a single go.]

src/common/crypto_ed25519.c

index c687a1b24644fa09424e8502a38432960a174e2a..84c3eece6d064fb9bd1c533721d22b7787b8999b 100644 (file)
@@ -259,11 +259,11 @@ ed25519_checksig_batch(int *okay_out,
     int *oks;
     int all_ok;
 
-    ms = tor_malloc(sizeof(uint8_t*)*n_checkable);
-    lens = tor_malloc(sizeof(size_t)*n_checkable);
-    pks = tor_malloc(sizeof(uint8_t*)*n_checkable);
-    sigs = tor_malloc(sizeof(uint8_t*)*n_checkable);
-    oks = okay_out ? okay_out : tor_malloc(sizeof(int)*n_checkable);
+    ms = tor_calloc(n_checkable, sizeof(uint8_t*));
+    lens = tor_calloc(n_checkable, sizeof(size_t));
+    pks = tor_calloc(n_checkable, sizeof(uint8_t*));
+    sigs = tor_calloc(n_checkable, sizeof(uint8_t*));
+    oks = okay_out ? okay_out : tor_calloc(n_checkable, sizeof(int));
 
     for (i = 0; i < n_checkable; ++i) {
       ms[i] = checkable[i].msg;