-
Notifications
You must be signed in to change notification settings - Fork 0
/
tdf_ps.h
52 lines (42 loc) · 1.67 KB
/
tdf_ps.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/********************************************************************************************
* DAPS: double-authentication preventing signatures
*
* Based on the paper:
* Mihir Bellare, Bertram Poettering, and Douglas Stebila.
* Deterring Certificate Subversion: Efficient Double-Authentication-Preventing Signatures.
* IACR Cryptology ePrint Archive, Report 2016/1016. October, 2016.
* https://eprint.iacr.org/2016/1016
*
* Software originally developed by Douglas Stebila.
*
* Released into the public domain; see LICENSE.txt for details.
********************************************************************************************/
/** \file tdf_ps.h
* Interface for PS trapdoor function.
*/
#ifndef _TDF_PS_H
#define _TDF_PS_H
#include <openssl/bn.h>
typedef struct TDF_PS_pk_st TDF_PS_PK;
struct TDF_PS_pk_st {
BIGNUM *n;
BIGNUM *halfn;
};
typedef struct TDF_PS_tdk_st TDF_PS_TDK;
struct TDF_PS_tdk_st {
BIGNUM *n;
BIGNUM *halfn;
BIGNUM *p;
BIGNUM *q;
};
void TDF_PS_PK_free(TDF_PS_PK *pk);
void TDF_PS_TDK_free(TDF_PS_TDK *tdk);
void TDF_PS_PK_print_fp(FILE *fp, const TDF_PS_PK *pk);
void TDF_PS_TDK_print_fp(FILE *fp, const TDF_PS_TDK *tdk);
int TDF_PS_keygen(TDF_PS_PK **pk, TDF_PS_TDK **tdk, const int bits, BN_CTX *bn_ctx);
int TDF_PS_hash_onto_range(const TDF_PS_PK *pk, const unsigned char *msg, const int msg_length, BIGNUM *r, BN_CTX *bn_ctx);
int TDF_PS_apply(BIGNUM *y, const TDF_PS_PK *pk, const BIGNUM *x, BN_CTX *bn_ctx);
int TDF_PS_inv(BIGNUM *x, const TDF_PS_TDK *tdk, const BIGNUM *y, const int bit, BN_CTX *bn_ctx);
int TDF_PS_decide(const TDF_PS_PK *pk, const BIGNUM *x, BN_CTX *bn_ctx);
int TDF_PS_test(int keylen, int print);
#endif