aboutsummaryrefslogtreecommitdiffstats
path: root/libqpdf/qpdf/rijndael.h
blob: 5e059491de6cd33e9c11d345cdc3c51b95477140 (plain) (blame)
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
#ifndef RIJNDAEL_H
#define RIJNDAEL_H

#include <qpdf/qpdf-config.h>
#ifdef HAVE_INTTYPES_H
# include <inttypes.h>
#endif
#ifdef HAVE_STDINT_H
# include <stdint.h>
#endif
#include <stddef.h>

unsigned int
rijndaelSetupEncrypt(uint32_t* rk, const unsigned char* key, size_t keybits);
unsigned int
rijndaelSetupDecrypt(uint32_t* rk, const unsigned char* key, size_t keybits);
void rijndaelEncrypt(
    const uint32_t* rk,
    unsigned int nrounds,
    const unsigned char plaintext[16],
    unsigned char ciphertext[16]);
void rijndaelDecrypt(
    const uint32_t* rk,
    unsigned int nrounds,
    const unsigned char ciphertext[16],
    unsigned char plaintext[16]);

#define KEYLENGTH(keybits) ((keybits) / 8)
#define RKLENGTH(keybits) ((keybits) / 8 + 28)
#define NROUNDS(keybits) ((keybits) / 32 + 6)

#endif