Subversion Repositories planix.SVN

Rev

Rev 2 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 - 1
#include "os.h"
2
#include <mp.h>
3
#include <libsec.h>
4
 
5
EGpub*
6
egpuballoc(void)
7
{
8
	EGpub *eg;
9
 
10
	eg = mallocz(sizeof(*eg), 1);
11
	if(eg == nil)
12
		sysfatal("egpuballoc");
13
	return eg;
14
}
15
 
16
void
17
egpubfree(EGpub *eg)
18
{
19
	if(eg == nil)
20
		return;
21
	mpfree(eg->p);
22
	mpfree(eg->alpha);
23
	mpfree(eg->key);
24
}
25
 
26
 
27
EGpriv*
28
egprivalloc(void)
29
{
30
	EGpriv *eg;
31
 
32
	eg = mallocz(sizeof(*eg), 1);
33
	if(eg == nil)
34
		sysfatal("egprivalloc");
35
	return eg;
36
}
37
 
38
void
39
egprivfree(EGpriv *eg)
40
{
41
	if(eg == nil)
42
		return;
43
	mpfree(eg->pub.p);
44
	mpfree(eg->pub.alpha);
45
	mpfree(eg->pub.key);
46
	mpfree(eg->secret);
47
}
48
 
49
EGsig*
50
egsigalloc(void)
51
{
52
	EGsig *eg;
53
 
54
	eg = mallocz(sizeof(*eg), 1);
55
	if(eg == nil)
56
		sysfatal("egsigalloc");
57
	return eg;
58
}
59
 
60
void
61
egsigfree(EGsig *eg)
62
{
63
	if(eg == nil)
64
		return;
65
	mpfree(eg->r);
66
	mpfree(eg->s);
67
}