Move pk_info structure to its own file
This is in preparation to adding support for opaque keys in the pk layer. The
header files are for use as follows:
* pk.h for users of the pk interface.
* pk_info.h for implementers of opaque key engines.
* pk_internal.h only inside libmbedcrypto to implement built-in pk types.
diff --git a/include/mbedtls/pk_internal.h b/include/mbedtls/pk_internal.h
index 4823294..06475e9 100644
--- a/include/mbedtls/pk_internal.h
+++ b/include/mbedtls/pk_internal.h
@@ -1,9 +1,9 @@
/**
- * \file pk.h
+ * \file pk_internal.h
*
- * \brief Public Key cryptography abstraction layer: wrapper functions
+ * \brief Public Key cryptography abstraction layer: built-in key types
*
- * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved
+ * Copyright (C) 2006-2017, ARM Limited, All Rights Reserved
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may
@@ -21,8 +21,8 @@
* This file is part of mbed TLS (https://tls.mbed.org)
*/
-#ifndef MBEDTLS_PK_WRAP_H
-#define MBEDTLS_PK_WRAP_H
+#ifndef MBEDTLS_PK_INTERNAL_H
+#define MBEDTLS_PK_INTERNAL_H
#if !defined(MBEDTLS_CONFIG_FILE)
#include "config.h"
@@ -32,60 +32,6 @@
#include "pk.h"
-struct mbedtls_pk_info_t
-{
- /** Key pair type with indication of supported algorithms */
- mbedtls_pk_type_t type;
-
- /** Type name */
- const char *name;
-
- /** Get key size in bits */
- size_t (*get_bitlen)( const void *ctx );
-
- /** Tell if the context implements this type (e.g. ECKEY can do ECDSA) */
- int (*can_do)( const void * ctx, mbedtls_pk_type_t type );
-
- /** Verify signature */
- int (*verify_func)( void *ctx, mbedtls_md_type_t md_alg,
- const unsigned char *hash, size_t hash_len,
- const unsigned char *sig, size_t sig_len );
-
- /** Make signature */
- int (*sign_func)( void *ctx, mbedtls_md_type_t md_alg,
- const unsigned char *hash, size_t hash_len,
- unsigned char *sig, size_t *sig_len,
- int (*f_rng)(void *, unsigned char *, size_t),
- void *p_rng );
-
- /** Decrypt message */
- int (*decrypt_func)( void *ctx, const unsigned char *input, size_t ilen,
- unsigned char *output, size_t *olen, size_t osize,
- int (*f_rng)(void *, unsigned char *, size_t),
- void *p_rng );
-
- /** Encrypt message */
- int (*encrypt_func)( void *ctx, const unsigned char *input, size_t ilen,
- unsigned char *output, size_t *olen, size_t osize,
- int (*f_rng)(void *, unsigned char *, size_t),
- void *p_rng );
-
- /** Check public-private key pair */
- int (*check_pair_func)( const void *pub, const void *prv );
-
- /** Allocate a new context */
- void * (*ctx_alloc_func)( void );
-
- /** Free the given context */
- void (*ctx_free_func)( void *ctx );
-
- /** Interface with the debug module */
- void (*debug_func)( const void *ctx, mbedtls_pk_debug_item *items );
-
- /** Signature size */
- size_t (*signature_size_func)( const void *ctx );
-};
-
#if defined(MBEDTLS_PK_RSA_ALT_SUPPORT)
/* Container for RSA-alt */
typedef struct
@@ -114,4 +60,4 @@
extern const mbedtls_pk_info_t mbedtls_rsa_alt_info;
#endif
-#endif /* MBEDTLS_PK_WRAP_H */
+#endif /* MBEDTLS_PK_INTERNAL_H */