*
* Copyright (C) 2013 Matt Corallo <git@bluematt.me>
*
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
+ * This file is part of ASSS (Audit-friendly Shamir's Secret Sharing)
*
- * This program is distributed in the hope it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
+ * ASSS is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of
+ * the License, or (at your option) any later version.
*
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place - Suite 330, Boston, MA 02111-1307 USA.
+ * ASSS is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public
+ * License along with ASSS. If not, see
+ * <http://www.gnu.org/licenses/>.
*/
#define _GNU_SOURCE
// TODO: The following loop may take a long time and eat lots of /dev/random if total_shares is high
for (uint32_t i = 0; i < total_shares; i++) {
- int32_t j = 0;
+ int32_t j = -1;
do {
assert(fread(&x[i], sizeof(uint8_t), 1, random) == 1);
if (x[i] == 0)
for (j = 0; j < i; j++)
if (x[j] == x[i])
break;
- } while (j < i); // Inner loop will get to j = i when x[j] != x[i] for all j
+ } while (j < (int32_t)i); // Inner loop will get to j = i when x[j] != x[i] for all j
if (i % 32 == 31)
printf("Finished picking X coordinates for %u shares\n", i+1);
}