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

Implementation of OpenSSL ENGINE callback functions for ECC See ec_ameth.c for an example. More...

#include <stdint.h>
#include <stdio.h>
#include <assert.h>
#include <engine.h>
#include <openssl/x509.h>
#include <openssl/ec.h>
#include <openssl/bn.h>
#include <openssl/cms.h>
#include <openssl/asn1t.h>
#include <evp.h>
#include <ossl_typ.h>
#include <err.h>
#include <crypto/asn1/asn1_locl.h>
#include <crypto/ec/ec_lcl.h>
#include <crypto/ecdsa/ecs_locl.h>
#include "ecc_meth.h"

Functions

int eccx08_item_verify (EVP_MD_CTX *ctx, const ASN1_ITEM *it, void *asn, X509_ALGOR *a, ASN1_BIT_STRING *sig, EVP_PKEY *pkey)
 Verify an item signature (not used by ateccx08). More...
 
int eccx08_item_sign (EVP_MD_CTX *ctx, const ASN1_ITEM *it, void *asn, X509_ALGOR *algor1, X509_ALGOR *algor2, ASN1_BIT_STRING *signature)
 Generates a digest then sends the digest to the ATECCX08 chip to generate an ECDSA signature using private key from TLS_SLOT_AUTH_PRIV slot. The private key is always stays in the chip: OpenSSL (nor any other software) has no way to read it. More...
 
int eccx08_pkey_asn1_meth_f (ENGINE *e, EVP_PKEY_ASN1_METHOD **pkey_asn1_meth, const int **nids, int nid)
 Initialize the EVP_PKEY_ASN1_METHOD method callback for ateccx08 engine. Just returns a pointer to EVP_PKEY_METHOD eccx08_pkey_meth. More...
 
int eccx08_pkey_asn1_meth_init (void)
 Initialize the EVP_PKEY_ASN1_METHOD method for ateccx08 engine. More...
 

Variables

EVP_PKEY_ASN1_METHOD eccx08_pkey_asn1_meth
 eccx08_pkey_asn1_meth is an OpenSSL EVP_PKEY_ASN1_METHOD structure specific to the ateccx08 engine. See the crypto/asn1/asn1_locl.h file for details on the struct evp_pkey_asn1_method_st
 

Detailed Description

Implementation of OpenSSL ENGINE callback functions for ECC See ec_ameth.c for an example.

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

Function Documentation

int eccx08_item_sign ( EVP_MD_CTX *  ctx,
const ASN1_ITEM *  it,
void *  asn,
X509_ALGOR *  algor1,
X509_ALGOR *  algor2,
ASN1_BIT_STRING *  signature 
)

Generates a digest then sends the digest to the ATECCX08 chip to generate an ECDSA signature using private key from TLS_SLOT_AUTH_PRIV slot. The private key is always stays in the chip: OpenSSL (nor any other software) has no way to read it.

Parameters
[in]ctx- a pointer to the EVP_MD_CTX structure
[in]it- a pointer to the ASN1_ITEM structure
[in]asn- a void pointer to the parameter
[in]algor1- a pointer to the X509_ALGOR structure
[in]algor2- a pointer to the X509_ALGOR structure
[out]signature- a pointer to the ASN1_BIT_STRING structure to return the signature in the ASN.1 format
Returns
1 for success
int eccx08_item_verify ( EVP_MD_CTX *  ctx,
const ASN1_ITEM *  it,
void *  asn,
X509_ALGOR *  a,
ASN1_BIT_STRING *  sig,
EVP_PKEY *  pkey 
)

Verify an item signature (not used by ateccx08).

Parameters
[in]ctx- a pointer to the EVP_MD_CTX structure
[in]it- a pointer to the ASN1_ITEM structure
[in]asn- a void pointer to the parameter
[in]a- a pointer to the X509_ALGOR structure
[in]sig- a pointer to the ASN1_BIT_STRING structure
[in]pkey- a pointer to the EVP_PKEY structure
Returns
1 for success
int eccx08_pkey_asn1_meth_f ( ENGINE *  e,
EVP_PKEY_ASN1_METHOD **  pkey_asn1_meth,
const int **  nids,
int  nid 
)

Initialize the EVP_PKEY_ASN1_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_asn1_meth- a double pointer to EVP_PKEY_ASN1_METHOD to return the EVP_PKEY_ASN1_METHOD eccx08_pkey_asn1_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_asn1_meth_init ( void  )

Initialize the EVP_PKEY_ASN1_METHOD method for ateccx08 engine.

Returns
1 for success