summaryrefslogtreecommitdiff
path: root/src/qcommon/crypto.h
blob: 9b21943ddcb44c3828f22a566b393e95794e8e89 (plain)
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
/*
===========================================================================
Copyright (C) 2007-2008 Amanieu d'Antras (amanieu@gmail.com)
Copyright (C) 2015-2016 Jeff Kent (jeff@jkent.net)
Copyright (C) 2015-2019 GrangerHub

This file is part of Tremulous.

Tremulous is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 3 of the License,
or (at your option) any later version.

Tremulous is distributed in the hope that it will be
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with Tremulous; if not, see <https://www.gnu.org/licenses/>

===========================================================================
*/

#ifndef __CRYPTO_H__
#define __CRYPTO_H__

#include "nettle/bignum.h"
#include "nettle/buffer.h"
#include "nettle/rsa.h"
#include "nettle/sha2.h"


#define RSA_PRIVATE_KEY_FILE "rsa_private_key"
#define RSA_PUBLIC_KEY_FILE "rsa_public_key"

#define RSA_PUBLIC_EXPONENT 65537

#define RSA_KEY_LENGTH 4096
#define RSA_STRING_LENGTH (RSA_KEY_LENGTH / 4 + 1)

void Crypto_Init( void );
void qnettle_random( void *ctx, size_t length, uint8_t *dst );

#endif /* __CRYPTO_H__ */