mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-08-08 17:42:09 +03:00
Use generic x509_get_pubkey() for RSA functions
This commit is contained in:
committed by
Paul Bakker
parent
4fa0476675
commit
244569f4b1
@@ -27,6 +27,12 @@
|
||||
#ifndef POLARSSL_PK_H
|
||||
#define POLARSSL_PK_H
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#if defined(POLARSSL_RSA_C)
|
||||
#include "rsa.h"
|
||||
#endif
|
||||
|
||||
#define POLARSSL_ERR_PK_MALLOC_FAILED -0x2F80 /**< Memory alloation failed. */
|
||||
#define POLARSSL_ERR_PK_TYPE_MISMATCH -0x2F00 /**< Type mismatch, eg attempt to use a RSA key as EC, or to modify key type */
|
||||
|
||||
@@ -53,8 +59,9 @@ typedef enum {
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
pk_type_t type; /**< Public key type */
|
||||
void * data; /**< Public key data */
|
||||
pk_type_t type; /**< Public key type */
|
||||
void * data; /**< Public key data */
|
||||
int dont_free; /**< True if data must not be freed */
|
||||
} pk_context;
|
||||
|
||||
/**
|
||||
@@ -82,6 +89,21 @@ void pk_free( pk_context *ctx );
|
||||
*/
|
||||
int pk_set_type( pk_context *ctx, pk_type_t type );
|
||||
|
||||
#if defined(POLARSSL_RSA_C)
|
||||
/**
|
||||
* \brief Wrap a RSA context in a PK context
|
||||
*
|
||||
* \param ctx PK context to initiliaze
|
||||
* \param rsa RSA context to use
|
||||
*
|
||||
* \note The PK context must be freshly initialized.
|
||||
*
|
||||
* \return O on success,
|
||||
* POLARSSL_ERR_PK_TYPE_MISMATCH if ctx was not empty.
|
||||
*/
|
||||
int pk_wrap_rsa( pk_context *ctx, const rsa_context *rsa);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user