diff options
Diffstat (limited to 'src/lib/libcrypto/dsa')
-rw-r--r-- | src/lib/libcrypto/dsa/Makefile | 173 | ||||
-rw-r--r-- | src/lib/libcrypto/dsa/Makefile.ssl | 171 | ||||
-rw-r--r-- | src/lib/libcrypto/dsa/README | 4 | ||||
-rw-r--r-- | src/lib/libcrypto/dsa/dsa.h | 14 | ||||
-rw-r--r-- | src/lib/libcrypto/dsa/dsa_err.c | 42 | ||||
-rw-r--r-- | src/lib/libcrypto/dsa/dsa_key.c | 16 | ||||
-rw-r--r-- | src/lib/libcrypto/dsa/dsa_ossl.c | 55 | ||||
-rw-r--r-- | src/lib/libcrypto/dsa/dsa_sign.c | 6 | ||||
-rw-r--r-- | src/lib/libcrypto/dsa/dsa_vrf.c | 3 | ||||
-rw-r--r-- | src/lib/libcrypto/dsa/dsagen.c | 111 | ||||
-rw-r--r-- | src/lib/libcrypto/dsa/dsatest.c | 242 | ||||
-rw-r--r-- | src/lib/libcrypto/dsa/fips186a.txt | 122 |
12 files changed, 858 insertions, 101 deletions
diff --git a/src/lib/libcrypto/dsa/Makefile b/src/lib/libcrypto/dsa/Makefile new file mode 100644 index 0000000000..4f10278039 --- /dev/null +++ b/src/lib/libcrypto/dsa/Makefile | |||
@@ -0,0 +1,173 @@ | |||
1 | # | ||
2 | # OpenSSL/crypto/dsa/Makefile | ||
3 | # | ||
4 | |||
5 | DIR= dsa | ||
6 | TOP= ../.. | ||
7 | CC= cc | ||
8 | INCLUDES= -I.. -I$(TOP) -I../../include | ||
9 | CFLAG=-g | ||
10 | INSTALL_PREFIX= | ||
11 | OPENSSLDIR= /usr/local/ssl | ||
12 | INSTALLTOP=/usr/local/ssl | ||
13 | MAKEDEPPROG= makedepend | ||
14 | MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG) | ||
15 | MAKEFILE= Makefile | ||
16 | AR= ar r | ||
17 | |||
18 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
19 | |||
20 | GENERAL=Makefile | ||
21 | TEST=dsatest.c | ||
22 | APPS= | ||
23 | |||
24 | LIB=$(TOP)/libcrypto.a | ||
25 | LIBSRC= dsa_gen.c dsa_key.c dsa_lib.c dsa_asn1.c dsa_vrf.c dsa_sign.c \ | ||
26 | dsa_err.c dsa_ossl.c | ||
27 | LIBOBJ= dsa_gen.o dsa_key.o dsa_lib.o dsa_asn1.o dsa_vrf.o dsa_sign.o \ | ||
28 | dsa_err.o dsa_ossl.o | ||
29 | |||
30 | SRC= $(LIBSRC) | ||
31 | |||
32 | EXHEADER= dsa.h | ||
33 | HEADER= $(EXHEADER) | ||
34 | |||
35 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
36 | |||
37 | top: | ||
38 | (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) | ||
39 | |||
40 | all: lib | ||
41 | |||
42 | lib: $(LIBOBJ) | ||
43 | $(AR) $(LIB) $(LIBOBJ) | ||
44 | $(RANLIB) $(LIB) || echo Never mind. | ||
45 | @touch lib | ||
46 | |||
47 | files: | ||
48 | $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO | ||
49 | |||
50 | links: | ||
51 | @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER) | ||
52 | @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST) | ||
53 | @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS) | ||
54 | |||
55 | install: | ||
56 | @headerlist="$(EXHEADER)"; for i in $$headerlist ; \ | ||
57 | do \ | ||
58 | (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \ | ||
59 | chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \ | ||
60 | done; | ||
61 | |||
62 | tags: | ||
63 | ctags $(SRC) | ||
64 | |||
65 | tests: | ||
66 | |||
67 | lint: | ||
68 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
69 | |||
70 | depend: | ||
71 | $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC) | ||
72 | |||
73 | dclean: | ||
74 | $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
75 | mv -f Makefile.new $(MAKEFILE) | ||
76 | |||
77 | clean: | ||
78 | rm -f *.o */*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
79 | |||
80 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
81 | |||
82 | dsa_asn1.o: ../../e_os.h ../../include/openssl/asn1.h | ||
83 | dsa_asn1.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h | ||
84 | dsa_asn1.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
85 | dsa_asn1.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h | ||
86 | dsa_asn1.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
87 | dsa_asn1.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
88 | dsa_asn1.o: ../../include/openssl/opensslconf.h | ||
89 | dsa_asn1.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
90 | dsa_asn1.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
91 | dsa_asn1.o: ../../include/openssl/symhacks.h ../cryptlib.h dsa_asn1.c | ||
92 | dsa_err.o: ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
93 | dsa_err.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h | ||
94 | dsa_err.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
95 | dsa_err.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
96 | dsa_err.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
97 | dsa_err.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h | ||
98 | dsa_err.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
99 | dsa_err.o: dsa_err.c | ||
100 | dsa_gen.o: ../../e_os.h ../../include/openssl/aes.h | ||
101 | dsa_gen.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
102 | dsa_gen.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
103 | dsa_gen.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
104 | dsa_gen.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
105 | dsa_gen.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
106 | dsa_gen.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
107 | dsa_gen.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
108 | dsa_gen.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
109 | dsa_gen.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
110 | dsa_gen.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
111 | dsa_gen.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
112 | dsa_gen.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
113 | dsa_gen.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h | ||
114 | dsa_gen.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h | ||
115 | dsa_gen.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h | ||
116 | dsa_gen.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
117 | dsa_gen.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
118 | dsa_gen.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
119 | dsa_gen.o: ../../include/openssl/ui_compat.h ../cryptlib.h dsa_gen.c | ||
120 | dsa_key.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
121 | dsa_key.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
122 | dsa_key.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
123 | dsa_key.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
124 | dsa_key.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
125 | dsa_key.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
126 | dsa_key.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h | ||
127 | dsa_key.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
128 | dsa_key.o: ../cryptlib.h dsa_key.c | ||
129 | dsa_lib.o: ../../e_os.h ../../include/openssl/asn1.h | ||
130 | dsa_lib.o: ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
131 | dsa_lib.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
132 | dsa_lib.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
133 | dsa_lib.o: ../../include/openssl/e_os2.h ../../include/openssl/engine.h | ||
134 | dsa_lib.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
135 | dsa_lib.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
136 | dsa_lib.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h | ||
137 | dsa_lib.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
138 | dsa_lib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
139 | dsa_lib.o: ../../include/openssl/ui.h ../cryptlib.h dsa_lib.c | ||
140 | dsa_ossl.o: ../../e_os.h ../../include/openssl/asn1.h | ||
141 | dsa_ossl.o: ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
142 | dsa_ossl.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
143 | dsa_ossl.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
144 | dsa_ossl.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
145 | dsa_ossl.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
146 | dsa_ossl.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
147 | dsa_ossl.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h | ||
148 | dsa_ossl.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
149 | dsa_ossl.o: ../cryptlib.h dsa_ossl.c | ||
150 | dsa_sign.o: ../../e_os.h ../../include/openssl/asn1.h | ||
151 | dsa_sign.o: ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
152 | dsa_sign.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
153 | dsa_sign.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
154 | dsa_sign.o: ../../include/openssl/e_os2.h ../../include/openssl/engine.h | ||
155 | dsa_sign.o: ../../include/openssl/err.h ../../include/openssl/fips.h | ||
156 | dsa_sign.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
157 | dsa_sign.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
158 | dsa_sign.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h | ||
159 | dsa_sign.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
160 | dsa_sign.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
161 | dsa_sign.o: ../cryptlib.h dsa_sign.c | ||
162 | dsa_vrf.o: ../../e_os.h ../../include/openssl/asn1.h | ||
163 | dsa_vrf.o: ../../include/openssl/asn1_mac.h ../../include/openssl/bio.h | ||
164 | dsa_vrf.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
165 | dsa_vrf.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h | ||
166 | dsa_vrf.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
167 | dsa_vrf.o: ../../include/openssl/engine.h ../../include/openssl/err.h | ||
168 | dsa_vrf.o: ../../include/openssl/fips.h ../../include/openssl/lhash.h | ||
169 | dsa_vrf.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
170 | dsa_vrf.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h | ||
171 | dsa_vrf.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
172 | dsa_vrf.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
173 | dsa_vrf.o: ../../include/openssl/ui.h ../cryptlib.h dsa_vrf.c | ||
diff --git a/src/lib/libcrypto/dsa/Makefile.ssl b/src/lib/libcrypto/dsa/Makefile.ssl new file mode 100644 index 0000000000..e5f8a8cf51 --- /dev/null +++ b/src/lib/libcrypto/dsa/Makefile.ssl | |||
@@ -0,0 +1,171 @@ | |||
1 | # | ||
2 | # SSLeay/crypto/dsa/Makefile | ||
3 | # | ||
4 | |||
5 | DIR= dsa | ||
6 | TOP= ../.. | ||
7 | CC= cc | ||
8 | INCLUDES= -I.. -I$(TOP) -I../../include | ||
9 | CFLAG=-g | ||
10 | INSTALL_PREFIX= | ||
11 | OPENSSLDIR= /usr/local/ssl | ||
12 | INSTALLTOP=/usr/local/ssl | ||
13 | MAKE= make -f Makefile.ssl | ||
14 | MAKEDEPPROG= makedepend | ||
15 | MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG) | ||
16 | MAKEFILE= Makefile.ssl | ||
17 | AR= ar r | ||
18 | |||
19 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
20 | |||
21 | GENERAL=Makefile | ||
22 | TEST=dsatest.c | ||
23 | APPS= | ||
24 | |||
25 | LIB=$(TOP)/libcrypto.a | ||
26 | LIBSRC= dsa_gen.c dsa_key.c dsa_lib.c dsa_asn1.c dsa_vrf.c dsa_sign.c \ | ||
27 | dsa_err.c dsa_ossl.c | ||
28 | LIBOBJ= dsa_gen.o dsa_key.o dsa_lib.o dsa_asn1.o dsa_vrf.o dsa_sign.o \ | ||
29 | dsa_err.o dsa_ossl.o | ||
30 | |||
31 | SRC= $(LIBSRC) | ||
32 | |||
33 | EXHEADER= dsa.h | ||
34 | HEADER= $(EXHEADER) | ||
35 | |||
36 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
37 | |||
38 | top: | ||
39 | (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) | ||
40 | |||
41 | all: lib | ||
42 | |||
43 | lib: $(LIBOBJ) | ||
44 | $(AR) $(LIB) $(LIBOBJ) | ||
45 | $(RANLIB) $(LIB) || echo Never mind. | ||
46 | @touch lib | ||
47 | |||
48 | files: | ||
49 | $(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO | ||
50 | |||
51 | links: | ||
52 | @sh $(TOP)/util/point.sh Makefile.ssl Makefile | ||
53 | @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER) | ||
54 | @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST) | ||
55 | @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS) | ||
56 | |||
57 | install: | ||
58 | @for i in $(EXHEADER) ; \ | ||
59 | do \ | ||
60 | (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \ | ||
61 | chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \ | ||
62 | done; | ||
63 | |||
64 | tags: | ||
65 | ctags $(SRC) | ||
66 | |||
67 | tests: | ||
68 | |||
69 | lint: | ||
70 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
71 | |||
72 | depend: | ||
73 | $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC) | ||
74 | |||
75 | dclean: | ||
76 | $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
77 | mv -f Makefile.new $(MAKEFILE) | ||
78 | |||
79 | clean: | ||
80 | rm -f *.o */*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff | ||
81 | |||
82 | # DO NOT DELETE THIS LINE -- make depend depends on it. | ||
83 | |||
84 | dsa_asn1.o: ../../e_os.h ../../include/openssl/asn1.h | ||
85 | dsa_asn1.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h | ||
86 | dsa_asn1.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
87 | dsa_asn1.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h | ||
88 | dsa_asn1.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
89 | dsa_asn1.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
90 | dsa_asn1.o: ../../include/openssl/opensslconf.h | ||
91 | dsa_asn1.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
92 | dsa_asn1.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
93 | dsa_asn1.o: ../../include/openssl/symhacks.h ../cryptlib.h dsa_asn1.c | ||
94 | dsa_err.o: ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
95 | dsa_err.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h | ||
96 | dsa_err.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
97 | dsa_err.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
98 | dsa_err.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
99 | dsa_err.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h | ||
100 | dsa_err.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
101 | dsa_err.o: dsa_err.c | ||
102 | dsa_gen.o: ../../e_os.h ../../include/openssl/aes.h | ||
103 | dsa_gen.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
104 | dsa_gen.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h | ||
105 | dsa_gen.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h | ||
106 | dsa_gen.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
107 | dsa_gen.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
108 | dsa_gen.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
109 | dsa_gen.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
110 | dsa_gen.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h | ||
111 | dsa_gen.o: ../../include/openssl/md2.h ../../include/openssl/md4.h | ||
112 | dsa_gen.o: ../../include/openssl/md5.h ../../include/openssl/mdc2.h | ||
113 | dsa_gen.o: ../../include/openssl/obj_mac.h ../../include/openssl/objects.h | ||
114 | dsa_gen.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
115 | dsa_gen.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h | ||
116 | dsa_gen.o: ../../include/openssl/rc2.h ../../include/openssl/rc4.h | ||
117 | dsa_gen.o: ../../include/openssl/rc5.h ../../include/openssl/ripemd.h | ||
118 | dsa_gen.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
119 | dsa_gen.o: ../../include/openssl/sha.h ../../include/openssl/stack.h | ||
120 | dsa_gen.o: ../../include/openssl/symhacks.h ../../include/openssl/ui.h | ||
121 | dsa_gen.o: ../../include/openssl/ui_compat.h ../cryptlib.h dsa_gen.c | ||
122 | dsa_key.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
123 | dsa_key.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
124 | dsa_key.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
125 | dsa_key.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
126 | dsa_key.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
127 | dsa_key.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
128 | dsa_key.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h | ||
129 | dsa_key.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
130 | dsa_key.o: ../cryptlib.h dsa_key.c | ||
131 | dsa_lib.o: ../../e_os.h ../../include/openssl/asn1.h | ||
132 | dsa_lib.o: ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
133 | dsa_lib.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
134 | dsa_lib.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
135 | dsa_lib.o: ../../include/openssl/e_os2.h ../../include/openssl/engine.h | ||
136 | dsa_lib.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
137 | dsa_lib.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
138 | dsa_lib.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h | ||
139 | dsa_lib.o: ../../include/openssl/rsa.h ../../include/openssl/safestack.h | ||
140 | dsa_lib.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
141 | dsa_lib.o: ../../include/openssl/ui.h ../cryptlib.h dsa_lib.c | ||
142 | dsa_ossl.o: ../../e_os.h ../../include/openssl/asn1.h | ||
143 | dsa_ossl.o: ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
144 | dsa_ossl.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
145 | dsa_ossl.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
146 | dsa_ossl.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
147 | dsa_ossl.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
148 | dsa_ossl.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
149 | dsa_ossl.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h | ||
150 | dsa_ossl.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
151 | dsa_ossl.o: ../cryptlib.h dsa_ossl.c | ||
152 | dsa_sign.o: ../../e_os.h ../../include/openssl/asn1.h | ||
153 | dsa_sign.o: ../../include/openssl/bio.h ../../include/openssl/bn.h | ||
154 | dsa_sign.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
155 | dsa_sign.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
156 | dsa_sign.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
157 | dsa_sign.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
158 | dsa_sign.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
159 | dsa_sign.o: ../../include/openssl/rand.h ../../include/openssl/safestack.h | ||
160 | dsa_sign.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
161 | dsa_sign.o: ../cryptlib.h dsa_sign.c | ||
162 | dsa_vrf.o: ../../e_os.h ../../include/openssl/asn1.h | ||
163 | dsa_vrf.o: ../../include/openssl/asn1_mac.h ../../include/openssl/bio.h | ||
164 | dsa_vrf.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
165 | dsa_vrf.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h | ||
166 | dsa_vrf.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h | ||
167 | dsa_vrf.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
168 | dsa_vrf.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
169 | dsa_vrf.o: ../../include/openssl/ossl_typ.h ../../include/openssl/rand.h | ||
170 | dsa_vrf.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
171 | dsa_vrf.o: ../../include/openssl/symhacks.h ../cryptlib.h dsa_vrf.c | ||
diff --git a/src/lib/libcrypto/dsa/README b/src/lib/libcrypto/dsa/README new file mode 100644 index 0000000000..6a7e9c170a --- /dev/null +++ b/src/lib/libcrypto/dsa/README | |||
@@ -0,0 +1,4 @@ | |||
1 | The stuff in here is based on patches supplied to me by | ||
2 | Steven Schoch <schoch@sheba.arc.nasa.gov> to do DSS. | ||
3 | I have since modified a them a little but a debt of gratitude | ||
4 | is due for doing the initial work. | ||
diff --git a/src/lib/libcrypto/dsa/dsa.h b/src/lib/libcrypto/dsa/dsa.h index 851e3f0445..225ff391f9 100644 --- a/src/lib/libcrypto/dsa/dsa.h +++ b/src/lib/libcrypto/dsa/dsa.h | |||
@@ -80,20 +80,6 @@ | |||
80 | #endif | 80 | #endif |
81 | 81 | ||
82 | #define DSA_FLAG_CACHE_MONT_P 0x01 | 82 | #define DSA_FLAG_CACHE_MONT_P 0x01 |
83 | #define DSA_FLAG_NO_EXP_CONSTTIME 0x02 /* new with 0.9.7h; the built-in DSA | ||
84 | * implementation now uses constant time | ||
85 | * modular exponentiation for secret exponents | ||
86 | * by default. This flag causes the | ||
87 | * faster variable sliding window method to | ||
88 | * be used for all exponents. | ||
89 | */ | ||
90 | |||
91 | /* If this flag is set external DSA_METHOD callbacks are allowed in FIPS mode | ||
92 | * it is then the applications responsibility to ensure the external method | ||
93 | * is compliant. | ||
94 | */ | ||
95 | |||
96 | #define DSA_FLAG_FIPS_EXTERNAL_METHOD_ALLOW 0x04 | ||
97 | 83 | ||
98 | #if defined(OPENSSL_FIPS) | 84 | #if defined(OPENSSL_FIPS) |
99 | #define FIPS_DSA_SIZE_T int | 85 | #define FIPS_DSA_SIZE_T int |
diff --git a/src/lib/libcrypto/dsa/dsa_err.c b/src/lib/libcrypto/dsa/dsa_err.c index fd42053572..79aa4ff526 100644 --- a/src/lib/libcrypto/dsa/dsa_err.c +++ b/src/lib/libcrypto/dsa/dsa_err.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* crypto/dsa/dsa_err.c */ | 1 | /* crypto/dsa/dsa_err.c */ |
2 | /* ==================================================================== | 2 | /* ==================================================================== |
3 | * Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 1999 The OpenSSL Project. All rights reserved. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions | 6 | * modification, are permitted provided that the following conditions |
@@ -64,33 +64,29 @@ | |||
64 | 64 | ||
65 | /* BEGIN ERROR CODES */ | 65 | /* BEGIN ERROR CODES */ |
66 | #ifndef OPENSSL_NO_ERR | 66 | #ifndef OPENSSL_NO_ERR |
67 | |||
68 | #define ERR_FUNC(func) ERR_PACK(ERR_LIB_DSA,func,0) | ||
69 | #define ERR_REASON(reason) ERR_PACK(ERR_LIB_DSA,0,reason) | ||
70 | |||
71 | static ERR_STRING_DATA DSA_str_functs[]= | 67 | static ERR_STRING_DATA DSA_str_functs[]= |
72 | { | 68 | { |
73 | {ERR_FUNC(DSA_F_D2I_DSA_SIG), "d2i_DSA_SIG"}, | 69 | {ERR_PACK(0,DSA_F_D2I_DSA_SIG,0), "d2i_DSA_SIG"}, |
74 | {ERR_FUNC(DSA_F_DSAPARAMS_PRINT), "DSAparams_print"}, | 70 | {ERR_PACK(0,DSA_F_DSAPARAMS_PRINT,0), "DSAparams_print"}, |
75 | {ERR_FUNC(DSA_F_DSAPARAMS_PRINT_FP), "DSAparams_print_fp"}, | 71 | {ERR_PACK(0,DSA_F_DSAPARAMS_PRINT_FP,0), "DSAparams_print_fp"}, |
76 | {ERR_FUNC(DSA_F_DSA_DO_SIGN), "DSA_do_sign"}, | 72 | {ERR_PACK(0,DSA_F_DSA_DO_SIGN,0), "DSA_do_sign"}, |
77 | {ERR_FUNC(DSA_F_DSA_DO_VERIFY), "DSA_do_verify"}, | 73 | {ERR_PACK(0,DSA_F_DSA_DO_VERIFY,0), "DSA_do_verify"}, |
78 | {ERR_FUNC(DSA_F_DSA_NEW_METHOD), "DSA_new_method"}, | 74 | {ERR_PACK(0,DSA_F_DSA_NEW_METHOD,0), "DSA_new_method"}, |
79 | {ERR_FUNC(DSA_F_DSA_PRINT), "DSA_print"}, | 75 | {ERR_PACK(0,DSA_F_DSA_PRINT,0), "DSA_print"}, |
80 | {ERR_FUNC(DSA_F_DSA_PRINT_FP), "DSA_print_fp"}, | 76 | {ERR_PACK(0,DSA_F_DSA_PRINT_FP,0), "DSA_print_fp"}, |
81 | {ERR_FUNC(DSA_F_DSA_SIGN), "DSA_sign"}, | 77 | {ERR_PACK(0,DSA_F_DSA_SIGN,0), "DSA_sign"}, |
82 | {ERR_FUNC(DSA_F_DSA_SIGN_SETUP), "DSA_sign_setup"}, | 78 | {ERR_PACK(0,DSA_F_DSA_SIGN_SETUP,0), "DSA_sign_setup"}, |
83 | {ERR_FUNC(DSA_F_DSA_SIG_NEW), "DSA_SIG_new"}, | 79 | {ERR_PACK(0,DSA_F_DSA_SIG_NEW,0), "DSA_SIG_new"}, |
84 | {ERR_FUNC(DSA_F_DSA_VERIFY), "DSA_verify"}, | 80 | {ERR_PACK(0,DSA_F_DSA_VERIFY,0), "DSA_verify"}, |
85 | {ERR_FUNC(DSA_F_I2D_DSA_SIG), "i2d_DSA_SIG"}, | 81 | {ERR_PACK(0,DSA_F_I2D_DSA_SIG,0), "i2d_DSA_SIG"}, |
86 | {ERR_FUNC(DSA_F_SIG_CB), "SIG_CB"}, | 82 | {ERR_PACK(0,DSA_F_SIG_CB,0), "SIG_CB"}, |
87 | {0,NULL} | 83 | {0,NULL} |
88 | }; | 84 | }; |
89 | 85 | ||
90 | static ERR_STRING_DATA DSA_str_reasons[]= | 86 | static ERR_STRING_DATA DSA_str_reasons[]= |
91 | { | 87 | { |
92 | {ERR_REASON(DSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE),"data too large for key size"}, | 88 | {DSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE ,"data too large for key size"}, |
93 | {ERR_REASON(DSA_R_MISSING_PARAMETERS) ,"missing parameters"}, | 89 | {DSA_R_MISSING_PARAMETERS ,"missing parameters"}, |
94 | {0,NULL} | 90 | {0,NULL} |
95 | }; | 91 | }; |
96 | 92 | ||
@@ -104,8 +100,8 @@ void ERR_load_DSA_strings(void) | |||
104 | { | 100 | { |
105 | init=0; | 101 | init=0; |
106 | #ifndef OPENSSL_NO_ERR | 102 | #ifndef OPENSSL_NO_ERR |
107 | ERR_load_strings(0,DSA_str_functs); | 103 | ERR_load_strings(ERR_LIB_DSA,DSA_str_functs); |
108 | ERR_load_strings(0,DSA_str_reasons); | 104 | ERR_load_strings(ERR_LIB_DSA,DSA_str_reasons); |
109 | #endif | 105 | #endif |
110 | 106 | ||
111 | } | 107 | } |
diff --git a/src/lib/libcrypto/dsa/dsa_key.c b/src/lib/libcrypto/dsa/dsa_key.c index 980b6dc2d3..30607ca579 100644 --- a/src/lib/libcrypto/dsa/dsa_key.c +++ b/src/lib/libcrypto/dsa/dsa_key.c | |||
@@ -90,22 +90,8 @@ int DSA_generate_key(DSA *dsa) | |||
90 | } | 90 | } |
91 | else | 91 | else |
92 | pub_key=dsa->pub_key; | 92 | pub_key=dsa->pub_key; |
93 | |||
94 | { | ||
95 | BIGNUM local_prk; | ||
96 | BIGNUM *prk; | ||
97 | |||
98 | if ((dsa->flags & DSA_FLAG_NO_EXP_CONSTTIME) == 0) | ||
99 | { | ||
100 | BN_init(&local_prk); | ||
101 | prk = &local_prk; | ||
102 | BN_with_flags(prk, priv_key, BN_FLG_EXP_CONSTTIME); | ||
103 | } | ||
104 | else | ||
105 | prk = priv_key; | ||
106 | 93 | ||
107 | if (!BN_mod_exp(pub_key,dsa->g,prk,dsa->p,ctx)) goto err; | 94 | if (!BN_mod_exp(pub_key,dsa->g,priv_key,dsa->p,ctx)) goto err; |
108 | } | ||
109 | 95 | ||
110 | dsa->priv_key=priv_key; | 96 | dsa->priv_key=priv_key; |
111 | dsa->pub_key=pub_key; | 97 | dsa->pub_key=pub_key; |
diff --git a/src/lib/libcrypto/dsa/dsa_ossl.c b/src/lib/libcrypto/dsa/dsa_ossl.c index 12509a7083..f1a85afcde 100644 --- a/src/lib/libcrypto/dsa/dsa_ossl.c +++ b/src/lib/libcrypto/dsa/dsa_ossl.c | |||
@@ -172,7 +172,7 @@ err: | |||
172 | static int dsa_sign_setup(DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp, BIGNUM **rp) | 172 | static int dsa_sign_setup(DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp, BIGNUM **rp) |
173 | { | 173 | { |
174 | BN_CTX *ctx; | 174 | BN_CTX *ctx; |
175 | BIGNUM k,kq,*K,*kinv=NULL,*r=NULL; | 175 | BIGNUM k,*kinv=NULL,*r=NULL; |
176 | int ret=0; | 176 | int ret=0; |
177 | 177 | ||
178 | if (!dsa->p || !dsa->q || !dsa->g) | 178 | if (!dsa->p || !dsa->q || !dsa->g) |
@@ -182,7 +182,6 @@ static int dsa_sign_setup(DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp, BIGNUM **rp) | |||
182 | } | 182 | } |
183 | 183 | ||
184 | BN_init(&k); | 184 | BN_init(&k); |
185 | BN_init(&kq); | ||
186 | 185 | ||
187 | if (ctx_in == NULL) | 186 | if (ctx_in == NULL) |
188 | { | 187 | { |
@@ -192,49 +191,22 @@ static int dsa_sign_setup(DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp, BIGNUM **rp) | |||
192 | ctx=ctx_in; | 191 | ctx=ctx_in; |
193 | 192 | ||
194 | if ((r=BN_new()) == NULL) goto err; | 193 | if ((r=BN_new()) == NULL) goto err; |
194 | kinv=NULL; | ||
195 | 195 | ||
196 | /* Get random k */ | 196 | /* Get random k */ |
197 | do | 197 | do |
198 | if (!BN_rand_range(&k, dsa->q)) goto err; | 198 | if (!BN_rand_range(&k, dsa->q)) goto err; |
199 | while (BN_is_zero(&k)); | 199 | while (BN_is_zero(&k)); |
200 | if ((dsa->flags & DSA_FLAG_NO_EXP_CONSTTIME) == 0) | ||
201 | { | ||
202 | BN_set_flags(&k, BN_FLG_EXP_CONSTTIME); | ||
203 | } | ||
204 | 200 | ||
205 | if (dsa->flags & DSA_FLAG_CACHE_MONT_P) | 201 | if ((dsa->method_mont_p == NULL) && (dsa->flags & DSA_FLAG_CACHE_MONT_P)) |
206 | { | 202 | { |
207 | if (!BN_MONT_CTX_set_locked((BN_MONT_CTX **)&dsa->method_mont_p, | 203 | if ((dsa->method_mont_p=(char *)BN_MONT_CTX_new()) != NULL) |
208 | CRYPTO_LOCK_DSA, | 204 | if (!BN_MONT_CTX_set((BN_MONT_CTX *)dsa->method_mont_p, |
209 | dsa->p, ctx)) | 205 | dsa->p,ctx)) goto err; |
210 | goto err; | ||
211 | } | 206 | } |
212 | 207 | ||
213 | /* Compute r = (g^k mod p) mod q */ | 208 | /* Compute r = (g^k mod p) mod q */ |
214 | 209 | if (!dsa->meth->bn_mod_exp(dsa, r,dsa->g,&k,dsa->p,ctx, | |
215 | if ((dsa->flags & DSA_FLAG_NO_EXP_CONSTTIME) == 0) | ||
216 | { | ||
217 | if (!BN_copy(&kq, &k)) goto err; | ||
218 | |||
219 | /* We do not want timing information to leak the length of k, | ||
220 | * so we compute g^k using an equivalent exponent of fixed length. | ||
221 | * | ||
222 | * (This is a kludge that we need because the BN_mod_exp_mont() | ||
223 | * does not let us specify the desired timing behaviour.) */ | ||
224 | |||
225 | if (!BN_add(&kq, &kq, dsa->q)) goto err; | ||
226 | if (BN_num_bits(&kq) <= BN_num_bits(dsa->q)) | ||
227 | { | ||
228 | if (!BN_add(&kq, &kq, dsa->q)) goto err; | ||
229 | } | ||
230 | |||
231 | K = &kq; | ||
232 | } | ||
233 | else | ||
234 | { | ||
235 | K = &k; | ||
236 | } | ||
237 | if (!dsa->meth->bn_mod_exp(dsa, r,dsa->g,K,dsa->p,ctx, | ||
238 | (BN_MONT_CTX *)dsa->method_mont_p)) goto err; | 210 | (BN_MONT_CTX *)dsa->method_mont_p)) goto err; |
239 | if (!BN_mod(r,r,dsa->q,ctx)) goto err; | 211 | if (!BN_mod(r,r,dsa->q,ctx)) goto err; |
240 | 212 | ||
@@ -257,7 +229,6 @@ err: | |||
257 | if (ctx_in == NULL) BN_CTX_free(ctx); | 229 | if (ctx_in == NULL) BN_CTX_free(ctx); |
258 | if (kinv != NULL) BN_clear_free(kinv); | 230 | if (kinv != NULL) BN_clear_free(kinv); |
259 | BN_clear_free(&k); | 231 | BN_clear_free(&k); |
260 | BN_clear_free(&kq); | ||
261 | return(ret); | 232 | return(ret); |
262 | } | 233 | } |
263 | 234 | ||
@@ -304,15 +275,13 @@ static int dsa_do_verify(const unsigned char *dgst, int dgst_len, DSA_SIG *sig, | |||
304 | /* u2 = r * w mod q */ | 275 | /* u2 = r * w mod q */ |
305 | if (!BN_mod_mul(&u2,sig->r,&u2,dsa->q,ctx)) goto err; | 276 | if (!BN_mod_mul(&u2,sig->r,&u2,dsa->q,ctx)) goto err; |
306 | 277 | ||
307 | 278 | if ((dsa->method_mont_p == NULL) && (dsa->flags & DSA_FLAG_CACHE_MONT_P)) | |
308 | if (dsa->flags & DSA_FLAG_CACHE_MONT_P) | ||
309 | { | 279 | { |
310 | mont = BN_MONT_CTX_set_locked( | 280 | if ((dsa->method_mont_p=(char *)BN_MONT_CTX_new()) != NULL) |
311 | (BN_MONT_CTX **)&dsa->method_mont_p, | 281 | if (!BN_MONT_CTX_set((BN_MONT_CTX *)dsa->method_mont_p, |
312 | CRYPTO_LOCK_DSA, dsa->p, ctx); | 282 | dsa->p,ctx)) goto err; |
313 | if (!mont) | ||
314 | goto err; | ||
315 | } | 283 | } |
284 | mont=(BN_MONT_CTX *)dsa->method_mont_p; | ||
316 | 285 | ||
317 | #if 0 | 286 | #if 0 |
318 | { | 287 | { |
diff --git a/src/lib/libcrypto/dsa/dsa_sign.c b/src/lib/libcrypto/dsa/dsa_sign.c index 37c65efb20..3c9753bac3 100644 --- a/src/lib/libcrypto/dsa/dsa_sign.c +++ b/src/lib/libcrypto/dsa/dsa_sign.c | |||
@@ -72,8 +72,7 @@ | |||
72 | DSA_SIG * DSA_do_sign(const unsigned char *dgst, int dlen, DSA *dsa) | 72 | DSA_SIG * DSA_do_sign(const unsigned char *dgst, int dlen, DSA *dsa) |
73 | { | 73 | { |
74 | #ifdef OPENSSL_FIPS | 74 | #ifdef OPENSSL_FIPS |
75 | if(FIPS_mode() && !(dsa->flags & DSA_FLAG_FIPS_EXTERNAL_METHOD_ALLOW) | 75 | if(FIPS_mode() && !FIPS_dsa_check(dsa)) |
76 | && !FIPS_dsa_check(dsa)) | ||
77 | return NULL; | 76 | return NULL; |
78 | #endif | 77 | #endif |
79 | return dsa->meth->dsa_do_sign(dgst, dlen, dsa); | 78 | return dsa->meth->dsa_do_sign(dgst, dlen, dsa); |
@@ -97,8 +96,7 @@ int DSA_sign(int type, const unsigned char *dgst, int dlen, unsigned char *sig, | |||
97 | int DSA_sign_setup(DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp, BIGNUM **rp) | 96 | int DSA_sign_setup(DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp, BIGNUM **rp) |
98 | { | 97 | { |
99 | #ifdef OPENSSL_FIPS | 98 | #ifdef OPENSSL_FIPS |
100 | if(FIPS_mode() && !(dsa->flags & DSA_FLAG_FIPS_EXTERNAL_METHOD_ALLOW) | 99 | if(FIPS_mode() && !FIPS_dsa_check(dsa)) |
101 | && !FIPS_dsa_check(dsa)) | ||
102 | return 0; | 100 | return 0; |
103 | #endif | 101 | #endif |
104 | return dsa->meth->dsa_sign_setup(dsa, ctx_in, kinvp, rp); | 102 | return dsa->meth->dsa_sign_setup(dsa, ctx_in, kinvp, rp); |
diff --git a/src/lib/libcrypto/dsa/dsa_vrf.c b/src/lib/libcrypto/dsa/dsa_vrf.c index c9784bed48..8ef0c45025 100644 --- a/src/lib/libcrypto/dsa/dsa_vrf.c +++ b/src/lib/libcrypto/dsa/dsa_vrf.c | |||
@@ -74,8 +74,7 @@ int DSA_do_verify(const unsigned char *dgst, int dgst_len, DSA_SIG *sig, | |||
74 | DSA *dsa) | 74 | DSA *dsa) |
75 | { | 75 | { |
76 | #ifdef OPENSSL_FIPS | 76 | #ifdef OPENSSL_FIPS |
77 | if(FIPS_mode() && !(dsa->flags & DSA_FLAG_FIPS_EXTERNAL_METHOD_ALLOW) | 77 | if(FIPS_mode() && !FIPS_dsa_check(dsa)) |
78 | && !FIPS_dsa_check(dsa)) | ||
79 | return -1; | 78 | return -1; |
80 | #endif | 79 | #endif |
81 | return dsa->meth->dsa_do_verify(dgst, dgst_len, sig, dsa); | 80 | return dsa->meth->dsa_do_verify(dgst, dgst_len, sig, dsa); |
diff --git a/src/lib/libcrypto/dsa/dsagen.c b/src/lib/libcrypto/dsa/dsagen.c new file mode 100644 index 0000000000..1b6a1cca0f --- /dev/null +++ b/src/lib/libcrypto/dsa/dsagen.c | |||
@@ -0,0 +1,111 @@ | |||
1 | /* crypto/dsa/dsagen.c */ | ||
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * This package is an SSL implementation written | ||
6 | * by Eric Young (eay@cryptsoft.com). | ||
7 | * The implementation was written so as to conform with Netscapes SSL. | ||
8 | * | ||
9 | * This library is free for commercial and non-commercial use as long as | ||
10 | * the following conditions are aheared to. The following conditions | ||
11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
13 | * included with this distribution is covered by the same copyright terms | ||
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
15 | * | ||
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
17 | * the code are not to be removed. | ||
18 | * If this package is used in a product, Eric Young should be given attribution | ||
19 | * as the author of the parts of the library used. | ||
20 | * This can be in the form of a textual message at program startup or | ||
21 | * in documentation (online or textual) provided with the package. | ||
22 | * | ||
23 | * Redistribution and use in source and binary forms, with or without | ||
24 | * modification, are permitted provided that the following conditions | ||
25 | * are met: | ||
26 | * 1. Redistributions of source code must retain the copyright | ||
27 | * notice, this list of conditions and the following disclaimer. | ||
28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
29 | * notice, this list of conditions and the following disclaimer in the | ||
30 | * documentation and/or other materials provided with the distribution. | ||
31 | * 3. All advertising materials mentioning features or use of this software | ||
32 | * must display the following acknowledgement: | ||
33 | * "This product includes cryptographic software written by | ||
34 | * Eric Young (eay@cryptsoft.com)" | ||
35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
36 | * being used are not cryptographic related :-). | ||
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
38 | * the apps directory (application code) you must include an acknowledgement: | ||
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
40 | * | ||
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
51 | * SUCH DAMAGE. | ||
52 | * | ||
53 | * The licence and distribution terms for any publically available version or | ||
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
55 | * copied and put under another distribution licence | ||
56 | * [including the GNU Public Licence.] | ||
57 | */ | ||
58 | |||
59 | #include <stdio.h> | ||
60 | #include <openssl/dsa.h> | ||
61 | |||
62 | #define TEST | ||
63 | #define GENUINE_DSA | ||
64 | |||
65 | #ifdef GENUINE_DSA | ||
66 | #define LAST_VALUE 0xbd | ||
67 | #else | ||
68 | #define LAST_VALUE 0xd3 | ||
69 | #endif | ||
70 | |||
71 | #ifdef TEST | ||
72 | unsigned char seed[20]={ | ||
73 | 0xd5,0x01,0x4e,0x4b, | ||
74 | 0x60,0xef,0x2b,0xa8, | ||
75 | 0xb6,0x21,0x1b,0x40, | ||
76 | 0x62,0xba,0x32,0x24, | ||
77 | 0xe0,0x42,0x7d,LAST_VALUE}; | ||
78 | #endif | ||
79 | |||
80 | int cb(int p, int n) | ||
81 | { | ||
82 | char c='*'; | ||
83 | |||
84 | if (p == 0) c='.'; | ||
85 | if (p == 1) c='+'; | ||
86 | if (p == 2) c='*'; | ||
87 | if (p == 3) c='\n'; | ||
88 | printf("%c",c); | ||
89 | fflush(stdout); | ||
90 | } | ||
91 | |||
92 | main() | ||
93 | { | ||
94 | int i; | ||
95 | BIGNUM *n; | ||
96 | BN_CTX *ctx; | ||
97 | unsigned char seed_buf[20]; | ||
98 | DSA *dsa; | ||
99 | int counter,h; | ||
100 | BIO *bio_err=NULL; | ||
101 | |||
102 | if (bio_err == NULL) | ||
103 | bio_err=BIO_new_fp(stderr,BIO_NOCLOSE); | ||
104 | |||
105 | memcpy(seed_buf,seed,20); | ||
106 | dsa=DSA_generate_parameters(1024,seed,20,&counter,&h,cb,bio_err); | ||
107 | |||
108 | if (dsa == NULL) | ||
109 | DSA_print(bio_err,dsa,0); | ||
110 | } | ||
111 | |||
diff --git a/src/lib/libcrypto/dsa/dsatest.c b/src/lib/libcrypto/dsa/dsatest.c new file mode 100644 index 0000000000..4734ce4af8 --- /dev/null +++ b/src/lib/libcrypto/dsa/dsatest.c | |||
@@ -0,0 +1,242 @@ | |||
1 | /* crypto/dsa/dsatest.c */ | ||
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | ||
3 | * All rights reserved. | ||
4 | * | ||
5 | * This package is an SSL implementation written | ||
6 | * by Eric Young (eay@cryptsoft.com). | ||
7 | * The implementation was written so as to conform with Netscapes SSL. | ||
8 | * | ||
9 | * This library is free for commercial and non-commercial use as long as | ||
10 | * the following conditions are aheared to. The following conditions | ||
11 | * apply to all code found in this distribution, be it the RC4, RSA, | ||
12 | * lhash, DES, etc., code; not just the SSL code. The SSL documentation | ||
13 | * included with this distribution is covered by the same copyright terms | ||
14 | * except that the holder is Tim Hudson (tjh@cryptsoft.com). | ||
15 | * | ||
16 | * Copyright remains Eric Young's, and as such any Copyright notices in | ||
17 | * the code are not to be removed. | ||
18 | * If this package is used in a product, Eric Young should be given attribution | ||
19 | * as the author of the parts of the library used. | ||
20 | * This can be in the form of a textual message at program startup or | ||
21 | * in documentation (online or textual) provided with the package. | ||
22 | * | ||
23 | * Redistribution and use in source and binary forms, with or without | ||
24 | * modification, are permitted provided that the following conditions | ||
25 | * are met: | ||
26 | * 1. Redistributions of source code must retain the copyright | ||
27 | * notice, this list of conditions and the following disclaimer. | ||
28 | * 2. Redistributions in binary form must reproduce the above copyright | ||
29 | * notice, this list of conditions and the following disclaimer in the | ||
30 | * documentation and/or other materials provided with the distribution. | ||
31 | * 3. All advertising materials mentioning features or use of this software | ||
32 | * must display the following acknowledgement: | ||
33 | * "This product includes cryptographic software written by | ||
34 | * Eric Young (eay@cryptsoft.com)" | ||
35 | * The word 'cryptographic' can be left out if the rouines from the library | ||
36 | * being used are not cryptographic related :-). | ||
37 | * 4. If you include any Windows specific code (or a derivative thereof) from | ||
38 | * the apps directory (application code) you must include an acknowledgement: | ||
39 | * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" | ||
40 | * | ||
41 | * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND | ||
42 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
43 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
44 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | ||
45 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
46 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | ||
47 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||
48 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||
49 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||
50 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||
51 | * SUCH DAMAGE. | ||
52 | * | ||
53 | * The licence and distribution terms for any publically available version or | ||
54 | * derivative of this code cannot be changed. i.e. this code cannot simply be | ||
55 | * copied and put under another distribution licence | ||
56 | * [including the GNU Public Licence.] | ||
57 | */ | ||
58 | |||
59 | #include <stdio.h> | ||
60 | #include <stdlib.h> | ||
61 | #include <string.h> | ||
62 | #include <sys/types.h> | ||
63 | #include <sys/stat.h> | ||
64 | |||
65 | #include "../e_os.h" | ||
66 | |||
67 | #include <openssl/crypto.h> | ||
68 | #include <openssl/rand.h> | ||
69 | #include <openssl/bio.h> | ||
70 | #include <openssl/err.h> | ||
71 | |||
72 | #ifdef OPENSSL_NO_DSA | ||
73 | int main(int argc, char *argv[]) | ||
74 | { | ||
75 | printf("No DSA support\n"); | ||
76 | return(0); | ||
77 | } | ||
78 | #else | ||
79 | #include <openssl/dsa.h> | ||
80 | |||
81 | #ifdef OPENSSL_SYS_WIN16 | ||
82 | #define MS_CALLBACK _far _loadds | ||
83 | #else | ||
84 | #define MS_CALLBACK | ||
85 | #endif | ||
86 | |||
87 | static void MS_CALLBACK dsa_cb(int p, int n, void *arg); | ||
88 | |||
89 | /* seed, out_p, out_q, out_g are taken from the updated Appendix 5 to | ||
90 | * FIPS PUB 186 and also appear in Appendix 5 to FIPS PIB 186-1 */ | ||
91 | static unsigned char seed[20]={ | ||
92 | 0xd5,0x01,0x4e,0x4b,0x60,0xef,0x2b,0xa8,0xb6,0x21,0x1b,0x40, | ||
93 | 0x62,0xba,0x32,0x24,0xe0,0x42,0x7d,0xd3, | ||
94 | }; | ||
95 | |||
96 | static unsigned char out_p[]={ | ||
97 | 0x8d,0xf2,0xa4,0x94,0x49,0x22,0x76,0xaa, | ||
98 | 0x3d,0x25,0x75,0x9b,0xb0,0x68,0x69,0xcb, | ||
99 | 0xea,0xc0,0xd8,0x3a,0xfb,0x8d,0x0c,0xf7, | ||
100 | 0xcb,0xb8,0x32,0x4f,0x0d,0x78,0x82,0xe5, | ||
101 | 0xd0,0x76,0x2f,0xc5,0xb7,0x21,0x0e,0xaf, | ||
102 | 0xc2,0xe9,0xad,0xac,0x32,0xab,0x7a,0xac, | ||
103 | 0x49,0x69,0x3d,0xfb,0xf8,0x37,0x24,0xc2, | ||
104 | 0xec,0x07,0x36,0xee,0x31,0xc8,0x02,0x91, | ||
105 | }; | ||
106 | |||
107 | static unsigned char out_q[]={ | ||
108 | 0xc7,0x73,0x21,0x8c,0x73,0x7e,0xc8,0xee, | ||
109 | 0x99,0x3b,0x4f,0x2d,0xed,0x30,0xf4,0x8e, | ||
110 | 0xda,0xce,0x91,0x5f, | ||
111 | }; | ||
112 | |||
113 | static unsigned char out_g[]={ | ||
114 | 0x62,0x6d,0x02,0x78,0x39,0xea,0x0a,0x13, | ||
115 | 0x41,0x31,0x63,0xa5,0x5b,0x4c,0xb5,0x00, | ||
116 | 0x29,0x9d,0x55,0x22,0x95,0x6c,0xef,0xcb, | ||
117 | 0x3b,0xff,0x10,0xf3,0x99,0xce,0x2c,0x2e, | ||
118 | 0x71,0xcb,0x9d,0xe5,0xfa,0x24,0xba,0xbf, | ||
119 | 0x58,0xe5,0xb7,0x95,0x21,0x92,0x5c,0x9c, | ||
120 | 0xc4,0x2e,0x9f,0x6f,0x46,0x4b,0x08,0x8c, | ||
121 | 0xc5,0x72,0xaf,0x53,0xe6,0xd7,0x88,0x02, | ||
122 | }; | ||
123 | |||
124 | static const unsigned char str1[]="12345678901234567890"; | ||
125 | |||
126 | static const char rnd_seed[] = "string to make the random number generator think it has entropy"; | ||
127 | |||
128 | static BIO *bio_err=NULL; | ||
129 | |||
130 | int main(int argc, char **argv) | ||
131 | { | ||
132 | DSA *dsa=NULL; | ||
133 | int counter,ret=0,i,j; | ||
134 | unsigned char buf[256]; | ||
135 | unsigned long h; | ||
136 | unsigned char sig[256]; | ||
137 | unsigned int siglen; | ||
138 | |||
139 | if (bio_err == NULL) | ||
140 | bio_err=BIO_new_fp(stderr,BIO_NOCLOSE); | ||
141 | |||
142 | CRYPTO_malloc_debug_init(); | ||
143 | CRYPTO_dbg_set_options(V_CRYPTO_MDEBUG_ALL); | ||
144 | CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON); | ||
145 | |||
146 | ERR_load_crypto_strings(); | ||
147 | RAND_seed(rnd_seed, sizeof rnd_seed); | ||
148 | |||
149 | BIO_printf(bio_err,"test generation of DSA parameters\n"); | ||
150 | |||
151 | dsa=DSA_generate_parameters(512,seed,20,&counter,&h,dsa_cb,bio_err); | ||
152 | |||
153 | BIO_printf(bio_err,"seed\n"); | ||
154 | for (i=0; i<20; i+=4) | ||
155 | { | ||
156 | BIO_printf(bio_err,"%02X%02X%02X%02X ", | ||
157 | seed[i],seed[i+1],seed[i+2],seed[i+3]); | ||
158 | } | ||
159 | BIO_printf(bio_err,"\ncounter=%d h=%d\n",counter,h); | ||
160 | |||
161 | if (dsa == NULL) goto end; | ||
162 | DSA_print(bio_err,dsa,0); | ||
163 | if (counter != 105) | ||
164 | { | ||
165 | BIO_printf(bio_err,"counter should be 105\n"); | ||
166 | goto end; | ||
167 | } | ||
168 | if (h != 2) | ||
169 | { | ||
170 | BIO_printf(bio_err,"h should be 2\n"); | ||
171 | goto end; | ||
172 | } | ||
173 | |||
174 | i=BN_bn2bin(dsa->q,buf); | ||
175 | j=sizeof(out_q); | ||
176 | if ((i != j) || (memcmp(buf,out_q,i) != 0)) | ||
177 | { | ||
178 | BIO_printf(bio_err,"q value is wrong\n"); | ||
179 | goto end; | ||
180 | } | ||
181 | |||
182 | i=BN_bn2bin(dsa->p,buf); | ||
183 | j=sizeof(out_p); | ||
184 | if ((i != j) || (memcmp(buf,out_p,i) != 0)) | ||
185 | { | ||
186 | BIO_printf(bio_err,"p value is wrong\n"); | ||
187 | goto end; | ||
188 | } | ||
189 | |||
190 | i=BN_bn2bin(dsa->g,buf); | ||
191 | j=sizeof(out_g); | ||
192 | if ((i != j) || (memcmp(buf,out_g,i) != 0)) | ||
193 | { | ||
194 | BIO_printf(bio_err,"g value is wrong\n"); | ||
195 | goto end; | ||
196 | } | ||
197 | DSA_generate_key(dsa); | ||
198 | DSA_sign(0, str1, 20, sig, &siglen, dsa); | ||
199 | if (DSA_verify(0, str1, 20, sig, siglen, dsa) == 1) | ||
200 | ret=1; | ||
201 | end: | ||
202 | if (!ret) | ||
203 | ERR_print_errors(bio_err); | ||
204 | if (dsa != NULL) DSA_free(dsa); | ||
205 | CRYPTO_cleanup_all_ex_data(); | ||
206 | ERR_remove_state(0); | ||
207 | ERR_free_strings(); | ||
208 | CRYPTO_mem_leaks(bio_err); | ||
209 | if (bio_err != NULL) | ||
210 | { | ||
211 | BIO_free(bio_err); | ||
212 | bio_err = NULL; | ||
213 | } | ||
214 | EXIT(!ret); | ||
215 | return(0); | ||
216 | } | ||
217 | |||
218 | static int cb_exit(int ec) | ||
219 | { | ||
220 | EXIT(ec); | ||
221 | return(0); /* To keep some compilers quiet */ | ||
222 | } | ||
223 | |||
224 | static void MS_CALLBACK dsa_cb(int p, int n, void *arg) | ||
225 | { | ||
226 | char c='*'; | ||
227 | static int ok=0,num=0; | ||
228 | |||
229 | if (p == 0) { c='.'; num++; }; | ||
230 | if (p == 1) c='+'; | ||
231 | if (p == 2) { c='*'; ok++; } | ||
232 | if (p == 3) c='\n'; | ||
233 | BIO_write(arg,&c,1); | ||
234 | (void)BIO_flush(arg); | ||
235 | |||
236 | if (!ok && (p == 0) && (num > 1)) | ||
237 | { | ||
238 | BIO_printf((BIO *)arg,"error in dsatest\n"); | ||
239 | cb_exit(1); | ||
240 | } | ||
241 | } | ||
242 | #endif | ||
diff --git a/src/lib/libcrypto/dsa/fips186a.txt b/src/lib/libcrypto/dsa/fips186a.txt new file mode 100644 index 0000000000..3a2e0a0d51 --- /dev/null +++ b/src/lib/libcrypto/dsa/fips186a.txt | |||
@@ -0,0 +1,122 @@ | |||
1 | The origional FIPE 180 used SHA-0 (FIPS 180) for its appendix 5 | ||
2 | examples. This is an updated version that uses SHA-1 (FIPS 180-1) | ||
3 | supplied to me by Wei Dai | ||
4 | -- | ||
5 | APPENDIX 5. EXAMPLE OF THE DSA | ||
6 | |||
7 | |||
8 | This appendix is for informational purposes only and is not required to meet | ||
9 | the standard. | ||
10 | |||
11 | Let L = 512 (size of p). The values in this example are expressed in | ||
12 | hexadecimal notation. The p and q given here were generated by the prime | ||
13 | generation standard described in appendix 2 using the 160-bit SEED: | ||
14 | |||
15 | d5014e4b 60ef2ba8 b6211b40 62ba3224 e0427dd3 | ||
16 | |||
17 | With this SEED, the algorithm found p and q when the counter was at 105. | ||
18 | |||
19 | x was generated by the algorithm described in appendix 3, section 3.1, using | ||
20 | the SHA to construct G (as in appendix 3, section 3.3) and a 160-bit XSEED: | ||
21 | |||
22 | XSEED = | ||
23 | |||
24 | bd029bbe 7f51960b cf9edb2b 61f06f0f eb5a38b6 | ||
25 | |||
26 | t = | ||
27 | 67452301 EFCDAB89 98BADCFE 10325476 C3D2E1F0 | ||
28 | |||
29 | x = G(t,XSEED) mod q | ||
30 | |||
31 | k was generated by the algorithm described in appendix 3, section 3.2, using | ||
32 | the SHA to construct G (as in appendix 3, section 3.3) and a 160-bit KSEED: | ||
33 | |||
34 | KSEED = | ||
35 | |||
36 | 687a66d9 0648f993 867e121f 4ddf9ddb 01205584 | ||
37 | |||
38 | t = | ||
39 | EFCDAB89 98BADCFE 10325476 C3D2E1F0 67452301 | ||
40 | |||
41 | k = G(t,KSEED) mod q | ||
42 | |||
43 | Finally: | ||
44 | |||
45 | h = 2 | ||
46 | |||
47 | p = | ||
48 | 8df2a494 492276aa 3d25759b b06869cb eac0d83a fb8d0cf7 | ||
49 | cbb8324f 0d7882e5 d0762fc5 b7210eaf c2e9adac 32ab7aac | ||
50 | 49693dfb f83724c2 ec0736ee 31c80291 | ||
51 | |||
52 | |||
53 | q = | ||
54 | c773218c 737ec8ee 993b4f2d ed30f48e dace915f | ||
55 | |||
56 | |||
57 | g = | ||
58 | 626d0278 39ea0a13 413163a5 5b4cb500 299d5522 956cefcb | ||
59 | 3bff10f3 99ce2c2e 71cb9de5 fa24babf 58e5b795 21925c9c | ||
60 | c42e9f6f 464b088c c572af53 e6d78802 | ||
61 | |||
62 | |||
63 | x = | ||
64 | 2070b322 3dba372f de1c0ffc 7b2e3b49 8b260614 | ||
65 | |||
66 | |||
67 | k = | ||
68 | 358dad57 1462710f 50e254cf 1a376b2b deaadfbf | ||
69 | |||
70 | |||
71 | kinv = | ||
72 | |||
73 | 0d516729 8202e49b 4116ac10 4fc3f415 ae52f917 | ||
74 | |||
75 | M = ASCII form of "abc" (See FIPS PUB 180-1, Appendix A) | ||
76 | |||
77 | SHA(M) = | ||
78 | |||
79 | a9993e36 4706816a ba3e2571 7850c26c 9cd0d89d | ||
80 | |||
81 | |||
82 | y = | ||
83 | |||
84 | 19131871 d75b1612 a819f29d 78d1b0d7 346f7aa7 7bb62a85 | ||
85 | 9bfd6c56 75da9d21 2d3a36ef 1672ef66 0b8c7c25 5cc0ec74 | ||
86 | 858fba33 f44c0669 9630a76b 030ee333 | ||
87 | |||
88 | |||
89 | r = | ||
90 | 8bac1ab6 6410435c b7181f95 b16ab97c 92b341c0 | ||
91 | |||
92 | s = | ||
93 | 41e2345f 1f56df24 58f426d1 55b4ba2d b6dcd8c8 | ||
94 | |||
95 | |||
96 | w = | ||
97 | 9df4ece5 826be95f ed406d41 b43edc0b 1c18841b | ||
98 | |||
99 | |||
100 | u1 = | ||
101 | bf655bd0 46f0b35e c791b004 804afcbb 8ef7d69d | ||
102 | |||
103 | |||
104 | u2 = | ||
105 | 821a9263 12e97ade abcc8d08 2b527897 8a2df4b0 | ||
106 | |||
107 | |||
108 | gu1 mod p = | ||
109 | |||
110 | 51b1bf86 7888e5f3 af6fb476 9dd016bc fe667a65 aafc2753 | ||
111 | 9063bd3d 2b138b4c e02cc0c0 2ec62bb6 7306c63e 4db95bbf | ||
112 | 6f96662a 1987a21b e4ec1071 010b6069 | ||
113 | |||
114 | |||
115 | yu2 mod p = | ||
116 | |||
117 | 8b510071 2957e950 50d6b8fd 376a668e 4b0d633c 1e46e665 | ||
118 | 5c611a72 e2b28483 be52c74d 4b30de61 a668966e dc307a67 | ||
119 | c19441f4 22bf3c34 08aeba1f 0a4dbec7 | ||
120 | |||
121 | v = | ||
122 | 8bac1ab6 6410435c b7181f95 b16ab97c 92b341c0 | ||