summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/evp/evp_local.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/evp/evp_local.h')
-rw-r--r--src/lib/libcrypto/evp/evp_local.h64
1 files changed, 63 insertions, 1 deletions
diff --git a/src/lib/libcrypto/evp/evp_local.h b/src/lib/libcrypto/evp/evp_local.h
index 1034b88a1a..d21919ac9b 100644
--- a/src/lib/libcrypto/evp/evp_local.h
+++ b/src/lib/libcrypto/evp/evp_local.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: evp_local.h,v 1.9 2023/12/22 17:25:47 tb Exp $ */ 1/* $OpenBSD: evp_local.h,v 1.10 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 2000. 3 * project 2000.
4 */ 4 */
@@ -89,6 +89,68 @@ struct ecx_key_st {
89 size_t pub_key_len; 89 size_t pub_key_len;
90}; 90};
91 91
92struct evp_pkey_asn1_method_st {
93 int pkey_id;
94 int pkey_base_id;
95 unsigned long pkey_flags;
96
97 char *pem_str;
98 char *info;
99
100 int (*pub_decode)(EVP_PKEY *pk, X509_PUBKEY *pub);
101 int (*pub_encode)(X509_PUBKEY *pub, const EVP_PKEY *pk);
102 int (*pub_cmp)(const EVP_PKEY *a, const EVP_PKEY *b);
103 int (*pub_print)(BIO *out, const EVP_PKEY *pkey, int indent,
104 ASN1_PCTX *pctx);
105
106 int (*priv_decode)(EVP_PKEY *pk, const PKCS8_PRIV_KEY_INFO *p8inf);
107 int (*priv_encode)(PKCS8_PRIV_KEY_INFO *p8, const EVP_PKEY *pk);
108 int (*priv_print)(BIO *out, const EVP_PKEY *pkey, int indent,
109 ASN1_PCTX *pctx);
110
111 int (*pkey_size)(const EVP_PKEY *pk);
112 int (*pkey_bits)(const EVP_PKEY *pk);
113 int (*pkey_security_bits)(const EVP_PKEY *pk);
114
115 int (*param_decode)(EVP_PKEY *pkey, const unsigned char **pder,
116 int derlen);
117 int (*param_encode)(const EVP_PKEY *pkey, unsigned char **pder);
118 int (*param_missing)(const EVP_PKEY *pk);
119 int (*param_copy)(EVP_PKEY *to, const EVP_PKEY *from);
120 int (*param_cmp)(const EVP_PKEY *a, const EVP_PKEY *b);
121 int (*param_print)(BIO *out, const EVP_PKEY *pkey, int indent,
122 ASN1_PCTX *pctx);
123 int (*sig_print)(BIO *out, const X509_ALGOR *sigalg,
124 const ASN1_STRING *sig, int indent, ASN1_PCTX *pctx);
125
126 void (*pkey_free)(EVP_PKEY *pkey);
127 int (*pkey_ctrl)(EVP_PKEY *pkey, int op, long arg1, void *arg2);
128
129 /* Legacy functions for old PEM */
130
131 int (*old_priv_decode)(EVP_PKEY *pkey, const unsigned char **pder,
132 int derlen);
133 int (*old_priv_encode)(const EVP_PKEY *pkey, unsigned char **pder);
134 /* Custom ASN1 signature verification */
135 int (*item_verify)(EVP_MD_CTX *ctx, const ASN1_ITEM *it, void *asn,
136 X509_ALGOR *a, ASN1_BIT_STRING *sig, EVP_PKEY *pkey);
137 int (*item_sign)(EVP_MD_CTX *ctx, const ASN1_ITEM *it, void *asn,
138 X509_ALGOR *alg1, X509_ALGOR *alg2, ASN1_BIT_STRING *sig);
139
140 int (*pkey_check)(const EVP_PKEY *pk);
141 int (*pkey_public_check)(const EVP_PKEY *pk);
142 int (*pkey_param_check)(const EVP_PKEY *pk);
143
144 int (*set_priv_key)(EVP_PKEY *pk, const unsigned char *private_key,
145 size_t len);
146 int (*set_pub_key)(EVP_PKEY *pk, const unsigned char *public_key,
147 size_t len);
148 int (*get_priv_key)(const EVP_PKEY *pk, unsigned char *out_private_key,
149 size_t *out_len);
150 int (*get_pub_key)(const EVP_PKEY *pk, unsigned char *out_public_key,
151 size_t *out_len);
152} /* EVP_PKEY_ASN1_METHOD */;
153
92/* Type needs to be a bit field 154/* Type needs to be a bit field
93 * Sub-type needs to be for variations on the method, as in, can it do 155 * Sub-type needs to be for variations on the method, as in, can it do
94 * arbitrary encryption.... */ 156 * arbitrary encryption.... */