Skip to content

Commit 2282241

Browse files
committed
really define LTC_{DE,EN}CRYPT
1 parent a3a199e commit 2282241

4 files changed

Lines changed: 15 additions & 10 deletions

File tree

src/headers/tomcrypt_cfg.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,11 @@ LTC_EXPORT int LTC_CALL XSTRCMP(const char *s1, const char *s2);
6464
#define ARGTYPE 0
6565
#endif
6666

67+
#undef LTC_ENCRYPT
68+
#define LTC_ENCRYPT 0
69+
#undef LTC_DECRYPT
70+
#define LTC_DECRYPT 1
71+
6772
/* Controls endianess and size of registers. Leave uncommented to get platform neutral [slower] code
6873
*
6974
* Note: in order to use the optimized macros your platform must support unaligned 32 and 64 bit read/writes.

src/headers/tomcrypt_cipher.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -875,8 +875,8 @@ int ctr_test(void);
875875

876876
#ifdef LTC_LRW_MODE
877877

878-
#define LRW_ENCRYPT 0
879-
#define LRW_DECRYPT 1
878+
#define LRW_ENCRYPT LTC_ENCRYPT
879+
#define LRW_DECRYPT LTC_DECRYPT
880880

881881
int lrw_start( int cipher,
882882
const unsigned char *IV,

src/headers/tomcrypt_mac.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -311,8 +311,8 @@ void ocb3_int_xor_blocks(unsigned char *out, const unsigned char *block_a, const
311311

312312
#ifdef LTC_CCM_MODE
313313

314-
#define CCM_ENCRYPT 0
315-
#define CCM_DECRYPT 1
314+
#define CCM_ENCRYPT LTC_ENCRYPT
315+
#define CCM_DECRYPT LTC_DECRYPT
316316

317317
typedef struct {
318318
symmetric_key K;
@@ -378,8 +378,8 @@ extern const unsigned char gcm_shift_table[];
378378

379379
#ifdef LTC_GCM_MODE
380380

381-
#define GCM_ENCRYPT 0
382-
#define GCM_DECRYPT 1
381+
#define GCM_ENCRYPT LTC_ENCRYPT
382+
#define GCM_DECRYPT LTC_DECRYPT
383383

384384
#define LTC_GCM_MODE_IV 0
385385
#define LTC_GCM_MODE_AAD 1
@@ -542,8 +542,8 @@ typedef struct {
542542
int aadflg;
543543
} chacha20poly1305_state;
544544

545-
#define CHCHA20POLY1305_ENCRYPT 0
546-
#define CHCHA20POLY1305_DECRYPT 1
545+
#define CHCHA20POLY1305_ENCRYPT LTC_ENCRYPT
546+
#define CHCHA20POLY1305_DECRYPT LTC_DECRYPT
547547

548548
int chacha20poly1305_init(chacha20poly1305_state *st, const unsigned char *key, unsigned long keylen);
549549
int chacha20poly1305_setiv(chacha20poly1305_state *st, const unsigned char *iv, unsigned long ivlen);

src/misc/crypt/crypt_constants.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ static const crypt_constant _crypt_constants[] = {
3030
_C_STRINGIFY(PK_PUBLIC),
3131
_C_STRINGIFY(PK_PRIVATE),
3232

33-
{"LTC_ENCRYPT", 0}, /* good for all other xxx_ENCRYPT prefixes */
34-
{"LTC_DECRYPT", 1}, /* good for all other xxx_DECRYPT prefixes */
33+
_C_STRINGIFY(LTC_ENCRYPT),
34+
_C_STRINGIFY(LTC_DECRYPT),
3535

3636
_C_STRINGIFY(PKA_RSA),
3737
_C_STRINGIFY(PKA_DSA),

0 commit comments

Comments
 (0)