store32_le(out + i*4, buffer[i ]); // constant
store32_le(out + 16 + i*4, buffer[i + 12]); // counter and nonce
}
+ // Wipe buffer
+ volatile u32 *v_buffer = buffer;
+ FOR (i, 0, 16) {
+ v_buffer[i] = 0;
+ }
}
void crypto_chacha20_init(crypto_chacha_ctx *ctx,
FOR (i, 0, 8) {
ctx->hash[i] ^= v[i] ^ v[i+8];
}
+ // Wipe v
+ volatile u64 *vv = v;
+ FOR (i, 0, 16) {
+ vv[i] = 0;
+ }
}
static void blake2b_reset_input(crypto_blake2b_ctx *ctx)
modL(signature + 32, s); // second half of the signature = s
crypto_wipe(ctx, sizeof(*ctx));
+ crypto_wipe(h_ram, 64);
}
void crypto_sign(u8 signature[64],
crypto_chacha20_x_init(&(ctx->chacha), key, nonce);
crypto_chacha20_stream(&(ctx->chacha), auth_key, 32);
crypto_poly1305_init (&(ctx->poly ), auth_key);
+ crypto_wipe(auth_key, 32);
}
void crypto_lock_encrypt(crypto_lock_ctx *ctx, u8 *cipher_text,