Skip to content
Snippets Groups Projects
Select Git revision
  • 8b14402e74bf5033dc83a6bd13c6e558ae4eda04
  • master default
  • dbck-q-n-d-link
  • foutput-text_stat-override
  • generations
  • text-stat-sha256
  • use-nettle
  • import-nettle
  • refactor-cached_get_text
  • refactor-cached_get_text-part-2
  • add-text_store
  • introduce-generation_position
  • remove-reclamation
  • dbfile-temp-filenames
  • sstrdup
  • dbfile_open_read-check-magic
  • adns_dist
  • liboop_dist
  • search
  • isc
  • dbdbckmultiplechoice
  • last.cvs.revision
  • 2.1.2
  • 2.1.1
  • 2.1.0
  • adns_1_0
  • liboop_0_9
  • 2.0.7
  • search_bp
  • 2.0.6
  • 2.0.5
  • isc_1_01
  • Protocol-A-10.4
  • 2.0.4
  • 2.0.3
  • 2.0.2
  • 2.0.1
  • 2.0.0
  • isc_1_00
  • isc_merge_1999_05_01
  • isc_merge_1999_04_21
41 results

text.c

Blame
  • dsa-keygen-test.c 1.59 KiB
    #include "testutils.h"
    
    #include "knuth-lfib.h"
    
    static void
    progress(void *ctx UNUSED, int c)
    {
      fputc(c, stderr);
    }
    
    void
    test_main(void)
    {
      struct dsa_public_key pub;
      struct dsa_private_key key;
      struct dsa_params *params;
    
      struct knuth_lfib_ctx lfib;
      
      dsa_private_key_init(&key);
      dsa_public_key_init(&pub);
    
      knuth_lfib_init(&lfib, 13);
    
      params = (struct dsa_params *) &pub;
      ASSERT (dsa_compat_generate_keypair(&pub, &key,
    			       &lfib,
    			       (nettle_random_func *) knuth_lfib_random,
    			       NULL, verbose ? progress : NULL,
    			       1024, 160));
    
      test_dsa_key(params, pub.y, key.x, 160);
      test_dsa160(&pub, &key, NULL);
    
      ASSERT (dsa_compat_generate_keypair(&pub, &key,
    			       &lfib,
    			       (nettle_random_func *) knuth_lfib_random,
    			       NULL, verbose ? progress : NULL,
    			       2048, 256));
    
      test_dsa_key(params, pub.y, key.x, 256);
      test_dsa256(&pub, &key, NULL);
      
      ASSERT (dsa_compat_generate_keypair(&pub, &key,
    			       &lfib,
    			       (nettle_random_func *) knuth_lfib_random,
    			       NULL, verbose ? progress : NULL,
    			       2048, 224));
    
      test_dsa_key(params, pub.y, key.x, 224);
      test_dsa256(&pub, &key, NULL);
    
      /* Test with large q */
      if (!dsa_generate_params (params,
    			    &lfib,
    			    (nettle_random_func *) knuth_lfib_random,
    			    NULL, verbose ? progress : NULL,
    			    1024, 768))
        FAIL();
    
      dsa_generate_keypair (params, pub.y, key.x,
    			&lfib,
    			(nettle_random_func *) knuth_lfib_random);
      test_dsa_key(params, pub.y, key.x, 768);
      test_dsa256(&pub, &key, NULL);
      
      dsa_public_key_clear(&pub);
      dsa_private_key_clear(&key);
    }