OpenSSL ECC Engine  1.0
OpenSSL Engine implementation using ATECC508 for ECC key storage and ECDSA, ECDH, and RNG.
Functions | Variables
eccx08_eckey_meth.c File Reference

Implementation of OpenSSL ENGINE callback functions for ECC and RSA key management. See reference code at ec_pmeth.c and crypto/evp/evp_locl.h. More...

#include <stdint.h>
#include <assert.h>
#include <openssl/engine.h>
#include <openssl/ec.h>
#include <openssl/pem.h>
#include <crypto/ec/ec_lcl.h>
#include <crypto/evp/evp.h>
#include <crypto/evp/evp_locl.h>
#include <crypto/asn1/asn1_locl.h>
#include <crypto/ossl_typ.h>
#include "ecc_meth.h"

Functions

EVP_PKEY * eccx08_load_privkey (ENGINE *e, const char *file, UI_METHOD *ui_method, void *callback_data)
 Allocates the EVP_PKEY structure, decrypt the RSA private key, and load it to the allocated EVP_PKEY structure. The encryption key is retrieved from the ECCX08 chip. See the eccx08_rsa_keygen() function from the eccx08_rsa_meth.c file for details. More...
 
EVP_PKEY * eccx08_load_pubkey (ENGINE *e, const char *key_id, UI_METHOD *ui_method, void *callback_data)
 Allocates the EVP_PKEY structure and load there an ECC public key returned by the ECCX08 chip. More...
 
int eccx08_pkey_meth_f (ENGINE *e, EVP_PKEY_METHOD **pkey_meth, const int **nids, int nid)
 Initialize the EVP_PKEY_METHOD method callback for ateccx08 engine. Just returns a pointer to EVP_PKEY_METHOD eccx08_pkey_meth. More...
 
int eccx08_pkey_meth_init (void)
 Initialize the EVP_PKEY_METHOD method for ateccx08 engine. More...
 

Variables

const EVP_PKEY_ASN1_METHOD eckey_asn1_meth
 
EVP_PKEY_METHOD eccx08_pkey_meth
 eccx08_pkey_meth is an OpenSSL EVP_PKEY_METHOD structure specific to the ateccx08 engine. See the crypto/evp/evp_locl.h and crypto/ec/ec_pmeth.c files for details on the EVP_PKEY_METHOD structure (struct evp_pkey_method_st).
 

Detailed Description

Implementation of OpenSSL ENGINE callback functions for ECC and RSA key management. See reference code at ec_pmeth.c and crypto/evp/evp_locl.h.

Copyright (c) 2015 Atmel Corporation. All rights reserved.

Function Documentation

EVP_PKEY* eccx08_load_privkey ( ENGINE *  e,
const char *  file,
UI_METHOD *  ui_method,
void *  callback_data 
)

Allocates the EVP_PKEY structure, decrypt the RSA private key, and load it to the allocated EVP_PKEY structure. The encryption key is retrieved from the ECCX08 chip. See the eccx08_rsa_keygen() function from the eccx08_rsa_meth.c file for details.

Parameters
[in]e- a pointer to the engine (ateccx08 in our case).
[in]file- the file name associated with the private key
[in]ui_method- a pointer to the UI_METHOD structure (not used by the ateccx08 engine)
[in]callback_data- an optional parameter to provide the callback data (not used by the ateccx08 engine)
Returns
EVP_PKEY for success, NULL otherwise
EVP_PKEY* eccx08_load_pubkey ( ENGINE *  e,
const char *  key_id,
UI_METHOD *  ui_method,
void *  callback_data 
)

Allocates the EVP_PKEY structure and load there an ECC public key returned by the ECCX08 chip.

Parameters
[in]e- a pointer to the engine (ateccx08 in our case).
[in]key_id- a string for key ID (not used by the ateccx08 engine)
[in]ui_method- a pointer to the UI_METHOD structure (not used by the ateccx08 engine)
[in]callback_data- an optional parameter to provide the callback data (not used by the ateccx08 engine)
Returns
EVP_PKEY for success, NULL otherwise
int eccx08_pkey_meth_f ( ENGINE *  e,
EVP_PKEY_METHOD **  pkey_meth,
const int **  nids,
int  nid 
)

Initialize the EVP_PKEY_METHOD method callback for ateccx08 engine. Just returns a pointer to EVP_PKEY_METHOD eccx08_pkey_meth.

Parameters
[in]e- a pointer to the engine (ateccx08 in our case).
[out]pkey_meth- a double pointer to EVP_PKEY_METHOD to return the EVP_PKEY_METHOD eccx08_pkey_meth
[out]nids- a double pointer to return an array of nid's (we return 0)
[in]nid- a number of expected nid's (we ignore this parameter)
Returns
1 for success
int eccx08_pkey_meth_init ( void  )

Initialize the EVP_PKEY_METHOD method for ateccx08 engine.

Returns
1 for success