mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-21 13:53:55 -07:00
changing {} style to match majority of previous style
This commit is contained in:
parent
da6cdf014b
commit
961d929f4d
320 changed files with 5502 additions and 10485 deletions
|
@ -20,8 +20,7 @@
|
|||
#include "crapto1.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
struct Crypto1State *crypto1_create(uint64_t key)
|
||||
{
|
||||
struct Crypto1State *crypto1_create(uint64_t key) {
|
||||
struct Crypto1State *s = malloc(sizeof(*s));
|
||||
if (!s) return NULL;
|
||||
|
||||
|
@ -35,20 +34,17 @@ struct Crypto1State *crypto1_create(uint64_t key)
|
|||
}
|
||||
return s;
|
||||
}
|
||||
void crypto1_destroy(struct Crypto1State *state)
|
||||
{
|
||||
void crypto1_destroy(struct Crypto1State *state) {
|
||||
free(state);
|
||||
}
|
||||
void crypto1_get_lfsr(struct Crypto1State *state, uint64_t *lfsr)
|
||||
{
|
||||
void crypto1_get_lfsr(struct Crypto1State *state, uint64_t *lfsr) {
|
||||
int i;
|
||||
for (*lfsr = 0, i = 23; i >= 0; --i) {
|
||||
*lfsr = *lfsr << 1 | BIT(state->odd, i ^ 3);
|
||||
*lfsr = *lfsr << 1 | BIT(state->even, i ^ 3);
|
||||
}
|
||||
}
|
||||
uint8_t crypto1_bit(struct Crypto1State *s, uint8_t in, int is_encrypted)
|
||||
{
|
||||
uint8_t crypto1_bit(struct Crypto1State *s, uint8_t in, int is_encrypted) {
|
||||
uint32_t feedin;
|
||||
uint32_t tmp;
|
||||
uint8_t ret = filter(s->odd);
|
||||
|
@ -65,8 +61,7 @@ uint8_t crypto1_bit(struct Crypto1State *s, uint8_t in, int is_encrypted)
|
|||
|
||||
return ret;
|
||||
}
|
||||
uint8_t crypto1_byte(struct Crypto1State *s, uint8_t in, int is_encrypted)
|
||||
{
|
||||
uint8_t crypto1_byte(struct Crypto1State *s, uint8_t in, int is_encrypted) {
|
||||
/*
|
||||
uint8_t i, ret = 0;
|
||||
|
||||
|
@ -85,8 +80,7 @@ uint8_t crypto1_byte(struct Crypto1State *s, uint8_t in, int is_encrypted)
|
|||
ret |= crypto1_bit(s, BIT(in, 7), is_encrypted) << 7;
|
||||
return ret;
|
||||
}
|
||||
uint32_t crypto1_word(struct Crypto1State *s, uint32_t in, int is_encrypted)
|
||||
{
|
||||
uint32_t crypto1_word(struct Crypto1State *s, uint32_t in, int is_encrypted) {
|
||||
/*
|
||||
uint32_t i, ret = 0;
|
||||
|
||||
|
@ -136,8 +130,7 @@ uint32_t crypto1_word(struct Crypto1State *s, uint32_t in, int is_encrypted)
|
|||
/* prng_successor
|
||||
* helper used to obscure the keystream during authentication
|
||||
*/
|
||||
uint32_t prng_successor(uint32_t x, uint32_t n)
|
||||
{
|
||||
uint32_t prng_successor(uint32_t x, uint32_t n) {
|
||||
SWAPENDIAN(x);
|
||||
while (n--)
|
||||
x = x >> 1 | (x >> 16 ^ x >> 18 ^ x >> 19 ^ x >> 21) << 31;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue