Skip to content

Instantly share code, notes, and snippets.

View cosard's full-sized avatar

Coşar Dindar cosard

View GitHub Profile
@cosard
cosard / ecc_sample.c
Created July 12, 2018 11:50
Openssl Elliptic Curve Cryptography (ECC) Example
// Cosar Dindar
// to use 192 bits curve compile with -DUSE_192
// or -DUSE_256 for 256 bits curve
// to use predefined points use -DUSE_PREDEFINED_POINTS or draft curve params will be used
// to create new private and public key use -DGENERATE_KEY otherwise embedded keys will be used
// link with -lssl -lcrypto
// -- ex. gcc ecc_sample.c -g -o ecc_sample -lssl -lcrypto -DUSE_256 -DUSE_PREDEFINED_POINTS -DGENERATE_KEY
#include <string.h>
#include <openssl/ec.h> // for EC_GROUP_new_by_curve_name, EC_GROUP_free, EC_KEY_new, EC_KEY_set_group, EC_KEY_generate_key, EC_KEY_free
@cosard
cosard / app_init.c
Last active March 16, 2017 21:14
atmel pi robot
#include "app_init.h"
#include <stdio.h>
void pwm_init(void)
{
// OC2 sol motor
TCCR2 |= _BV(WGM21) | _BV(WGM20); // OC2 fast pwm mode
TCCR2 &= ~_BV(COM21) & ~_BV(COM20); // disable
//TCCR2 |= _BV(COM21); // Clear OC2 on compare match, set OC2 at BOTTOM
@cosard
cosard / main.c
Last active August 18, 2022 10:49
ds1302 avr library
#include "uart.h"
#include "rtc.c"
// Baud rate setting
#define BAUD 9600
void main(void) {
// Serial channel (9600, N,8,1)
uart_init((UART_BAUD_SELECT((BAUD),F_OSC)));
sei(); // interrupt enable