From e46691a0bc17cad1e242668792a796ac50be7456 Mon Sep 17 00:00:00 2001 From: "Dr. Stephen Henson" Date: Wed, 5 Apr 2006 13:24:19 +0000 Subject: [PATCH] New function to add dynamic alias. --- crypto/asn1/ameth_lib.c | 13 ++++++++++++- crypto/evp/evp.h | 3 ++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/crypto/asn1/ameth_lib.c b/crypto/asn1/ameth_lib.c index 6b4690e5b7..60d159477c 100644 --- a/crypto/asn1/ameth_lib.c +++ b/crypto/asn1/ameth_lib.c @@ -172,7 +172,7 @@ const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_find_str(const char *str, int len) return NULL; } -int EVP_PKEY_asn1_add(const EVP_PKEY_ASN1_METHOD *ameth) +int EVP_PKEY_asn1_add0(const EVP_PKEY_ASN1_METHOD *ameth) { if (app_methods == NULL) { @@ -186,6 +186,17 @@ int EVP_PKEY_asn1_add(const EVP_PKEY_ASN1_METHOD *ameth) return 1; } +int EVP_PKEY_asn1_add_alias(int to, int from) + { + EVP_PKEY_ASN1_METHOD *ameth; + ameth = EVP_PKEY_asn1_new(from, NULL, NULL); + if (!ameth) + return 0; + ameth->pkey_base_id = to; + ameth->pkey_flags |= ASN1_PKEY_ALIAS; + return EVP_PKEY_asn1_add0(ameth); + } + int EVP_PKEY_asn1_get0_info(int *ppkey_id, int *ppkey_base_id, int *ppkey_flags, const char **pinfo, const char **ppem_str, const EVP_PKEY_ASN1_METHOD *ameth) diff --git a/crypto/evp/evp.h b/crypto/evp/evp.h index dcf9933131..d06904b7ec 100644 --- a/crypto/evp/evp.h +++ b/crypto/evp/evp.h @@ -863,7 +863,8 @@ int EVP_PKEY_asn1_get_count(void); const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_get0(int idx); const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_find(int type); const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_find_str(const char *str, int len); -int EVP_PKEY_asn1_add(const EVP_PKEY_ASN1_METHOD *ameth); +int EVP_PKEY_asn1_add0(const EVP_PKEY_ASN1_METHOD *ameth); +int EVP_PKEY_asn1_add_alias(int to, int from); int EVP_PKEY_asn1_get0_info(int *ppkey_id, int *pkey_base_id, int *ppkey_flags, const char **pinfo, const char **ppem_str, const EVP_PKEY_ASN1_METHOD *ameth);