Implement fixed-window exponentiation to mitigate hyper-threading
[openssl.git] / crypto / dh / dhtest.c
index 1b193649d3d544173f196f27fc6f5c0f1edc4405..882f5c310a79b0931b0239fa8589bf033aaadd60 100644 (file)
@@ -145,6 +145,10 @@ int main(int argc, char *argv[])
        b->g=BN_dup(a->g);
        if ((b->p == NULL) || (b->g == NULL)) goto err;
 
+       /* Set a to run with normal modexp and b to use constant time */
+       a->flags &= ~DH_FLAG_NO_EXP_CONSTTIME;
+       b->flags |= DH_FLAG_NO_EXP_CONSTTIME;
+
        if (!DH_generate_key(a)) goto err;
        BIO_puts(out,"pri 1=");
        BN_print(out,a->priv_key);