out.patch

Vit Ondruch, 05/14/2013 06:45 PM

Download (2.3 KB)

View differences:

ext/openssl/ossl_pkey_ec.c
762 762
                method = EC_GFp_mont_method();
763 763
            } else if (id == s_GFp_nist) {
764 764
                method = EC_GFp_nist_method();
765
#if !defined(OPENSSL_NO_EC2M)
765 766
            } else if (id == s_GF2m_simple) {
766 767
                method = EC_GF2m_simple_method();
768
#endif
767 769
            }
768 770

  
769 771
            if (method) {
......
817 819

  
818 820
            if (id == s_GFp) {
819 821
                new_curve = EC_GROUP_new_curve_GFp;
822
#if !defined(OPENSSL_NO_EC2M)
820 823
            } else if (id == s_GF2m) {
821 824
                new_curve = EC_GROUP_new_curve_GF2m;
825
#endif
822 826
            } else {
823 827
                ossl_raise(rb_eArgError, "unknown symbol, must be :GFp or :GF2m");
824 828
            }
test/openssl/test_pkey_ec.rb
7 7
    @data1 = 'foo'
8 8
    @data2 = 'bar' * 1000 # data too long for DSA sig
9 9

  
10
    @group1 = OpenSSL::PKey::EC::Group.new('secp112r1')
11
    @group2 = OpenSSL::PKey::EC::Group.new('sect163k1')
12
    @group3 = OpenSSL::PKey::EC::Group.new('prime256v1')
10
    @groups = []
11
    @keys = []
13 12

  
14
    @key1 = OpenSSL::PKey::EC.new
15
    @key1.group = @group1
16
    @key1.generate_key
13
    OpenSSL::PKey::EC.builtin_curves.each do |curve, comment|
14
      group = OpenSSL::PKey::EC::Group.new(curve)
17 15

  
18
    @key2 = OpenSSL::PKey::EC.new(@group2.curve_name)
19
    @key2.generate_key
16
      key = OpenSSL::PKey::EC.new(group)
17
      key.generate_key
20 18

  
21
    @key3 = OpenSSL::PKey::EC.new(@group3)
22
    @key3.generate_key
23

  
24
    @groups = [@group1, @group2, @group3]
25
    @keys = [@key1, @key2, @key3]
19
      @groups << group
20
      @keys << key
21
    end
26 22
  end
27 23

  
28 24
  def compare_keys(k1, k2)
29 25
    assert_equal(k1.to_pem, k2.to_pem)
30 26
  end
31 27

  
28
  def test_builtin_curves
29
    assert(!OpenSSL::PKey::EC.builtin_curves.empty?)
30
  end
31

  
32 32
  def test_curve_names
33 33
    @groups.each_with_index do |group, idx|
34 34
      key = @keys[idx]