summaryrefslogtreecommitdiffstats
path: root/crypto/evp/p_lib.c
diff options
context:
space:
mode:
authorDr. Stephen Henson <steve@openssl.org>2006-03-22 13:09:35 +0000
committerDr. Stephen Henson <steve@openssl.org>2006-03-22 13:09:35 +0000
commit35208f368ceb7814ad93688657bfa05ff2b548ec (patch)
tree2e66022b19bc685363a327e8fdcc7e083a942d34 /crypto/evp/p_lib.c
parentc788e5936564c6b4927f7236a79aac20b5673986 (diff)
Gather printing routines into EVP_PKEY_ASN1_METHOD.
Diffstat (limited to 'crypto/evp/p_lib.c')
-rw-r--r--crypto/evp/p_lib.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/crypto/evp/p_lib.c b/crypto/evp/p_lib.c
index f22a3fe6bc..7fd31b00a4 100644
--- a/crypto/evp/p_lib.c
+++ b/crypto/evp/p_lib.c
@@ -320,3 +320,37 @@ static void EVP_PKEY_free_it(EVP_PKEY *x)
x->ameth->pkey_free(x);
}
+static int unsup_alg(BIO *out, const EVP_PKEY *pkey, int indent,
+ const char *kstr)
+ {
+ BIO_indent(out, indent, 128);
+ BIO_printf(out, "%s %s, algorithm, unsupported\n",
+ OBJ_nid2ln(pkey->type), kstr);
+ return 1;
+ }
+
+int EVP_PKEY_print_public(BIO *out, const EVP_PKEY *pkey,
+ int indent, ASN1_PCTX *pctx)
+ {
+ if (pkey->ameth && pkey->ameth->pub_print)
+ return pkey->ameth->pub_print(out, pkey, indent, pctx);
+
+ return unsup_alg(out, pkey, indent, "Public Key");
+ }
+
+int EVP_PKEY_print_private(BIO *out, const EVP_PKEY *pkey,
+ int indent, ASN1_PCTX *pctx)
+ {
+ if (pkey->ameth && pkey->ameth->priv_print)
+ return pkey->ameth->priv_print(out, pkey, indent, pctx);
+
+ return unsup_alg(out, pkey, indent, "Private Key");
+ }
+
+int EVP_PKEY_print_params(BIO *out, const EVP_PKEY *pkey,
+ int indent, ASN1_PCTX *pctx)
+ {
+ if (pkey->ameth && pkey->ameth->param_print)
+ return pkey->ameth->param_print(out, pkey, indent, pctx);
+ return unsup_alg(out, pkey, indent, "Parameters");
+ }