Update lfops.c
[proxmark3-svn] / client / emv / crypto_backend.h
0 / 50 (  0%)
CommitLineData
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_BACKEND_H
17#define CRYPTO_BACKEND_H
18
19#include "crypto.h"
20
21#include <stddef.h>
22#include <stdarg.h>
23
24struct crypto_hash {
25 enum crypto_algo_hash algo;
26 void (*write)(struct crypto_hash *ch, const unsigned char *buf, size_t len);
27 unsigned char *(*read)(struct crypto_hash *ch);
28 void (*close)(struct crypto_hash *ch);
29 size_t (*get_size)(const struct crypto_hash *ch);
30};
31
32struct crypto_pk {
33 enum crypto_algo_pk algo;
34 unsigned char *(*encrypt)(const struct crypto_pk *cp, const unsigned char *buf, size_t len, size_t *clen);
35 unsigned char *(*decrypt)(const struct crypto_pk *cp, const unsigned char *buf, size_t len, size_t *clen);
36 unsigned char *(*get_parameter)(const struct crypto_pk *cp, unsigned param, size_t *plen);
37 size_t (*get_nbits)(const struct crypto_pk *cp);
38 void (*close)(struct crypto_pk *cp);
39};
40
41struct crypto_backend {
42 struct crypto_hash *(*hash_open)(enum crypto_algo_hash hash);
43 struct crypto_pk *(*pk_open)(enum crypto_algo_pk pk, va_list vl);
44 struct crypto_pk *(*pk_open_priv)(enum crypto_algo_pk pk, va_list vl);
45 struct crypto_pk *(*pk_genkey)(enum crypto_algo_pk pk, va_list vl);
46};
47
48struct crypto_backend *crypto_polarssl_init(void);
49
50#endif
Impressum, Datenschutz