From: bg Date: Wed, 14 Nov 2012 01:04:34 +0000 (+0100) Subject: forgotten files X-Git-Url: https://git.cryptolib.org/?a=commitdiff_plain;h=39983bbdb6dbbe196ccc7075d7664fca3168f695;p=avr-crypto-lib.git forgotten files --- diff --git a/ecdsa/ecdsa.h b/ecdsa/ecdsa.h new file mode 100644 index 0000000..9559417 --- /dev/null +++ b/ecdsa/ecdsa.h @@ -0,0 +1,57 @@ +/* ecdsa.h */ +/* + This file is part of the AVR-Crypto-Lib. + Copyright (C) 2012 Daniel Otte (daniel.otte@rub.de) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#ifndef ECDSA_H_ +#define ECDSA_H_ + +#include "ecc.h" +#include "hashfunction_descriptor.h" + +typedef struct{ + bigint_t r; + bigint_t s; +} ecdsa_signature_t; + +typedef bigint_t ecdsa_privkey_t; +typedef ecc_affine_point_t ecdsa_pubkey_t; + +typedef struct{ + ecdsa_privkey_t *priv; + ecdsa_pubkey_t *pub; + ecc_curve_sp_t *curve; + ecc_chudnovsky_point_t *basepoint; +} ecdsa_ctx_t; + +typedef uint8_t(*rand_func_ptr_t)(void); + +#define ECDSA_SIGNATURE_OK 1 +#define ECDSA_SIGNATURE_FAIL 0 + +uint8_t ecdsa_sign_bigint(ecdsa_signature_t* s, const bigint_t* m, + const ecdsa_ctx_t* ctx, const bigint_t* k); +uint8_t ecdsa_sign_message(ecdsa_signature_t* s, const void* m, uint16_t m_len_b, + const hfdesc_t* hash_desc, const ecdsa_ctx_t* ctx, + const void *rand_in); +uint8_t ecdsa_verify_bigint(const ecdsa_signature_t* s, const bigint_t* m, + const ecdsa_ctx_t* ctx); +uint8_t ecdsa_verify_message(const ecdsa_signature_t* s, const void* m, uint16_t m_len_b, + const hfdesc_t* hash_desc, const ecdsa_ctx_t* ctx); + + +#endif /* ECDSA_H_ */ diff --git a/ecdsa/random_dummy.c b/ecdsa/random_dummy.c new file mode 100644 index 0000000..70a29df --- /dev/null +++ b/ecdsa/random_dummy.c @@ -0,0 +1,24 @@ +/* random_dummy.c */ +/* + This file is part of the ARM-Crypto-Lib. + Copyright (C) 2006-2011 Daniel Otte (daniel.otte@rub.de) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#include +#include "random_dummy.h" + +uint8_t(*prng_get_byte)(void); + diff --git a/ecdsa/random_dummy.h b/ecdsa/random_dummy.h new file mode 100644 index 0000000..937d5de --- /dev/null +++ b/ecdsa/random_dummy.h @@ -0,0 +1,27 @@ +/* random.h */ +/* + This file is part of the AVR-Crypto-Lib. + Copyright (C) 2011 Daniel Otte (daniel.otte@rub.de) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#ifndef RANDOM_H_ +#define RANDOM_H_ + +#include + +extern uint8_t(*prng_get_byte)(void); + +#endif /* RANDOM_H_ */