Exemplo n.º 1
0
/** \brief This test will write a default configuration and lock a blank device for testing.
 * If the part is already locked, it will verify the configuration zone against the default configuraion.
 *  \return void
 */
void test_atcatls_config_default(void)
{
	ATCA_STATUS status = ATCA_GEN_FAIL;

	status = atcatls_init(g_pCfg);
	TEST_ASSERT_EQUAL(ATCA_SUCCESS, status);

	status = atcatls_config_default();
	TEST_ASSERT_EQUAL(ATCA_SUCCESS, status);

	status = atcatls_finish();
	TEST_ASSERT_EQUAL(ATCA_SUCCESS, status);
}
Exemplo n.º 2
0
void atmel_init(void)
{
    if (!mAtcaInitDone) {
#ifdef WOLFSSL_ATECC508A
        int i;

        /* Init the free slot list */
        for (i=0; i<=ATECC_MAX_SLOT; i++) {
            if (i == 0 || i == 2 || i == 7) {
                /* ECC Slots (mark avail) */
                mSlotList[i] = ATECC_INVALID_SLOT;
            }
            else {
                mSlotList[i] = i;
            }
        }

        /* Initialize the CryptoAuthLib to communicate with ATECC508A */
        atcatls_init(&cfg_ateccx08a_i2c_default);

        /* Init the I2C pipe encryption key. */
        /* Value is generated/stored during pair for the ATECC508A and stored
            on micro flash */
        /* For this example its a fixed value */
		if (atmel_init_enc_key() != ATCA_SUCCESS) {
			WOLFSSL_MSG("Failed to initialize transport key");
		}

        /* show revision information */
        atmel_show_rev_info();

        /* Configure the ECC508 for use with TLS API funcitons */
    #if 0
        atcatls_device_provision();
    #else
        atcatls_config_default();
    #endif
#endif /* WOLFSSL_ATECC508A */

        mAtcaInitDone = 1;
    }
}