Browse Source

Testing "gen priv" command.

Michele Orrù 11 years ago
parent
commit
02105238af
4 changed files with 17 additions and 5 deletions
  1. 3 3
      src/apps/Makefile.am
  2. 2 2
      src/apps/gen.c
  3. 6 0
      src/apps/tests/test_gen_priv.test
  4. 6 0
      src/apps/tests/test_gen_pub.test

+ 3 - 3
src/apps/Makefile.am

@@ -1,9 +1,9 @@
 bin_PROGRAMS = gen
-
-AM_CFLAGS = --std=c99
+AM_CFLAGS = --std=c99 -Wall
 
 gen_SOURCES = gen.c
 gen_LDFLAGS = -lcrypto -lssl
 
 
-TESTS = tests/test_gen.test
+TESTS = tests/test_gen_pub.test \
+	tests/test_gen_priv.test

+ 2 - 2
src/apps/gen.c

@@ -84,11 +84,11 @@ int main(int argc, char **argv)
   int opt;
   RSA *rsa = RSA_new();
 
-  rsa->n = rsa->e = rsa->q = rsa->q = NULL;
+  rsa->n = rsa->e = rsa->p = rsa->q = NULL;
 
   if (argc < 3) usage(EXIT_FAILURE);
 
-  while ((opt = getopt(argc-1, argv+1, "e:N:n:p:q:")) != -1)  {
+  while ((opt = getopt(argc-1, argv+1, "d:e:N:n:p:q:")) != -1)  {
     switch (opt) {
     case 'N':
     case 'n':

+ 6 - 0
src/apps/tests/test_gen_priv.test

@@ -0,0 +1,6 @@
+#!/bin/bash
+
+# N = 11 * 13
+# e = 103
+# d = 7
+./gen priv -p 11 -q 13 -e 103 -d 7 | openssl rsa -noout -modulus | grep -q '8F'

+ 6 - 0
src/apps/tests/test_gen_pub.test

@@ -0,0 +1,6 @@
+#!/bin/bash
+
+# N = 11 * 13
+# e = 103
+# d = 7
+./gen pub -N 143 -e 103 | grep -q PUBLIC