]> git.ipfire.org Git - thirdparty/nettle.git/commitdiff
* rsa2sexp.c (rsa_keypair_to_sexp): New argument ALGORITHM_NAME.
authorNiels Möller <nisse@lysator.liu.se>
Mon, 10 Feb 2003 17:35:39 +0000 (18:35 +0100)
committerNiels Möller <nisse@lysator.liu.se>
Mon, 10 Feb 2003 17:35:39 +0000 (18:35 +0100)
* rsa2sexp.c (rsa_keypair_to_sexp): Use literals with sexp_format.

Rev: src/nettle/rsa.h:1.21
Rev: src/nettle/rsa2sexp.c:1.6

rsa.h
rsa2sexp.c

diff --git a/rsa.h b/rsa.h
index 14a4c44b45ebfc231b9ae17bd2ef28b5e9c82e10..dd5005571629bf7712f9950c9a900acb7d2f5f6e 100644 (file)
--- a/rsa.h
+++ b/rsa.h
@@ -235,6 +235,7 @@ struct nettle_buffer;
 /* Generates a public-key expression if PRIV is NULL .*/
 int
 rsa_keypair_to_sexp(struct nettle_buffer *buffer,
+                   const char *algorithm_name, /* NULL means "rsa" */
                    const struct rsa_public_key *pub,
                    const struct rsa_private_key *priv);
 
index 8957570d325ff3057ea4b6126e82760f4ecd233b..75f5645c75e01e3dfd0915ccde537110e6f471b8 100644 (file)
 
 int
 rsa_keypair_to_sexp(struct nettle_buffer *buffer,
+                   const char *algorithm_name,
                    const struct rsa_public_key *pub,
                    const struct rsa_private_key *priv)
 {
+  if (!algorithm_name)
+    algorithm_name = "rsa";
+  
   if (priv)
     return sexp_format(buffer,
                       "(private-key(%0s(n%b)(e%b)"
                       "(d%b)(p%b)(q%b)(a%b)(b%b)(c%b)))",
-                      "rsa", pub->n, pub->e,
+                      algorithm_name, pub->n, pub->e,
                       priv->d, priv->p, priv->q,
                       priv->a, priv->b, priv->c);
   else
     return sexp_format(buffer, "(public-key(%0s(n%b)(e%b)))",
-                      "rsa", pub->n, pub->e);
+                      algorithm_name, pub->n, pub->e);
 }
 
 #endif /* WITH_PUBLIC_KEY */