summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/asn1/asn1_local.h
diff options
context:
space:
mode:
authortb <>2023-12-29 10:59:00 +0000
committertb <>2023-12-29 10:59:00 +0000
commit74f37a921dec4d88238715b69fdd65f00d225fda (patch)
tree75f4dda3052f834420459527c235e1bb9b3f059c /src/lib/libcrypto/asn1/asn1_local.h
parentc84e468c4aa089677e98a7754e5fc8cb0cd62e54 (diff)
downloadopenbsd-74f37a921dec4d88238715b69fdd65f00d225fda.tar.gz
openbsd-74f37a921dec4d88238715b69fdd65f00d225fda.tar.bz2
openbsd-74f37a921dec4d88238715b69fdd65f00d225fda.zip
Move the EVP_PKEY_asn1_* API that will stay to evp/p_lib.c
Most of these functions are only called from this file internally apart from the pem_str lookups from pem/. In the next major bump we can then remove asn/ameth_lib.c. Also move EVP_PKEY_ASN1_METHOD to evp_local.h. While this is used to dispatch to various ASN.1 decoding routines, it doesn't fit into asn1/ at all.
Diffstat (limited to 'src/lib/libcrypto/asn1/asn1_local.h')
-rw-r--r--src/lib/libcrypto/asn1/asn1_local.h66
1 files changed, 1 insertions, 65 deletions
diff --git a/src/lib/libcrypto/asn1/asn1_local.h b/src/lib/libcrypto/asn1/asn1_local.h
index 566ace798b..c1dfa6f68c 100644
--- a/src/lib/libcrypto/asn1/asn1_local.h
+++ b/src/lib/libcrypto/asn1/asn1_local.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: asn1_local.h,v 1.4 2023/07/28 10:00:10 tb Exp $ */ 1/* $OpenBSD: asn1_local.h,v 1.5 2023/12/29 10:59:00 tb Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 2006. 3 * project 2006.
4 */ 4 */
@@ -89,70 +89,6 @@ struct asn1_pctx_st {
89 unsigned long str_flags; 89 unsigned long str_flags;
90} /* ASN1_PCTX */; 90} /* ASN1_PCTX */;
91 91
92/* ASN1 public key method structure */
93
94struct evp_pkey_asn1_method_st {
95 int pkey_id;
96 int pkey_base_id;
97 unsigned long pkey_flags;
98
99 char *pem_str;
100 char *info;
101
102 int (*pub_decode)(EVP_PKEY *pk, X509_PUBKEY *pub);
103 int (*pub_encode)(X509_PUBKEY *pub, const EVP_PKEY *pk);
104 int (*pub_cmp)(const EVP_PKEY *a, const EVP_PKEY *b);
105 int (*pub_print)(BIO *out, const EVP_PKEY *pkey, int indent,
106 ASN1_PCTX *pctx);
107
108 int (*priv_decode)(EVP_PKEY *pk, const PKCS8_PRIV_KEY_INFO *p8inf);
109 int (*priv_encode)(PKCS8_PRIV_KEY_INFO *p8, const EVP_PKEY *pk);
110 int (*priv_print)(BIO *out, const EVP_PKEY *pkey, int indent,
111 ASN1_PCTX *pctx);
112
113 int (*pkey_size)(const EVP_PKEY *pk);
114 int (*pkey_bits)(const EVP_PKEY *pk);
115 int (*pkey_security_bits)(const EVP_PKEY *pk);
116
117 int (*param_decode)(EVP_PKEY *pkey, const unsigned char **pder,
118 int derlen);
119 int (*param_encode)(const EVP_PKEY *pkey, unsigned char **pder);
120 int (*param_missing)(const EVP_PKEY *pk);
121 int (*param_copy)(EVP_PKEY *to, const EVP_PKEY *from);
122 int (*param_cmp)(const EVP_PKEY *a, const EVP_PKEY *b);
123 int (*param_print)(BIO *out, const EVP_PKEY *pkey, int indent,
124 ASN1_PCTX *pctx);
125 int (*sig_print)(BIO *out, const X509_ALGOR *sigalg,
126 const ASN1_STRING *sig, int indent, ASN1_PCTX *pctx);
127
128 void (*pkey_free)(EVP_PKEY *pkey);
129 int (*pkey_ctrl)(EVP_PKEY *pkey, int op, long arg1, void *arg2);
130
131 /* Legacy functions for old PEM */
132
133 int (*old_priv_decode)(EVP_PKEY *pkey, const unsigned char **pder,
134 int derlen);
135 int (*old_priv_encode)(const EVP_PKEY *pkey, unsigned char **pder);
136 /* Custom ASN1 signature verification */
137 int (*item_verify)(EVP_MD_CTX *ctx, const ASN1_ITEM *it, void *asn,
138 X509_ALGOR *a, ASN1_BIT_STRING *sig, EVP_PKEY *pkey);
139 int (*item_sign)(EVP_MD_CTX *ctx, const ASN1_ITEM *it, void *asn,
140 X509_ALGOR *alg1, X509_ALGOR *alg2, ASN1_BIT_STRING *sig);
141
142 int (*pkey_check)(const EVP_PKEY *pk);
143 int (*pkey_public_check)(const EVP_PKEY *pk);
144 int (*pkey_param_check)(const EVP_PKEY *pk);
145
146 int (*set_priv_key)(EVP_PKEY *pk, const unsigned char *private_key,
147 size_t len);
148 int (*set_pub_key)(EVP_PKEY *pk, const unsigned char *public_key,
149 size_t len);
150 int (*get_priv_key)(const EVP_PKEY *pk, unsigned char *out_private_key,
151 size_t *out_len);
152 int (*get_pub_key)(const EVP_PKEY *pk, unsigned char *out_public_key,
153 size_t *out_len);
154} /* EVP_PKEY_ASN1_METHOD */;
155
156/* Method to handle CRL access. 92/* Method to handle CRL access.
157 * In general a CRL could be very large (several Mb) and can consume large 93 * In general a CRL could be very large (several Mb) and can consume large
158 * amounts of resources if stored in memory by multiple processes. 94 * amounts of resources if stored in memory by multiple processes.