]> git.zerfleddert.de Git - proxmark3-svn/blame - client/emv/crypto.h
fixing some fpga and iclass issues
[proxmark3-svn] / client / emv / crypto.h
CommitLineData
d03fb293
OM
1/*
2 * libopenemv - a library to work with EMV family of smart cards
3 * Copyright (C) 2015 Dmitry Eremin-Solenikov
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 */
15
16#ifndef CRYPTO_H
17#define CRYPTO_H
18
19#include <stdbool.h>
20#include <stddef.h>
21
22enum crypto_algo_hash {
23 HASH_INVALID,
24 HASH_SHA_1,
25};
26
27struct crypto_hash *crypto_hash_open(enum crypto_algo_hash hash);
28void crypto_hash_close(struct crypto_hash *ch);
29void crypto_hash_write(struct crypto_hash *ch, const unsigned char *buf, size_t len);
30unsigned char *crypto_hash_read(struct crypto_hash *ch);
31size_t crypto_hash_get_size(const struct crypto_hash *ch);
32
33enum crypto_algo_pk {
34 PK_INVALID,
35 PK_RSA,
36};
37
38struct crypto_pk *crypto_pk_open(enum crypto_algo_pk pk, ...);
39struct crypto_pk *crypto_pk_open_priv(enum crypto_algo_pk pk, ...);
40struct crypto_pk *crypto_pk_genkey(enum crypto_algo_pk pk, ...);
41void crypto_pk_close(struct crypto_pk *cp);
42unsigned char *crypto_pk_encrypt(const struct crypto_pk *cp, const unsigned char *buf, size_t len, size_t *clen);
43unsigned char *crypto_pk_decrypt(const struct crypto_pk *cp, const unsigned char *buf, size_t len, size_t *clen);
44enum crypto_algo_pk crypto_pk_get_algo(const struct crypto_pk *cp);
45size_t crypto_pk_get_nbits(const struct crypto_pk *cp);
46unsigned char *crypto_pk_get_parameter(const struct crypto_pk *cp, unsigned param, size_t *plen);
47
48#endif
Impressum, Datenschutz