Ruby
2.5.0dev(2017-10-22revision60238)
|
#include "ruby/missing.h"
#include "crypt.h"
#include <limits.h>
#include <stdio.h>
#include <string.h>
#include "des_tables.c"
Go to the source code of this file.
Data Structures | |
struct | des_tables_t |
Macros | |
#define | _PASSWORD_EFMT1 '_' |
#define | numberof(array) (int)(sizeof(array) / sizeof((array)[0])) |
#define | MUST_ALIGN |
#define | INIT_DES 0 |
#define | INIT_DES 1 |
#define | TO_SIX_BIT(rslt, src) |
#define | ZERO(d, d0, d1) ((d0) = 0, (d1) = 0) |
#define | LOAD(d, d0, d1, bl) ((d0) = (bl).b32.i0, (d1) = (bl).b32.i1) |
#define | LOADREG(d, d0, d1, s, s0, s1) ((d0) = (s0), (d1) = (s1)) |
#define | OR(d, d0, d1, bl) ((d0) |= (bl).b32.i0, (d1) |= (bl).b32.i1) |
#define | STORE(s, s0, s1, bl) ((bl).b32.i0 = (s0), (bl).b32.i1 = (s1)) |
#define | DCL_BLOCK(d, d0, d1) long d0, d1 |
#define | PERM6464(d, d0, d1, cpp, p) { C_block tblk; permute((cpp),&tblk,(p),8); LOAD ((d),(d0),(d1),tblk); } |
#define | PERM3264(d, d0, d1, cpp, p) { C_block tblk; permute((cpp),&tblk,(p),4); LOAD ((d),(d0),(d1),tblk); } |
#define | A64TOI1(c) |
#define | A64TOI4(base) A64TOI1(base+0), A64TOI1(base+1), A64TOI1(base+2), A64TOI1(base+3) |
#define | A64TOI16(base) A64TOI4(base+0), A64TOI4(base+4), A64TOI4(base+8), A64TOI4(base+12) |
#define | A64TOI64(base) A64TOI16(base+0x00), A64TOI16(base+0x10), A64TOI16(base+0x20), A64TOI16(base+0x30) |
#define | des_tables ((const des_tables_t *)des_tables) |
#define | PC1ROT (des_tables->PC1ROT) |
#define | PC2ROT (des_tables->PC2ROT) |
#define | IE3264 (des_tables->IE3264) |
#define | SPE (des_tables->SPE) |
#define | CF6464 (des_tables->CF6464) |
#define | KS (data->KS) |
#define | cryptresult (data->cryptresult) |
#define | SALT salt |
#define | SPTAB(t, i) (*(const unsigned long *)((const unsigned char *)(t) + (i)*(sizeof(long)/4))) |
#define | DOXOR(x, y, i) k=B.b[(i)]; (x)^=SPTAB(SPE[0][(i)],k); (y)^=SPTAB(SPE[1][(i)],k); |
#define | CRUNCH(p0, p1, q0, q1) |
Functions | |
STATIC void | permute (const unsigned char *cp, C_block *out, register const C_block *p, int chars_in) |
STATIC void | init_des (void) |
STATIC void | init_perm (C_block perm[64/CHUNKBITS][1<< CHUNKBITS], unsigned char p[64], int chars_in, int chars_out) |
char * | crypt_r (const char *key, const char *setting, struct crypt_data *data) |
void | setkey_r (const char *key, struct crypt_data *data) |
void | encrypt_r (char *block, int flag, struct crypt_data *data) |
#define A64TOI1 | ( | c | ) |
#define A64TOI64 | ( | base | ) | A64TOI16(base+0x00), A64TOI16(base+0x10), A64TOI16(base+0x20), A64TOI16(base+0x30) |
#define CF6464 (des_tables->CF6464) |
#define CRUNCH | ( | p0, | |
p1, | |||
q0, | |||
q1 | |||
) |
#define des_tables ((const des_tables_t *)des_tables) |
#define IE3264 (des_tables->IE3264) |
#define numberof | ( | array | ) | (int)(sizeof(array) / sizeof((array)[0])) |
#define PC1ROT (des_tables->PC1ROT) |
#define PC2ROT (des_tables->PC2ROT) |
#define SALT salt |
#define SPE (des_tables->SPE) |
#define SPTAB | ( | t, | |
i | |||
) | (*(const unsigned long *)((const unsigned char *)(t) + (i)*(sizeof(long)/4))) |
#define STORE | ( | s, | |
s0, | |||
s1, | |||
bl | |||
) | ((bl).b32.i0 = (s0), (bl).b32.i1 = (s1)) |
#define TO_SIX_BIT | ( | rslt, | |
src | |||
) |
char* crypt_r | ( | const char * | key, |
const char * | setting, | ||
struct crypt_data * | data | ||
) |
Definition at line 396 of file crypt.c.
References C_block::b.
void encrypt_r | ( | char * | block, |
int | flag, | ||
struct crypt_data * | data | ||
) |
Definition at line 835 of file crypt.c.
References C_block::b.
STATIC void init_des | ( | void | ) |
Definition at line 634 of file crypt.c.
References des_tables_t::ready.
STATIC void init_perm | ( | C_block | perm[64/CHUNKBITS][1<< CHUNKBITS], |
unsigned char | p[64], | ||
int | chars_in, | ||
int | chars_out | ||
) |
Definition at line 776 of file crypt.c.
References CHUNKBITS, key, LGCHUNKBITS, setkey(), and setkey_r().
void setkey_r | ( | const char * | key, |
struct crypt_data * | data | ||
) |