fix one too small
[RRG-proxmark3.git] / client / src / emv / crypto.h
blob21a089d179ce4c1d9629d9b4b345225a9ed48d69
1 //-----------------------------------------------------------------------------
2 // Borrowed initially from https://github.com/lumag/emv-tools/
3 // Copyright (C) 2012, 2015 Dmitry Eremin-Solenikov
4 // Copyright (C) Proxmark3 contributors. See AUTHORS.md for details.
5 //
6 // This program is free software: you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation, either version 3 of the License, or
9 // (at your option) any later version.
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // See LICENSE.txt for the text of the license.
17 //-----------------------------------------------------------------------------
18 // libopenemv - a library to work with EMV family of smart cards
19 //-----------------------------------------------------------------------------
21 #ifndef CRYPTO_H
22 #define CRYPTO_H
24 #include "common.h"
26 enum crypto_algo_hash {
27 HASH_INVALID,
28 HASH_SHA_1,
31 struct crypto_hash *crypto_hash_open(enum crypto_algo_hash hash);
32 void crypto_hash_close(struct crypto_hash *ch);
33 void crypto_hash_write(struct crypto_hash *ch, const unsigned char *buf, size_t len);
34 unsigned char *crypto_hash_read(struct crypto_hash *ch);
35 size_t crypto_hash_get_size(const struct crypto_hash *ch);
37 enum crypto_algo_pk {
38 PK_INVALID,
39 PK_RSA,
42 struct crypto_pk *crypto_pk_open(enum crypto_algo_pk pk, ...);
43 struct crypto_pk *crypto_pk_open_priv(enum crypto_algo_pk pk, ...);
44 struct crypto_pk *crypto_pk_genkey(enum crypto_algo_pk pk, ...);
45 void crypto_pk_close(struct crypto_pk *cp);
46 unsigned char *crypto_pk_encrypt(const struct crypto_pk *cp, const unsigned char *buf, size_t len, size_t *clen);
47 unsigned char *crypto_pk_decrypt(const struct crypto_pk *cp, const unsigned char *buf, size_t len, size_t *clen);
48 enum crypto_algo_pk crypto_pk_get_algo(const struct crypto_pk *cp);
49 size_t crypto_pk_get_nbits(const struct crypto_pk *cp);
50 unsigned char *crypto_pk_get_parameter(const struct crypto_pk *cp, unsigned param, size_t *plen);
52 #endif