Constify X509_PUBKEY_get(), X509_PUBKEY_get0(), and X509_PUBKEY_get0_param()
[openssl.git] / include / crypto / asn1.h
index 674fa704a1655dabdf513f62d3d11f2fa5860ced..d3683649bc1cee310702b64a0a8a3c5a2be21500 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * Copyright 2015-2018 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2015-2020 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the Apache License 2.0 (the "License").  You may not use
  * this file except in compliance with the License.  You can obtain a copy
  *
  * Licensed under the Apache License 2.0 (the "License").  You may not use
  * this file except in compliance with the License.  You can obtain a copy
 
 /* ASN1 public key method structure */
 
 
 /* ASN1 public key method structure */
 
+#include <openssl/core.h>
+
 struct evp_pkey_asn1_method_st {
     int pkey_id;
     int pkey_base_id;
     unsigned long pkey_flags;
     char *pem_str;
     char *info;
 struct evp_pkey_asn1_method_st {
     int pkey_id;
     int pkey_base_id;
     unsigned long pkey_flags;
     char *pem_str;
     char *info;
-    int (*pub_decode) (EVP_PKEY *pk, X509_PUBKEY *pub);
+    int (*pub_decode) (EVP_PKEY *pk, const X509_PUBKEY *pub);
     int (*pub_encode) (X509_PUBKEY *pub, const EVP_PKEY *pk);
     int (*pub_cmp) (const EVP_PKEY *a, const EVP_PKEY *b);
     int (*pub_print) (BIO *out, const EVP_PKEY *pkey, int indent,
     int (*pub_encode) (X509_PUBKEY *pub, const EVP_PKEY *pk);
     int (*pub_cmp) (const EVP_PKEY *a, const EVP_PKEY *b);
     int (*pub_print) (BIO *out, const EVP_PKEY *pkey, int indent,
@@ -68,9 +70,17 @@ struct evp_pkey_asn1_method_st {
      * TODO: Make sure these functions are defined for key types that are
      * implemented in providers.
      */
      * TODO: Make sure these functions are defined for key types that are
      * implemented in providers.
      */
-    /* Exports to providers */
+    /* Exports and imports to / from providers */
     size_t (*dirty_cnt) (const EVP_PKEY *pk);
     size_t (*dirty_cnt) (const EVP_PKEY *pk);
-    void *(*export_to) (const EVP_PKEY *pk, EVP_KEYMGMT *keymgmt);
+    int (*export_to) (const EVP_PKEY *pk, void *to_keydata,
+                      EVP_KEYMGMT *to_keymgmt, OPENSSL_CTX *libctx,
+                      const char *propq);
+    OSSL_CALLBACK *import_from;
+
+    int (*priv_decode_with_libctx) (EVP_PKEY *pk,
+                                    const PKCS8_PRIV_KEY_INFO *p8inf,
+                                    OPENSSL_CTX *libctx,
+                                    const char *propq);
 } /* EVP_PKEY_ASN1_METHOD */ ;
 
 DEFINE_STACK_OF_CONST(EVP_PKEY_ASN1_METHOD)
 } /* EVP_PKEY_ASN1_METHOD */ ;
 
 DEFINE_STACK_OF_CONST(EVP_PKEY_ASN1_METHOD)