Upload CREBench benchmark corpus (48 algorithms, 432 instances)
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- CREBench/3-Way/Makefile +9 -0
- CREBench/3-Way/challenge_src/Makefile +22 -0
- CREBench/3-Way/challenge_src/challenge.c +86 -0
- CREBench/3-Way/challenge_src/constxor_tables.c +79 -0
- CREBench/3-Way/challenge_src/constxor_tables.h +8 -0
- CREBench/3-Way/challenge_src/generated/fragmented_build/challenge.c +88 -0
- CREBench/3-Way/challenge_src/generated/fragmented_build/key_source.c +34 -0
- CREBench/3-Way/challenge_src/generated/fragmented_build/metadata.json +10 -0
- CREBench/3-Way/challenge_src/generated/hardcode_plain/challenge.c +88 -0
- CREBench/3-Way/challenge_src/generated/hardcode_plain/key_source.c +19 -0
- CREBench/3-Way/challenge_src/generated/hardcode_plain/metadata.json +10 -0
- CREBench/3-Way/challenge_src/generated/weak_prng_seeded/challenge.c +88 -0
- CREBench/3-Way/challenge_src/generated/weak_prng_seeded/key_source.c +22 -0
- CREBench/3-Way/challenge_src/generated/weak_prng_seeded/metadata.json +10 -0
- CREBench/3-Way/challenge_src/key_source.c +19 -0
- CREBench/3-Way/config.yaml +51 -0
- CREBench/3-Way/public-fragmented_build-O0/address.json +57 -0
- CREBench/3-Way/public-fragmented_build-O0/challenge +0 -0
- CREBench/3-Way/public-fragmented_build-O0/decompile/FUN_00101020_decompiled +9 -0
- CREBench/3-Way/public-fragmented_build-O0/decompile/FUN_001010a0_decompiled +8 -0
- CREBench/3-Way/public-fragmented_build-O0/decompile/FUN_00101150_decompiled +10 -0
- CREBench/3-Way/public-fragmented_build-O0/decompile/FUN_00101180_decompiled +10 -0
- CREBench/3-Way/public-fragmented_build-O0/decompile/FUN_00101209_decompiled +25 -0
- CREBench/3-Way/public-fragmented_build-O0/decompile/FUN_0010125c_decompiled +28 -0
- CREBench/3-Way/public-fragmented_build-O0/decompile/FUN_00101331_decompiled +12 -0
- CREBench/3-Way/public-fragmented_build-O0/decompile/FUN_00101389_decompiled +68 -0
- CREBench/3-Way/public-fragmented_build-O0/decompile/FUN_001015cc_decompiled +16 -0
- CREBench/3-Way/public-fragmented_build-O0/decompile/FUN_00101636_decompiled +14 -0
- CREBench/3-Way/public-fragmented_build-O0/decompile/FUN_001016ad_decompiled +7 -0
- CREBench/3-Way/public-fragmented_build-O0/decompile/FUN_001016c9_decompiled +11 -0
- CREBench/3-Way/public-fragmented_build-O0/decompile/FUN_00101728_decompiled +7 -0
- CREBench/3-Way/public-fragmented_build-O0/decompile/FUN_0010175f_decompiled +8 -0
- CREBench/3-Way/public-fragmented_build-O0/decompile/FUN_001017b2_decompiled +11 -0
- CREBench/3-Way/public-fragmented_build-O0/decompile/FUN_00101803_decompiled +7 -0
- CREBench/3-Way/public-fragmented_build-O0/decompile/FUN_00101854_decompiled +11 -0
- CREBench/3-Way/public-fragmented_build-O0/decompile/FUN_001018a7_decompiled +16 -0
- CREBench/3-Way/public-fragmented_build-O0/decompile/FUN_00101901_decompiled +18 -0
- CREBench/3-Way/public-fragmented_build-O0/decompile/FUN_0010199e_decompiled +20 -0
- CREBench/3-Way/public-fragmented_build-O0/decompile/FUN_00101aa3_decompiled +9 -0
- CREBench/3-Way/public-fragmented_build-O0/decompile/FUN_00101aec_decompiled +13 -0
- CREBench/3-Way/public-fragmented_build-O0/decompile/FUN_00101b13_decompiled +16 -0
- CREBench/3-Way/public-fragmented_build-O0/decompile/FUN_00101b77_decompiled +19 -0
- CREBench/3-Way/public-fragmented_build-O0/decompile/FUN_00101bd3_decompiled +42 -0
- CREBench/3-Way/public-fragmented_build-O0/decompile/FUN_00101cea_decompiled +38 -0
- CREBench/3-Way/public-fragmented_build-O0/decompile/FUN_00101e65_decompiled +40 -0
- CREBench/3-Way/public-fragmented_build-O0/decompile/FUN_0010200e_decompiled +12 -0
- CREBench/3-Way/public-fragmented_build-O0/decompile/FUN_0010206c_decompiled +12 -0
- CREBench/3-Way/public-fragmented_build-O0/decompile/FUN_001020ca_decompiled +31 -0
- CREBench/3-Way/public-fragmented_build-O0/decompile/FUN_001021bf_decompiled +34 -0
- CREBench/3-Way/public-fragmented_build-O0/decompile/_DT_FINI_decompiled +7 -0
CREBench/3-Way/Makefile
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
.PHONY: all challenge clean
|
| 2 |
+
|
| 3 |
+
all: challenge
|
| 4 |
+
|
| 5 |
+
challenge:
|
| 6 |
+
$(MAKE) -C challenge_src
|
| 7 |
+
|
| 8 |
+
clean:
|
| 9 |
+
$(MAKE) -C challenge_src clean
|
CREBench/3-Way/challenge_src/Makefile
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
CC := cc
|
| 2 |
+
CFLAGS := -O3 -Wall -Wextra -std=c11
|
| 3 |
+
CPPFLAGS := -I../src
|
| 4 |
+
LTO ?= -flto
|
| 5 |
+
STRIP_CMD ?= strip
|
| 6 |
+
|
| 7 |
+
SRCS := challenge.c key_source.c ../src/threeway.c
|
| 8 |
+
OBJS := $(SRCS:.c=.o)
|
| 9 |
+
|
| 10 |
+
TARGET := ../public/challenge
|
| 11 |
+
|
| 12 |
+
all: $(TARGET)
|
| 13 |
+
|
| 14 |
+
$(TARGET): $(OBJS)
|
| 15 |
+
@mkdir -p ../public
|
| 16 |
+
$(CC) $(CFLAGS) -o $@ $(OBJS) $(LTO)
|
| 17 |
+
$(STRIP_CMD) $@
|
| 18 |
+
|
| 19 |
+
clean:
|
| 20 |
+
rm -f $(OBJS) $(TARGET)
|
| 21 |
+
|
| 22 |
+
.PHONY: all clean
|
CREBench/3-Way/challenge_src/challenge.c
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*
|
| 2 |
+
* 3-Way CTF Challenge
|
| 3 |
+
*
|
| 4 |
+
* This program takes a 48-byte (96 hex characters) input and encrypts it
|
| 5 |
+
* using 3-Way in ECB mode. The goal is to find the plaintext
|
| 6 |
+
* that produces a specific ciphertext.
|
| 7 |
+
*/
|
| 8 |
+
#include <stdio.h>
|
| 9 |
+
#include <string.h>
|
| 10 |
+
#include <stdlib.h>
|
| 11 |
+
#include "../src/threeway.h"
|
| 12 |
+
|
| 13 |
+
extern void insecure_key_generate(uint8_t *key, size_t key_len);
|
| 14 |
+
|
| 15 |
+
#define PLAINTEXT_LEN (THREEWAY_BLOCK_SIZE * 4)
|
| 16 |
+
|
| 17 |
+
static int hex_char_to_nibble(char c)
|
| 18 |
+
{
|
| 19 |
+
if (c >= '0' && c <= '9') return c - '0';
|
| 20 |
+
if (c >= 'a' && c <= 'f') return c - 'a' + 10;
|
| 21 |
+
if (c >= 'A' && c <= 'F') return c - 'A' + 10;
|
| 22 |
+
return -1;
|
| 23 |
+
}
|
| 24 |
+
|
| 25 |
+
static int parse_hex(const char *hex, uint8_t *out, size_t out_len)
|
| 26 |
+
{
|
| 27 |
+
size_t hex_len = strlen(hex);
|
| 28 |
+
if (hex_len != out_len * 2) return 0;
|
| 29 |
+
for (size_t i = 0; i < out_len; i++) {
|
| 30 |
+
int hi = hex_char_to_nibble(hex[2 * i]);
|
| 31 |
+
int lo = hex_char_to_nibble(hex[2 * i + 1]);
|
| 32 |
+
if (hi < 0 || lo < 0) return 0;
|
| 33 |
+
out[i] = (uint8_t)((hi << 4) | lo);
|
| 34 |
+
}
|
| 35 |
+
return 1;
|
| 36 |
+
}
|
| 37 |
+
|
| 38 |
+
static void print_hex(const uint8_t *buf, size_t len)
|
| 39 |
+
{
|
| 40 |
+
for (size_t i = 0; i < len; i++) printf("%02x", buf[i]);
|
| 41 |
+
}
|
| 42 |
+
|
| 43 |
+
int main(int argc, char **argv)
|
| 44 |
+
{
|
| 45 |
+
if (argc != 2) {
|
| 46 |
+
fprintf(stderr, "Usage: %s <96-hex-chars>\n", argv[0]);
|
| 47 |
+
return 1;
|
| 48 |
+
}
|
| 49 |
+
|
| 50 |
+
/* Target ciphertext (pre-computed from a known plaintext) */
|
| 51 |
+
const uint8_t target_ciphertext[PLAINTEXT_LEN] = {
|
| 52 |
+
0x4d, 0x52, 0x4d, 0xde, 0xf9, 0x4d, 0x7a, 0xd2,
|
| 53 |
+
0x9e, 0x30, 0xba, 0xc5, 0x1c, 0xea, 0x09, 0x17,
|
| 54 |
+
0x10, 0x7d, 0x76, 0xfb, 0x95, 0x43, 0xd2, 0xf2,
|
| 55 |
+
0x5c, 0x76, 0x9a, 0x72, 0xc4, 0x32, 0xd2, 0x66,
|
| 56 |
+
0x46, 0x8c, 0xd8, 0x15, 0x47, 0xcb, 0xdc, 0x5a,
|
| 57 |
+
0x84, 0x90, 0xff, 0xdc, 0xb7, 0x9f, 0x17, 0x98
|
| 58 |
+
};
|
| 59 |
+
|
| 60 |
+
/* Fixed key for the challenge */
|
| 61 |
+
uint8_t key[THREEWAY_KEY_SIZE];
|
| 62 |
+
insecure_key_generate((uint8_t *)key, sizeof(key));
|
| 63 |
+
|
| 64 |
+
uint8_t plaintext[PLAINTEXT_LEN];
|
| 65 |
+
if (!parse_hex(argv[1], plaintext, sizeof(plaintext))) {
|
| 66 |
+
fprintf(stderr, "Bad input hex. Expecting 96 hex chars (48 bytes).\n");
|
| 67 |
+
return 1;
|
| 68 |
+
}
|
| 69 |
+
|
| 70 |
+
threeway_ctx ctx;
|
| 71 |
+
if (threeway_set_encrypt_key(&ctx, key, THREEWAY_ROUNDS) != 0) {
|
| 72 |
+
fprintf(stderr, "Key setup failed.\n");
|
| 73 |
+
return 1;
|
| 74 |
+
}
|
| 75 |
+
|
| 76 |
+
uint8_t ciphertext[PLAINTEXT_LEN];
|
| 77 |
+
threeway_ecb_encrypt(&ctx, plaintext, ciphertext, sizeof(ciphertext));
|
| 78 |
+
|
| 79 |
+
printf("Ciphertext(hex): ");
|
| 80 |
+
print_hex(ciphertext, sizeof(ciphertext));
|
| 81 |
+
printf("\n");
|
| 82 |
+
|
| 83 |
+
int same = memcmp(ciphertext, target_ciphertext, sizeof(ciphertext)) == 0;
|
| 84 |
+
printf("Match: %s\n", same ? "True" : "False");
|
| 85 |
+
return same ? 0 : 2;
|
| 86 |
+
}
|
CREBench/3-Way/challenge_src/constxor_tables.c
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#include "constxor_tables.h"
|
| 2 |
+
|
| 3 |
+
#include <stddef.h>
|
| 4 |
+
|
| 5 |
+
__attribute__((noinline, noclone))
|
| 6 |
+
static void constxor_compiler_barrier(void) {
|
| 7 |
+
__asm__ __volatile__("" ::: "memory");
|
| 8 |
+
}
|
| 9 |
+
|
| 10 |
+
__attribute__((noinline, noclone))
|
| 11 |
+
static void materialize_u8_table(const uint8_t *lhs_raw, const uint8_t *rhs_raw, uint8_t *out, size_t count) {
|
| 12 |
+
const volatile uint8_t *lhs = (const volatile uint8_t *)lhs_raw;
|
| 13 |
+
const volatile uint8_t *rhs = (const volatile uint8_t *)rhs_raw;
|
| 14 |
+
constxor_compiler_barrier();
|
| 15 |
+
for (size_t i = 0; i < count; ++i) {
|
| 16 |
+
out[i] = (uint8_t)(lhs[i] ^ rhs[i]);
|
| 17 |
+
}
|
| 18 |
+
constxor_compiler_barrier();
|
| 19 |
+
}
|
| 20 |
+
|
| 21 |
+
__attribute__((noinline, noclone))
|
| 22 |
+
static void materialize_u16_table(const uint16_t *lhs_raw, const uint16_t *rhs_raw, uint16_t *out, size_t count) {
|
| 23 |
+
const volatile uint16_t *lhs = (const volatile uint16_t *)lhs_raw;
|
| 24 |
+
const volatile uint16_t *rhs = (const volatile uint16_t *)rhs_raw;
|
| 25 |
+
constxor_compiler_barrier();
|
| 26 |
+
for (size_t i = 0; i < count; ++i) {
|
| 27 |
+
out[i] = (uint16_t)(lhs[i] ^ rhs[i]);
|
| 28 |
+
}
|
| 29 |
+
constxor_compiler_barrier();
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
__attribute__((noinline, noclone))
|
| 33 |
+
static void materialize_u64_table(const uint64_t *lhs_raw, const uint64_t *rhs_raw, uint64_t *out, size_t count) {
|
| 34 |
+
const volatile uint64_t *lhs = (const volatile uint64_t *)lhs_raw;
|
| 35 |
+
const volatile uint64_t *rhs = (const volatile uint64_t *)rhs_raw;
|
| 36 |
+
constxor_compiler_barrier();
|
| 37 |
+
for (size_t i = 0; i < count; ++i) {
|
| 38 |
+
out[i] = lhs[i] ^ rhs[i];
|
| 39 |
+
}
|
| 40 |
+
constxor_compiler_barrier();
|
| 41 |
+
}
|
| 42 |
+
|
| 43 |
+
__attribute__((noinline, noclone))
|
| 44 |
+
static void materialize_u32_table(const uint32_t *lhs_raw, const uint32_t *rhs_raw, uint32_t *out, size_t count) {
|
| 45 |
+
const volatile uint32_t *lhs = (const volatile uint32_t *)lhs_raw;
|
| 46 |
+
const volatile uint32_t *rhs = (const volatile uint32_t *)rhs_raw;
|
| 47 |
+
constxor_compiler_barrier();
|
| 48 |
+
for (size_t i = 0; i < count; ++i) {
|
| 49 |
+
out[i] = lhs[i] ^ rhs[i];
|
| 50 |
+
}
|
| 51 |
+
constxor_compiler_barrier();
|
| 52 |
+
}
|
| 53 |
+
|
| 54 |
+
static const uint32_t threeway_magic_xor_lhs[3] = {
|
| 55 |
+
0xA70FF06FU, 0x3D45CCA8U, 0x105C95B1U
|
| 56 |
+
};
|
| 57 |
+
|
| 58 |
+
static const uint32_t threeway_magic_xor_rhs[3] = {
|
| 59 |
+
0xA70FFB64U, 0x3D457D19U, 0x105D85A0U
|
| 60 |
+
};
|
| 61 |
+
|
| 62 |
+
static uint32_t threeway_magic_decoded[3];
|
| 63 |
+
static int threeway_magic_ready;
|
| 64 |
+
|
| 65 |
+
__attribute__((noinline, noclone))
|
| 66 |
+
static void ensure_threeway_magic_decoded(void) {
|
| 67 |
+
if (threeway_magic_ready) {
|
| 68 |
+
return;
|
| 69 |
+
}
|
| 70 |
+
constxor_compiler_barrier();
|
| 71 |
+
materialize_u32_table(threeway_magic_xor_lhs, threeway_magic_xor_rhs, threeway_magic_decoded, 3);
|
| 72 |
+
constxor_compiler_barrier();
|
| 73 |
+
threeway_magic_ready = 1;
|
| 74 |
+
}
|
| 75 |
+
|
| 76 |
+
const uint32_t *constxor_threeway_magic(void) {
|
| 77 |
+
ensure_threeway_magic_decoded();
|
| 78 |
+
return threeway_magic_decoded;
|
| 79 |
+
}
|
CREBench/3-Way/challenge_src/constxor_tables.h
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#ifndef CONSTXOR_TABLES_H
|
| 2 |
+
#define CONSTXOR_TABLES_H
|
| 3 |
+
|
| 4 |
+
#include <stdint.h>
|
| 5 |
+
|
| 6 |
+
const uint32_t *constxor_threeway_magic(void);
|
| 7 |
+
|
| 8 |
+
#endif /* CONSTXOR_TABLES_H */
|
CREBench/3-Way/challenge_src/generated/fragmented_build/challenge.c
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/* key_mode=fragmented_build variant=randomized challenge=3-Way */
|
| 2 |
+
/* canonical_flag=5296ba4623d5f79dc7a304be31e852ac3700734b2a67ad686e3a5d098f1c82aa16638a8adb7f115f9059421838708ed5 */
|
| 3 |
+
/*
|
| 4 |
+
* 3-Way CTF Challenge
|
| 5 |
+
*
|
| 6 |
+
* This program takes a 48-byte (96 hex characters) input and encrypts it
|
| 7 |
+
* using 3-Way in ECB mode. The goal is to find the plaintext
|
| 8 |
+
* that produces a specific ciphertext.
|
| 9 |
+
*/
|
| 10 |
+
#include <stdio.h>
|
| 11 |
+
#include <string.h>
|
| 12 |
+
#include <stdlib.h>
|
| 13 |
+
#include "../src/threeway.h"
|
| 14 |
+
|
| 15 |
+
extern void insecure_key_generate(uint8_t *key, size_t key_len);
|
| 16 |
+
|
| 17 |
+
#define PLAINTEXT_LEN (THREEWAY_BLOCK_SIZE * 4)
|
| 18 |
+
|
| 19 |
+
static int hex_char_to_nibble(char c)
|
| 20 |
+
{
|
| 21 |
+
if (c >= '0' && c <= '9') return c - '0';
|
| 22 |
+
if (c >= 'a' && c <= 'f') return c - 'a' + 10;
|
| 23 |
+
if (c >= 'A' && c <= 'F') return c - 'A' + 10;
|
| 24 |
+
return -1;
|
| 25 |
+
}
|
| 26 |
+
|
| 27 |
+
static int parse_hex(const char *hex, uint8_t *out, size_t out_len)
|
| 28 |
+
{
|
| 29 |
+
size_t hex_len = strlen(hex);
|
| 30 |
+
if (hex_len != out_len * 2) return 0;
|
| 31 |
+
for (size_t i = 0; i < out_len; i++) {
|
| 32 |
+
int hi = hex_char_to_nibble(hex[2 * i]);
|
| 33 |
+
int lo = hex_char_to_nibble(hex[2 * i + 1]);
|
| 34 |
+
if (hi < 0 || lo < 0) return 0;
|
| 35 |
+
out[i] = (uint8_t)((hi << 4) | lo);
|
| 36 |
+
}
|
| 37 |
+
return 1;
|
| 38 |
+
}
|
| 39 |
+
|
| 40 |
+
static void print_hex(const uint8_t *buf, size_t len)
|
| 41 |
+
{
|
| 42 |
+
for (size_t i = 0; i < len; i++) printf("%02x", buf[i]);
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
int main(int argc, char **argv)
|
| 46 |
+
{
|
| 47 |
+
if (argc != 2) {
|
| 48 |
+
fprintf(stderr, "Usage: %s <96-hex-chars>\n", argv[0]);
|
| 49 |
+
return 1;
|
| 50 |
+
}
|
| 51 |
+
|
| 52 |
+
/* Target ciphertext (pre-computed from a known plaintext) */
|
| 53 |
+
const uint8_t target_ciphertext[PLAINTEXT_LEN] = {
|
| 54 |
+
0x82, 0x58, 0x8a, 0xc2, 0x58, 0x85, 0xc1, 0x5a,
|
| 55 |
+
0xcb, 0x97, 0x53, 0xc3, 0x34, 0x72, 0xcf, 0x96,
|
| 56 |
+
0xed, 0xff, 0xf3, 0xe9, 0xb0, 0x88, 0x64, 0x5c,
|
| 57 |
+
0x64, 0xee, 0x65, 0x1d, 0x57, 0x0f, 0xaa, 0x73,
|
| 58 |
+
0xe4, 0x40, 0x4e, 0x91, 0x4e, 0x3f, 0x66, 0xf4,
|
| 59 |
+
0x84, 0x20, 0x04, 0x7d, 0x61, 0x79, 0x66, 0x2b
|
| 60 |
+
};
|
| 61 |
+
|
| 62 |
+
/* Fixed key for the challenge */
|
| 63 |
+
uint8_t key[THREEWAY_KEY_SIZE];
|
| 64 |
+
insecure_key_generate((uint8_t *)key, sizeof(key));
|
| 65 |
+
|
| 66 |
+
uint8_t plaintext[PLAINTEXT_LEN];
|
| 67 |
+
if (!parse_hex(argv[1], plaintext, sizeof(plaintext))) {
|
| 68 |
+
fprintf(stderr, "Bad input hex. Expecting 96 hex chars (48 bytes).\n");
|
| 69 |
+
return 1;
|
| 70 |
+
}
|
| 71 |
+
|
| 72 |
+
threeway_ctx ctx;
|
| 73 |
+
if (threeway_set_encrypt_key(&ctx, key, THREEWAY_ROUNDS) != 0) {
|
| 74 |
+
fprintf(stderr, "Key setup failed.\n");
|
| 75 |
+
return 1;
|
| 76 |
+
}
|
| 77 |
+
|
| 78 |
+
uint8_t ciphertext[PLAINTEXT_LEN];
|
| 79 |
+
threeway_ecb_encrypt(&ctx, plaintext, ciphertext, sizeof(ciphertext));
|
| 80 |
+
|
| 81 |
+
printf("Ciphertext(hex): ");
|
| 82 |
+
print_hex(ciphertext, sizeof(ciphertext));
|
| 83 |
+
printf("\n");
|
| 84 |
+
|
| 85 |
+
int same = memcmp(ciphertext, target_ciphertext, sizeof(ciphertext)) == 0;
|
| 86 |
+
printf("Match: %s\n", same ? "True" : "False");
|
| 87 |
+
return same ? 0 : 1;
|
| 88 |
+
}
|
CREBench/3-Way/challenge_src/generated/fragmented_build/key_source.c
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/* instance_label=3-Way-fragmented_build-random variant=even_odd_xor */
|
| 2 |
+
#include <stddef.h>
|
| 3 |
+
#include <stdint.h>
|
| 4 |
+
|
| 5 |
+
#define INSECURE_KEY_NOOPT __attribute__((noinline, noclone, optimize("O0")))
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
static const uint8_t FRAG_EVEN[] = {
|
| 9 |
+
0x12, 0x2f, 0xfe, 0xd7, 0x94, 0xa9
|
| 10 |
+
};
|
| 11 |
+
|
| 12 |
+
static const uint8_t FRAG_ODD[] = {
|
| 13 |
+
0x08, 0x15, 0x1d, 0xdc, 0xee, 0xa3
|
| 14 |
+
};
|
| 15 |
+
|
| 16 |
+
INSECURE_KEY_NOOPT
|
| 17 |
+
static uint8_t rebuild_byte(size_t index) {
|
| 18 |
+
volatile const uint8_t *even = FRAG_EVEN;
|
| 19 |
+
volatile const uint8_t *odd = FRAG_ODD;
|
| 20 |
+
volatile uint8_t value;
|
| 21 |
+
if ((index & 1U) == 0U) {
|
| 22 |
+
value = (uint8_t)(even[index / 2] ^ 0xb1);
|
| 23 |
+
} else {
|
| 24 |
+
value = (uint8_t)(odd[index / 2] ^ 0xb1);
|
| 25 |
+
}
|
| 26 |
+
return value;
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
+
INSECURE_KEY_NOOPT
|
| 30 |
+
void insecure_key_generate(uint8_t *key, size_t key_len) {
|
| 31 |
+
for (size_t i = 0; i < key_len; i++) {
|
| 32 |
+
key[i] = rebuild_byte(i % 12);
|
| 33 |
+
}
|
| 34 |
+
}
|
CREBench/3-Way/challenge_src/generated/fragmented_build/metadata.json
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"challenge": "3-Way",
|
| 3 |
+
"key_mode": "fragmented_build",
|
| 4 |
+
"variant": "randomized",
|
| 5 |
+
"flag": "5296ba4623d5f79dc7a304be31e852ac3700734b2a67ad686e3a5d098f1c82aa16638a8adb7f115f9059421838708ed5",
|
| 6 |
+
"key": "a3b99ea44fac666d255f1812",
|
| 7 |
+
"iv": "",
|
| 8 |
+
"target_ciphertext": "82588ac25885c15acb9753c33472cf96edfff3e9b088645c64ee651d570faa73e4404e914e3f66f48420047d6179662b",
|
| 9 |
+
"test_vectors_path": "CREBench/3-Way/test_vectors-fragmented_build.json"
|
| 10 |
+
}
|
CREBench/3-Way/challenge_src/generated/hardcode_plain/challenge.c
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/* key_mode=hardcode_plain variant=randomized challenge=3-Way */
|
| 2 |
+
/* canonical_flag=5296ba4623d5f79dc7a304be31e852ac3700734b2a67ad686e3a5d098f1c82aa16638a8adb7f115f9059421838708ed5 */
|
| 3 |
+
/*
|
| 4 |
+
* 3-Way CTF Challenge
|
| 5 |
+
*
|
| 6 |
+
* This program takes a 48-byte (96 hex characters) input and encrypts it
|
| 7 |
+
* using 3-Way in ECB mode. The goal is to find the plaintext
|
| 8 |
+
* that produces a specific ciphertext.
|
| 9 |
+
*/
|
| 10 |
+
#include <stdio.h>
|
| 11 |
+
#include <string.h>
|
| 12 |
+
#include <stdlib.h>
|
| 13 |
+
#include "../src/threeway.h"
|
| 14 |
+
|
| 15 |
+
extern void insecure_key_generate(uint8_t *key, size_t key_len);
|
| 16 |
+
|
| 17 |
+
#define PLAINTEXT_LEN (THREEWAY_BLOCK_SIZE * 4)
|
| 18 |
+
|
| 19 |
+
static int hex_char_to_nibble(char c)
|
| 20 |
+
{
|
| 21 |
+
if (c >= '0' && c <= '9') return c - '0';
|
| 22 |
+
if (c >= 'a' && c <= 'f') return c - 'a' + 10;
|
| 23 |
+
if (c >= 'A' && c <= 'F') return c - 'A' + 10;
|
| 24 |
+
return -1;
|
| 25 |
+
}
|
| 26 |
+
|
| 27 |
+
static int parse_hex(const char *hex, uint8_t *out, size_t out_len)
|
| 28 |
+
{
|
| 29 |
+
size_t hex_len = strlen(hex);
|
| 30 |
+
if (hex_len != out_len * 2) return 0;
|
| 31 |
+
for (size_t i = 0; i < out_len; i++) {
|
| 32 |
+
int hi = hex_char_to_nibble(hex[2 * i]);
|
| 33 |
+
int lo = hex_char_to_nibble(hex[2 * i + 1]);
|
| 34 |
+
if (hi < 0 || lo < 0) return 0;
|
| 35 |
+
out[i] = (uint8_t)((hi << 4) | lo);
|
| 36 |
+
}
|
| 37 |
+
return 1;
|
| 38 |
+
}
|
| 39 |
+
|
| 40 |
+
static void print_hex(const uint8_t *buf, size_t len)
|
| 41 |
+
{
|
| 42 |
+
for (size_t i = 0; i < len; i++) printf("%02x", buf[i]);
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
int main(int argc, char **argv)
|
| 46 |
+
{
|
| 47 |
+
if (argc != 2) {
|
| 48 |
+
fprintf(stderr, "Usage: %s <96-hex-chars>\n", argv[0]);
|
| 49 |
+
return 1;
|
| 50 |
+
}
|
| 51 |
+
|
| 52 |
+
/* Target ciphertext (pre-computed from a known plaintext) */
|
| 53 |
+
const uint8_t target_ciphertext[PLAINTEXT_LEN] = {
|
| 54 |
+
0xb9, 0xc7, 0x6c, 0x66, 0x7c, 0xb7, 0x5a, 0x95,
|
| 55 |
+
0x64, 0xef, 0x16, 0x3a, 0x38, 0x13, 0xc2, 0xde,
|
| 56 |
+
0x68, 0xea, 0x26, 0xd7, 0xf0, 0xc1, 0xa3, 0xb0,
|
| 57 |
+
0x6f, 0xbb, 0x7c, 0xd9, 0x67, 0xf4, 0x73, 0x85,
|
| 58 |
+
0x11, 0x19, 0x11, 0x3c, 0x16, 0x3d, 0x1c, 0x76,
|
| 59 |
+
0x87, 0x05, 0x0f, 0xcb, 0xcd, 0xdf, 0xc5, 0x47
|
| 60 |
+
};
|
| 61 |
+
|
| 62 |
+
/* Fixed key for the challenge */
|
| 63 |
+
uint8_t key[THREEWAY_KEY_SIZE];
|
| 64 |
+
insecure_key_generate((uint8_t *)key, sizeof(key));
|
| 65 |
+
|
| 66 |
+
uint8_t plaintext[PLAINTEXT_LEN];
|
| 67 |
+
if (!parse_hex(argv[1], plaintext, sizeof(plaintext))) {
|
| 68 |
+
fprintf(stderr, "Bad input hex. Expecting 96 hex chars (48 bytes).\n");
|
| 69 |
+
return 1;
|
| 70 |
+
}
|
| 71 |
+
|
| 72 |
+
threeway_ctx ctx;
|
| 73 |
+
if (threeway_set_encrypt_key(&ctx, key, THREEWAY_ROUNDS) != 0) {
|
| 74 |
+
fprintf(stderr, "Key setup failed.\n");
|
| 75 |
+
return 1;
|
| 76 |
+
}
|
| 77 |
+
|
| 78 |
+
uint8_t ciphertext[PLAINTEXT_LEN];
|
| 79 |
+
threeway_ecb_encrypt(&ctx, plaintext, ciphertext, sizeof(ciphertext));
|
| 80 |
+
|
| 81 |
+
printf("Ciphertext(hex): ");
|
| 82 |
+
print_hex(ciphertext, sizeof(ciphertext));
|
| 83 |
+
printf("\n");
|
| 84 |
+
|
| 85 |
+
int same = memcmp(ciphertext, target_ciphertext, sizeof(ciphertext)) == 0;
|
| 86 |
+
printf("Match: %s\n", same ? "True" : "False");
|
| 87 |
+
return same ? 0 : 1;
|
| 88 |
+
}
|
CREBench/3-Way/challenge_src/generated/hardcode_plain/key_source.c
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/* instance_label=3-Way-hardcode_plain-random variant=raw_literal */
|
| 2 |
+
#include <stddef.h>
|
| 3 |
+
#include <stdint.h>
|
| 4 |
+
|
| 5 |
+
#define INSECURE_KEY_NOOPT __attribute__((noinline, noclone, optimize("O0")))
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
INSECURE_KEY_NOOPT
|
| 9 |
+
void insecure_key_generate(uint8_t *key, size_t key_len) {
|
| 10 |
+
static const uint8_t KEY_BYTES[] = {
|
| 11 |
+
0xb3, 0x21, 0x3f, 0x19, 0x24, 0x63, 0xf0, 0x81,
|
| 12 |
+
0xbf, 0xe0, 0xad, 0x9f
|
| 13 |
+
};
|
| 14 |
+
volatile const uint8_t *src = KEY_BYTES;
|
| 15 |
+
|
| 16 |
+
for (size_t i = 0; i < key_len; i++) {
|
| 17 |
+
key[i] = src[i % sizeof(KEY_BYTES)];
|
| 18 |
+
}
|
| 19 |
+
}
|
CREBench/3-Way/challenge_src/generated/hardcode_plain/metadata.json
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"challenge": "3-Way",
|
| 3 |
+
"key_mode": "hardcode_plain",
|
| 4 |
+
"variant": "randomized",
|
| 5 |
+
"flag": "5296ba4623d5f79dc7a304be31e852ac3700734b2a67ad686e3a5d098f1c82aa16638a8adb7f115f9059421838708ed5",
|
| 6 |
+
"key": "b3213f192463f081bfe0ad9f",
|
| 7 |
+
"iv": "",
|
| 8 |
+
"target_ciphertext": "b9c76c667cb75a9564ef163a3813c2de68ea26d7f0c1a3b06fbb7cd967f473851119113c163d1c7687050fcbcddfc547",
|
| 9 |
+
"test_vectors_path": "CREBench/3-Way/test_vectors-hardcode_plain.json"
|
| 10 |
+
}
|
CREBench/3-Way/challenge_src/generated/weak_prng_seeded/challenge.c
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/* key_mode=weak_prng_seeded variant=randomized challenge=3-Way */
|
| 2 |
+
/* canonical_flag=5296ba4623d5f79dc7a304be31e852ac3700734b2a67ad686e3a5d098f1c82aa16638a8adb7f115f9059421838708ed5 */
|
| 3 |
+
/*
|
| 4 |
+
* 3-Way CTF Challenge
|
| 5 |
+
*
|
| 6 |
+
* This program takes a 48-byte (96 hex characters) input and encrypts it
|
| 7 |
+
* using 3-Way in ECB mode. The goal is to find the plaintext
|
| 8 |
+
* that produces a specific ciphertext.
|
| 9 |
+
*/
|
| 10 |
+
#include <stdio.h>
|
| 11 |
+
#include <string.h>
|
| 12 |
+
#include <stdlib.h>
|
| 13 |
+
#include "../src/threeway.h"
|
| 14 |
+
|
| 15 |
+
extern void insecure_key_generate(uint8_t *key, size_t key_len);
|
| 16 |
+
|
| 17 |
+
#define PLAINTEXT_LEN (THREEWAY_BLOCK_SIZE * 4)
|
| 18 |
+
|
| 19 |
+
static int hex_char_to_nibble(char c)
|
| 20 |
+
{
|
| 21 |
+
if (c >= '0' && c <= '9') return c - '0';
|
| 22 |
+
if (c >= 'a' && c <= 'f') return c - 'a' + 10;
|
| 23 |
+
if (c >= 'A' && c <= 'F') return c - 'A' + 10;
|
| 24 |
+
return -1;
|
| 25 |
+
}
|
| 26 |
+
|
| 27 |
+
static int parse_hex(const char *hex, uint8_t *out, size_t out_len)
|
| 28 |
+
{
|
| 29 |
+
size_t hex_len = strlen(hex);
|
| 30 |
+
if (hex_len != out_len * 2) return 0;
|
| 31 |
+
for (size_t i = 0; i < out_len; i++) {
|
| 32 |
+
int hi = hex_char_to_nibble(hex[2 * i]);
|
| 33 |
+
int lo = hex_char_to_nibble(hex[2 * i + 1]);
|
| 34 |
+
if (hi < 0 || lo < 0) return 0;
|
| 35 |
+
out[i] = (uint8_t)((hi << 4) | lo);
|
| 36 |
+
}
|
| 37 |
+
return 1;
|
| 38 |
+
}
|
| 39 |
+
|
| 40 |
+
static void print_hex(const uint8_t *buf, size_t len)
|
| 41 |
+
{
|
| 42 |
+
for (size_t i = 0; i < len; i++) printf("%02x", buf[i]);
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
int main(int argc, char **argv)
|
| 46 |
+
{
|
| 47 |
+
if (argc != 2) {
|
| 48 |
+
fprintf(stderr, "Usage: %s <96-hex-chars>\n", argv[0]);
|
| 49 |
+
return 1;
|
| 50 |
+
}
|
| 51 |
+
|
| 52 |
+
/* Target ciphertext (pre-computed from a known plaintext) */
|
| 53 |
+
const uint8_t target_ciphertext[PLAINTEXT_LEN] = {
|
| 54 |
+
0x75, 0xa6, 0x10, 0xd4, 0x4b, 0x0b, 0xbb, 0x6e,
|
| 55 |
+
0x2a, 0xb8, 0x50, 0x13, 0x0a, 0x87, 0xdc, 0x78,
|
| 56 |
+
0x95, 0xa5, 0x1c, 0x7e, 0x33, 0x67, 0x51, 0x32,
|
| 57 |
+
0xc0, 0xf5, 0x81, 0x4d, 0xeb, 0x63, 0x69, 0x90,
|
| 58 |
+
0x79, 0x26, 0x57, 0xce, 0x25, 0x02, 0x7c, 0x20,
|
| 59 |
+
0x06, 0x0a, 0xcc, 0x8f, 0xb3, 0x28, 0xb9, 0x09
|
| 60 |
+
};
|
| 61 |
+
|
| 62 |
+
/* Fixed key for the challenge */
|
| 63 |
+
uint8_t key[THREEWAY_KEY_SIZE];
|
| 64 |
+
insecure_key_generate((uint8_t *)key, sizeof(key));
|
| 65 |
+
|
| 66 |
+
uint8_t plaintext[PLAINTEXT_LEN];
|
| 67 |
+
if (!parse_hex(argv[1], plaintext, sizeof(plaintext))) {
|
| 68 |
+
fprintf(stderr, "Bad input hex. Expecting 96 hex chars (48 bytes).\n");
|
| 69 |
+
return 1;
|
| 70 |
+
}
|
| 71 |
+
|
| 72 |
+
threeway_ctx ctx;
|
| 73 |
+
if (threeway_set_encrypt_key(&ctx, key, THREEWAY_ROUNDS) != 0) {
|
| 74 |
+
fprintf(stderr, "Key setup failed.\n");
|
| 75 |
+
return 1;
|
| 76 |
+
}
|
| 77 |
+
|
| 78 |
+
uint8_t ciphertext[PLAINTEXT_LEN];
|
| 79 |
+
threeway_ecb_encrypt(&ctx, plaintext, ciphertext, sizeof(ciphertext));
|
| 80 |
+
|
| 81 |
+
printf("Ciphertext(hex): ");
|
| 82 |
+
print_hex(ciphertext, sizeof(ciphertext));
|
| 83 |
+
printf("\n");
|
| 84 |
+
|
| 85 |
+
int same = memcmp(ciphertext, target_ciphertext, sizeof(ciphertext)) == 0;
|
| 86 |
+
printf("Match: %s\n", same ? "True" : "False");
|
| 87 |
+
return same ? 0 : 1;
|
| 88 |
+
}
|
CREBench/3-Way/challenge_src/generated/weak_prng_seeded/key_source.c
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/* instance_label=3-Way-weak_prng_seeded-random variant=lcg_seeded */
|
| 2 |
+
#include <stddef.h>
|
| 3 |
+
#include <stdint.h>
|
| 4 |
+
|
| 5 |
+
#define INSECURE_KEY_NOOPT __attribute__((noinline, noclone, optimize("O0")))
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
static const uint8_t CORR[] = {
|
| 9 |
+
0x74, 0xaa, 0x90, 0x98, 0x00, 0x22, 0x2a, 0x8c,
|
| 10 |
+
0x31, 0xe5, 0x2b, 0x0b
|
| 11 |
+
};
|
| 12 |
+
|
| 13 |
+
INSECURE_KEY_NOOPT
|
| 14 |
+
void insecure_key_generate(uint8_t *key, size_t key_len) {
|
| 15 |
+
volatile const uint8_t *corr = CORR;
|
| 16 |
+
volatile uint32_t state = 0x8f473fc6U ^ 0x40feb3caU;
|
| 17 |
+
for (size_t i = 0; i < key_len; i++) {
|
| 18 |
+
state = state * 1664525U + 1013904223U;
|
| 19 |
+
volatile uint8_t prng = (uint8_t)((state >> ((i & 3U) * 8U)) & 0xFFU);
|
| 20 |
+
key[i] = (uint8_t)(prng ^ corr[i % sizeof(CORR)]);
|
| 21 |
+
}
|
| 22 |
+
}
|
CREBench/3-Way/challenge_src/generated/weak_prng_seeded/metadata.json
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"challenge": "3-Way",
|
| 3 |
+
"key_mode": "weak_prng_seeded",
|
| 4 |
+
"variant": "randomized",
|
| 5 |
+
"flag": "5296ba4623d5f79dc7a304be31e852ac3700734b2a67ad686e3a5d098f1c82aa16638a8adb7f115f9059421838708ed5",
|
| 6 |
+
"key": "8f473fc65f9109d932153f04",
|
| 7 |
+
"iv": "",
|
| 8 |
+
"target_ciphertext": "75a610d44b0bbb6e2ab850130a87dc7895a51c7e33675132c0f5814deb636990792657ce25027c20060acc8fb328b909",
|
| 9 |
+
"test_vectors_path": "CREBench/3-Way/test_vectors-weak_prng_seeded.json"
|
| 10 |
+
}
|
CREBench/3-Way/challenge_src/key_source.c
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/* instance_label=3-Way-baseline-random variant=raw_literal */
|
| 2 |
+
#include <stddef.h>
|
| 3 |
+
#include <stdint.h>
|
| 4 |
+
|
| 5 |
+
#define INSECURE_KEY_NOOPT __attribute__((noinline, noclone, optimize("O0")))
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
INSECURE_KEY_NOOPT
|
| 9 |
+
void insecure_key_generate(uint8_t *key, size_t key_len) {
|
| 10 |
+
static const uint8_t KEY_BYTES[] = {
|
| 11 |
+
0x8b, 0x8a, 0x94, 0x68, 0xa5, 0x34, 0x1b, 0xad,
|
| 12 |
+
0x9b, 0x4d, 0x58, 0xb6
|
| 13 |
+
};
|
| 14 |
+
volatile const uint8_t *src = KEY_BYTES;
|
| 15 |
+
|
| 16 |
+
for (size_t i = 0; i < key_len; i++) {
|
| 17 |
+
key[i] = src[i % sizeof(KEY_BYTES)];
|
| 18 |
+
}
|
| 19 |
+
}
|
CREBench/3-Way/config.yaml
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: threeway
|
| 2 |
+
publc_path: CREBench/3-Way/public
|
| 3 |
+
flag: 5296ba4623d5f79dc7a304be31e852ac3700734b2a67ad686e3a5d098f1c82aa16638a8adb7f115f9059421838708ed5
|
| 4 |
+
flag_type: hex
|
| 5 |
+
|
| 6 |
+
# Level 1: algorithm identification
|
| 7 |
+
algorithm: 3-WAY-ECB
|
| 8 |
+
algorithm_aliases:
|
| 9 |
+
- 3-Way
|
| 10 |
+
- 3Way
|
| 11 |
+
- threeway
|
| 12 |
+
- 3-way-ecb
|
| 13 |
+
|
| 14 |
+
# Level 2: key extraction
|
| 15 |
+
# Mode-specific key material is resolved from generated metadata.
|
| 16 |
+
|
| 17 |
+
# Level 3: code recovery
|
| 18 |
+
# Mode-specific test vectors are resolved from generated metadata.
|
| 19 |
+
|
| 20 |
+
instance_metadata:
|
| 21 |
+
generated_root: CREBench/3-Way/challenge_src/generated
|
| 22 |
+
supported_key_modes:
|
| 23 |
+
- hardcode_plain
|
| 24 |
+
- fragmented_build
|
| 25 |
+
- weak_prng_seeded
|
| 26 |
+
default_key_mode: fragmented_build
|
| 27 |
+
|
| 28 |
+
template_metadata:
|
| 29 |
+
wrapper_family: multi_block_ecb
|
| 30 |
+
key_source_file: CREBench/3-Way/challenge_src/key_source.c
|
| 31 |
+
key_versions:
|
| 32 |
+
- hardcode
|
| 33 |
+
- fragmented_build
|
| 34 |
+
- weak_prng
|
| 35 |
+
key_seed: 1701388800
|
| 36 |
+
key_seed_note: fixed_timestamp_utc_2023_12_01_00_00_00
|
| 37 |
+
key_length_bytes: 12
|
| 38 |
+
block_size_bytes: 12
|
| 39 |
+
iv_length_bytes: 0
|
| 40 |
+
target_length_bytes: 48
|
| 41 |
+
verification_target: ciphertext_match
|
| 42 |
+
|
| 43 |
+
constxor_metadata:
|
| 44 |
+
enabled: true
|
| 45 |
+
profile: threeway_magic
|
| 46 |
+
compile_define: CONSTXOR_THREEWAY_TABLES
|
| 47 |
+
source_file: src/threeway.c
|
| 48 |
+
tables:
|
| 49 |
+
- symbol: threeway_magic
|
| 50 |
+
ctype: uint32_t
|
| 51 |
+
accessor: constxor_threeway_magic
|
CREBench/3-Way/public-fragmented_build-O0/address.json
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"00101020": "FUN_00101020",
|
| 3 |
+
"00106038": "fprintf",
|
| 4 |
+
"00101100": "fprintf",
|
| 5 |
+
"001016c9": "FUN_001016c9",
|
| 6 |
+
"001020ca": "FUN_001020ca",
|
| 7 |
+
"00106030": "memcmp",
|
| 8 |
+
"00101180": "FUN_00101180",
|
| 9 |
+
"00101e65": "FUN_00101e65",
|
| 10 |
+
"001010c0": "strlen",
|
| 11 |
+
"001022d0": "_DT_FINI",
|
| 12 |
+
"00101854": "FUN_00101854",
|
| 13 |
+
"001016ad": "FUN_001016ad",
|
| 14 |
+
"001015cc": "FUN_001015cc",
|
| 15 |
+
"00106028": "printf",
|
| 16 |
+
"00101331": "FUN_00101331",
|
| 17 |
+
"00106020": "__stack_chk_fail",
|
| 18 |
+
"0010175f": "FUN_0010175f",
|
| 19 |
+
"00101b77": "FUN_00101b77",
|
| 20 |
+
"0010200e": "FUN_0010200e",
|
| 21 |
+
"0010199e": "FUN_0010199e",
|
| 22 |
+
"001010b0": "putchar",
|
| 23 |
+
"00101aec": "FUN_00101aec",
|
| 24 |
+
"00101cea": "FUN_00101cea",
|
| 25 |
+
"001010f0": "memcmp",
|
| 26 |
+
"00101209": "FUN_00101209",
|
| 27 |
+
"00101803": "FUN_00101803",
|
| 28 |
+
"00101728": "FUN_00101728",
|
| 29 |
+
"00101200": "_INIT_0",
|
| 30 |
+
"00106018": "strlen",
|
| 31 |
+
"001018a7": "FUN_001018a7",
|
| 32 |
+
"00101120": "entry",
|
| 33 |
+
"00101000": "_DT_INIT",
|
| 34 |
+
"00101bd3": "FUN_00101bd3",
|
| 35 |
+
"00106058": "__cxa_finalize",
|
| 36 |
+
"00106010": "_ITM_deregisterTMCloneTable",
|
| 37 |
+
"00106050": "_ITM_registerTMCloneTable",
|
| 38 |
+
"001011c0": "_FINI_0",
|
| 39 |
+
"001010a0": "FUN_001010a0",
|
| 40 |
+
"001010e0": "printf",
|
| 41 |
+
"00101636": "FUN_00101636",
|
| 42 |
+
"00101aa3": "FUN_00101aa3",
|
| 43 |
+
"001021bf": "FUN_001021bf",
|
| 44 |
+
"00106008": "__libc_start_main",
|
| 45 |
+
"00101110": "fwrite",
|
| 46 |
+
"00106048": "fwrite",
|
| 47 |
+
"00101150": "FUN_00101150",
|
| 48 |
+
"00106000": "putchar",
|
| 49 |
+
"001017b2": "FUN_001017b2",
|
| 50 |
+
"00106040": "__gmon_start__",
|
| 51 |
+
"00101b13": "FUN_00101b13",
|
| 52 |
+
"0010125c": "FUN_0010125c",
|
| 53 |
+
"00101901": "FUN_00101901",
|
| 54 |
+
"001010d0": "__stack_chk_fail",
|
| 55 |
+
"0010206c": "FUN_0010206c",
|
| 56 |
+
"00101389": "FUN_00101389"
|
| 57 |
+
}
|
CREBench/3-Way/public-fragmented_build-O0/challenge
ADDED
|
Binary file (18.6 kB). View file
|
|
|
CREBench/3-Way/public-fragmented_build-O0/decompile/FUN_00101020_decompiled
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
void FUN_00101020(void)
|
| 3 |
+
|
| 4 |
+
{
|
| 5 |
+
/* WARNING: Treating indirect jump as call */
|
| 6 |
+
(*(code *)PTR_00104f98)();
|
| 7 |
+
return;
|
| 8 |
+
}
|
| 9 |
+
|
CREBench/3-Way/public-fragmented_build-O0/decompile/FUN_001010a0_decompiled
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
void FUN_001010a0(void)
|
| 3 |
+
|
| 4 |
+
{
|
| 5 |
+
(*(code *)PTR___cxa_finalize_00104ff8)();
|
| 6 |
+
return;
|
| 7 |
+
}
|
| 8 |
+
|
CREBench/3-Way/public-fragmented_build-O0/decompile/FUN_00101150_decompiled
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
/* WARNING: Removing unreachable block (ram,0x00101163) */
|
| 3 |
+
/* WARNING: Removing unreachable block (ram,0x0010116f) */
|
| 4 |
+
|
| 5 |
+
void FUN_00101150(void)
|
| 6 |
+
|
| 7 |
+
{
|
| 8 |
+
return;
|
| 9 |
+
}
|
| 10 |
+
|
CREBench/3-Way/public-fragmented_build-O0/decompile/FUN_00101180_decompiled
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
/* WARNING: Removing unreachable block (ram,0x001011a4) */
|
| 3 |
+
/* WARNING: Removing unreachable block (ram,0x001011b0) */
|
| 4 |
+
|
| 5 |
+
void FUN_00101180(void)
|
| 6 |
+
|
| 7 |
+
{
|
| 8 |
+
return;
|
| 9 |
+
}
|
| 10 |
+
|
CREBench/3-Way/public-fragmented_build-O0/decompile/FUN_00101209_decompiled
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
int FUN_00101209(char param_1)
|
| 3 |
+
|
| 4 |
+
{
|
| 5 |
+
int iVar1;
|
| 6 |
+
|
| 7 |
+
if ((param_1 < '0') || ('9' < param_1)) {
|
| 8 |
+
if ((param_1 < 'a') || ('f' < param_1)) {
|
| 9 |
+
if ((param_1 < 'A') || ('F' < param_1)) {
|
| 10 |
+
iVar1 = -1;
|
| 11 |
+
}
|
| 12 |
+
else {
|
| 13 |
+
iVar1 = param_1 + -0x37;
|
| 14 |
+
}
|
| 15 |
+
}
|
| 16 |
+
else {
|
| 17 |
+
iVar1 = param_1 + -0x57;
|
| 18 |
+
}
|
| 19 |
+
}
|
| 20 |
+
else {
|
| 21 |
+
iVar1 = param_1 + -0x30;
|
| 22 |
+
}
|
| 23 |
+
return iVar1;
|
| 24 |
+
}
|
| 25 |
+
|
CREBench/3-Way/public-fragmented_build-O0/decompile/FUN_0010125c_decompiled
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
undefined8 FUN_0010125c(char *param_1,long param_2,ulong param_3)
|
| 3 |
+
|
| 4 |
+
{
|
| 5 |
+
int iVar1;
|
| 6 |
+
int iVar2;
|
| 7 |
+
size_t sVar3;
|
| 8 |
+
undefined8 uVar4;
|
| 9 |
+
ulong local_18;
|
| 10 |
+
|
| 11 |
+
sVar3 = strlen(param_1);
|
| 12 |
+
if (sVar3 == param_3 * 2) {
|
| 13 |
+
for (local_18 = 0; local_18 < param_3; local_18 = local_18 + 1) {
|
| 14 |
+
iVar1 = FUN_00101209((int)param_1[local_18 * 2]);
|
| 15 |
+
iVar2 = FUN_00101209((int)param_1[local_18 * 2 + 1]);
|
| 16 |
+
if ((iVar1 < 0) || (iVar2 < 0)) {
|
| 17 |
+
return 0;
|
| 18 |
+
}
|
| 19 |
+
*(byte *)(local_18 + param_2) = (byte)(iVar1 << 4) | (byte)iVar2;
|
| 20 |
+
}
|
| 21 |
+
uVar4 = 1;
|
| 22 |
+
}
|
| 23 |
+
else {
|
| 24 |
+
uVar4 = 0;
|
| 25 |
+
}
|
| 26 |
+
return uVar4;
|
| 27 |
+
}
|
| 28 |
+
|
CREBench/3-Way/public-fragmented_build-O0/decompile/FUN_00101331_decompiled
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
void FUN_00101331(long param_1,ulong param_2)
|
| 3 |
+
|
| 4 |
+
{
|
| 5 |
+
ulong local_10;
|
| 6 |
+
|
| 7 |
+
for (local_10 = 0; local_10 < param_2; local_10 = local_10 + 1) {
|
| 8 |
+
printf("%02x",(ulong)*(byte *)(local_10 + param_1));
|
| 9 |
+
}
|
| 10 |
+
return;
|
| 11 |
+
}
|
| 12 |
+
|
CREBench/3-Way/public-fragmented_build-O0/decompile/FUN_00101389_decompiled
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
bool FUN_00101389(int param_1,undefined8 *param_2)
|
| 3 |
+
|
| 4 |
+
{
|
| 5 |
+
int iVar1;
|
| 6 |
+
char *pcVar2;
|
| 7 |
+
long in_FS_OFFSET;
|
| 8 |
+
bool bVar3;
|
| 9 |
+
undefined local_c8 [20];
|
| 10 |
+
undefined local_b4 [12];
|
| 11 |
+
undefined8 local_a8;
|
| 12 |
+
undefined8 local_a0;
|
| 13 |
+
undefined8 local_98;
|
| 14 |
+
undefined8 local_90;
|
| 15 |
+
undefined8 local_88;
|
| 16 |
+
undefined8 local_80;
|
| 17 |
+
undefined local_78 [48];
|
| 18 |
+
undefined local_48 [56];
|
| 19 |
+
long local_10;
|
| 20 |
+
|
| 21 |
+
local_10 = *(long *)(in_FS_OFFSET + 0x28);
|
| 22 |
+
if (param_1 == 2) {
|
| 23 |
+
local_a8 = 0x5ac18558c28a5882;
|
| 24 |
+
local_a0 = 0x96cf7234c35397cb;
|
| 25 |
+
local_98 = 0x5c6488b0e9f3ffed;
|
| 26 |
+
local_90 = 0x73aa0f571d65ee64;
|
| 27 |
+
local_88 = 0xf4663f4e914e40e4;
|
| 28 |
+
local_80 = 0x2b6679617d042084;
|
| 29 |
+
FUN_00101636(local_b4,0xc);
|
| 30 |
+
iVar1 = FUN_0010125c(param_2[1],local_78,0x30);
|
| 31 |
+
if (iVar1 == 0) {
|
| 32 |
+
fwrite("Bad input hex. Expecting 96 hex chars (48 bytes).\n",1,0x32,stderr);
|
| 33 |
+
bVar3 = true;
|
| 34 |
+
}
|
| 35 |
+
else {
|
| 36 |
+
iVar1 = FUN_00101b77(local_c8,local_b4,0xb);
|
| 37 |
+
if (iVar1 == 0) {
|
| 38 |
+
FUN_0010200e(local_c8,local_78,local_48,0x30);
|
| 39 |
+
printf("Ciphertext(hex): ");
|
| 40 |
+
FUN_00101331(local_48,0x30);
|
| 41 |
+
putchar(10);
|
| 42 |
+
iVar1 = memcmp(local_48,&local_a8,0x30);
|
| 43 |
+
bVar3 = iVar1 != 0;
|
| 44 |
+
if (bVar3) {
|
| 45 |
+
pcVar2 = "False";
|
| 46 |
+
}
|
| 47 |
+
else {
|
| 48 |
+
pcVar2 = "True";
|
| 49 |
+
}
|
| 50 |
+
printf("Match: %s\n",pcVar2);
|
| 51 |
+
}
|
| 52 |
+
else {
|
| 53 |
+
fwrite("Key setup failed.\n",1,0x12,stderr);
|
| 54 |
+
bVar3 = true;
|
| 55 |
+
}
|
| 56 |
+
}
|
| 57 |
+
}
|
| 58 |
+
else {
|
| 59 |
+
fprintf(stderr,"Usage: %s <96-hex-chars>\n",*param_2);
|
| 60 |
+
bVar3 = true;
|
| 61 |
+
}
|
| 62 |
+
if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) {
|
| 63 |
+
/* WARNING: Subroutine does not return */
|
| 64 |
+
__stack_chk_fail();
|
| 65 |
+
}
|
| 66 |
+
return bVar3;
|
| 67 |
+
}
|
| 68 |
+
|
CREBench/3-Way/public-fragmented_build-O0/decompile/FUN_001015cc_decompiled
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
byte FUN_001015cc(ulong param_1)
|
| 3 |
+
|
| 4 |
+
{
|
| 5 |
+
byte local_19;
|
| 6 |
+
|
| 7 |
+
if ((param_1 & 1) == 0) {
|
| 8 |
+
local_19 = (&DAT_00103096)[param_1 >> 1];
|
| 9 |
+
}
|
| 10 |
+
else {
|
| 11 |
+
local_19 = (&DAT_0010309c)[param_1 >> 1];
|
| 12 |
+
}
|
| 13 |
+
local_19 = local_19 ^ 0xb1;
|
| 14 |
+
return local_19;
|
| 15 |
+
}
|
| 16 |
+
|
CREBench/3-Way/public-fragmented_build-O0/decompile/FUN_00101636_decompiled
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
void FUN_00101636(long param_1,ulong param_2)
|
| 3 |
+
|
| 4 |
+
{
|
| 5 |
+
undefined uVar1;
|
| 6 |
+
ulong local_18;
|
| 7 |
+
|
| 8 |
+
for (local_18 = 0; local_18 < param_2; local_18 = local_18 + 1) {
|
| 9 |
+
uVar1 = FUN_001015cc(local_18 % 0xc);
|
| 10 |
+
*(undefined *)(param_1 + local_18) = uVar1;
|
| 11 |
+
}
|
| 12 |
+
return;
|
| 13 |
+
}
|
| 14 |
+
|
CREBench/3-Way/public-fragmented_build-O0/decompile/FUN_001016ad_decompiled
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
uint FUN_001016ad(uint param_1,byte param_2)
|
| 3 |
+
|
| 4 |
+
{
|
| 5 |
+
return param_1 << (param_2 & 0x1f) | param_1 >> 0x20 - (param_2 & 0x1f);
|
| 6 |
+
}
|
| 7 |
+
|
CREBench/3-Way/public-fragmented_build-O0/decompile/FUN_001016c9_decompiled
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
uint FUN_001016c9(uint param_1)
|
| 3 |
+
|
| 4 |
+
{
|
| 5 |
+
uint uVar1;
|
| 6 |
+
|
| 7 |
+
uVar1 = param_1 * 2 & 0xaaaaaaaa | param_1 >> 1 & 0x55555555;
|
| 8 |
+
uVar1 = (uVar1 & 0x33333333) << 2 | uVar1 >> 2 & 0x33333333;
|
| 9 |
+
return (uVar1 & 0xf0f0f0f) << 4 | uVar1 >> 4 & 0xf0f0f0f;
|
| 10 |
+
}
|
| 11 |
+
|
CREBench/3-Way/public-fragmented_build-O0/decompile/FUN_00101728_decompiled
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
uint FUN_00101728(uint param_1)
|
| 3 |
+
|
| 4 |
+
{
|
| 5 |
+
return param_1 << 0x18 | param_1 >> 0x18 | param_1 >> 8 & 0xff00 | (param_1 & 0xff00) << 8;
|
| 6 |
+
}
|
| 7 |
+
|
CREBench/3-Way/public-fragmented_build-O0/decompile/FUN_0010175f_decompiled
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
uint FUN_0010175f(byte *param_1)
|
| 3 |
+
|
| 4 |
+
{
|
| 5 |
+
return (uint)param_1[3] |
|
| 6 |
+
(uint)*param_1 << 0x18 | (uint)param_1[1] << 0x10 | (uint)param_1[2] << 8;
|
| 7 |
+
}
|
| 8 |
+
|
CREBench/3-Way/public-fragmented_build-O0/decompile/FUN_001017b2_decompiled
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
void FUN_001017b2(undefined *param_1,undefined4 param_2)
|
| 3 |
+
|
| 4 |
+
{
|
| 5 |
+
*param_1 = (char)((uint)param_2 >> 0x18);
|
| 6 |
+
param_1[1] = (char)((uint)param_2 >> 0x10);
|
| 7 |
+
param_1[2] = (char)((uint)param_2 >> 8);
|
| 8 |
+
param_1[3] = (char)param_2;
|
| 9 |
+
return;
|
| 10 |
+
}
|
| 11 |
+
|
CREBench/3-Way/public-fragmented_build-O0/decompile/FUN_00101803_decompiled
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
undefined4 FUN_00101803(undefined4 *param_1)
|
| 3 |
+
|
| 4 |
+
{
|
| 5 |
+
return *param_1;
|
| 6 |
+
}
|
| 7 |
+
|
CREBench/3-Way/public-fragmented_build-O0/decompile/FUN_00101854_decompiled
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
void FUN_00101854(undefined *param_1,undefined4 param_2)
|
| 3 |
+
|
| 4 |
+
{
|
| 5 |
+
*param_1 = (char)param_2;
|
| 6 |
+
param_1[1] = (char)((uint)param_2 >> 8);
|
| 7 |
+
param_1[2] = (char)((uint)param_2 >> 0x10);
|
| 8 |
+
param_1[3] = (char)((uint)param_2 >> 0x18);
|
| 9 |
+
return;
|
| 10 |
+
}
|
| 11 |
+
|
CREBench/3-Way/public-fragmented_build-O0/decompile/FUN_001018a7_decompiled
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
void FUN_001018a7(undefined4 *param_1,undefined4 *param_2,undefined4 *param_3)
|
| 3 |
+
|
| 4 |
+
{
|
| 5 |
+
undefined4 uVar1;
|
| 6 |
+
undefined4 uVar2;
|
| 7 |
+
|
| 8 |
+
uVar1 = FUN_001016c9(*param_1);
|
| 9 |
+
uVar2 = FUN_001016c9(*param_2);
|
| 10 |
+
*param_2 = uVar2;
|
| 11 |
+
uVar2 = FUN_001016c9(*param_3);
|
| 12 |
+
*param_1 = uVar2;
|
| 13 |
+
*param_3 = uVar1;
|
| 14 |
+
return;
|
| 15 |
+
}
|
| 16 |
+
|
CREBench/3-Way/public-fragmented_build-O0/decompile/FUN_00101901_decompiled
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
void FUN_00101901(undefined4 *param_1,uint *param_2,undefined4 *param_3)
|
| 3 |
+
|
| 4 |
+
{
|
| 5 |
+
uint uVar1;
|
| 6 |
+
uint uVar2;
|
| 7 |
+
undefined4 uVar3;
|
| 8 |
+
|
| 9 |
+
uVar1 = FUN_001016ad(*param_3,1);
|
| 10 |
+
uVar2 = FUN_001016ad(*param_1,0x16);
|
| 11 |
+
uVar3 = FUN_001016ad((~uVar1 | *param_2) ^ uVar2,1);
|
| 12 |
+
*param_1 = uVar3;
|
| 13 |
+
uVar3 = FUN_001016ad((~*param_2 | uVar2) ^ uVar1,0x16);
|
| 14 |
+
*param_3 = uVar3;
|
| 15 |
+
*param_2 = *param_2 ^ (~uVar2 | uVar1);
|
| 16 |
+
return;
|
| 17 |
+
}
|
| 18 |
+
|
CREBench/3-Way/public-fragmented_build-O0/decompile/FUN_0010199e_decompiled
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
void FUN_0010199e(uint *param_1,uint *param_2,uint *param_3)
|
| 3 |
+
|
| 4 |
+
{
|
| 5 |
+
uint uVar1;
|
| 6 |
+
uint uVar2;
|
| 7 |
+
uint uVar3;
|
| 8 |
+
|
| 9 |
+
uVar1 = *param_3 ^ *param_1 ^ *param_2;
|
| 10 |
+
uVar2 = FUN_001016ad(uVar1,0x10);
|
| 11 |
+
uVar1 = FUN_001016ad(uVar1,8);
|
| 12 |
+
uVar1 = uVar1 ^ uVar2;
|
| 13 |
+
uVar3 = *param_1 << 0x18 ^ *param_3 >> 8 ^ *param_2 << 8;
|
| 14 |
+
uVar2 = *param_2 >> 0x18 ^ *param_2 << 0x18 ^ *param_1 >> 8 ^ *param_3 << 8;
|
| 15 |
+
*param_1 = *param_1 ^ uVar1 ^ *param_1 >> 0x18 ^ uVar3;
|
| 16 |
+
*param_2 = *param_2 ^ uVar1 ^ uVar2;
|
| 17 |
+
*param_3 = *param_3 ^ uVar2 << 0x10 ^ uVar3 >> 0x10 ^ uVar1;
|
| 18 |
+
return;
|
| 19 |
+
}
|
| 20 |
+
|
CREBench/3-Way/public-fragmented_build-O0/decompile/FUN_00101aa3_decompiled
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
void FUN_00101aa3(undefined8 param_1,undefined8 param_2,undefined8 param_3)
|
| 3 |
+
|
| 4 |
+
{
|
| 5 |
+
FUN_0010199e(param_1,param_2,param_3);
|
| 6 |
+
FUN_00101901(param_1,param_2,param_3);
|
| 7 |
+
return;
|
| 8 |
+
}
|
| 9 |
+
|
CREBench/3-Way/public-fragmented_build-O0/decompile/FUN_00101aec_decompiled
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
uint FUN_00101aec(int param_1)
|
| 3 |
+
|
| 4 |
+
{
|
| 5 |
+
uint local_c;
|
| 6 |
+
|
| 7 |
+
local_c = param_1 << 1;
|
| 8 |
+
if ((local_c & 0x10000) != 0) {
|
| 9 |
+
local_c = local_c ^ 0x11011;
|
| 10 |
+
}
|
| 11 |
+
return local_c;
|
| 12 |
+
}
|
| 13 |
+
|
CREBench/3-Way/public-fragmented_build-O0/decompile/FUN_00101b13_decompiled
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
void FUN_00101b13(undefined4 *param_1,long param_2,undefined4 param_3)
|
| 3 |
+
|
| 4 |
+
{
|
| 5 |
+
undefined4 uVar1;
|
| 6 |
+
|
| 7 |
+
param_1[3] = param_3;
|
| 8 |
+
uVar1 = FUN_0010175f(param_2);
|
| 9 |
+
*param_1 = uVar1;
|
| 10 |
+
uVar1 = FUN_0010175f(param_2 + 4);
|
| 11 |
+
param_1[1] = uVar1;
|
| 12 |
+
uVar1 = FUN_0010175f(param_2 + 8);
|
| 13 |
+
param_1[2] = uVar1;
|
| 14 |
+
return;
|
| 15 |
+
}
|
| 16 |
+
|
CREBench/3-Way/public-fragmented_build-O0/decompile/FUN_00101b77_decompiled
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
undefined8 FUN_00101b77(long param_1,long param_2,int param_3)
|
| 3 |
+
|
| 4 |
+
{
|
| 5 |
+
undefined8 uVar1;
|
| 6 |
+
|
| 7 |
+
if ((param_1 == 0) || (param_2 == 0)) {
|
| 8 |
+
uVar1 = 0xffffffff;
|
| 9 |
+
}
|
| 10 |
+
else {
|
| 11 |
+
if (param_3 == 0) {
|
| 12 |
+
param_3 = 0xb;
|
| 13 |
+
}
|
| 14 |
+
FUN_00101b13(param_1,param_2,param_3);
|
| 15 |
+
uVar1 = 0;
|
| 16 |
+
}
|
| 17 |
+
return uVar1;
|
| 18 |
+
}
|
| 19 |
+
|
CREBench/3-Way/public-fragmented_build-O0/decompile/FUN_00101bd3_decompiled
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
undefined8 FUN_00101bd3(undefined4 *param_1,long param_2,int param_3)
|
| 3 |
+
|
| 4 |
+
{
|
| 5 |
+
undefined8 uVar1;
|
| 6 |
+
long in_FS_OFFSET;
|
| 7 |
+
int local_3c;
|
| 8 |
+
undefined4 local_1c;
|
| 9 |
+
undefined4 local_18;
|
| 10 |
+
undefined4 local_14;
|
| 11 |
+
long local_10;
|
| 12 |
+
|
| 13 |
+
local_10 = *(long *)(in_FS_OFFSET + 0x28);
|
| 14 |
+
if ((param_1 == (undefined4 *)0x0) || (param_2 == 0)) {
|
| 15 |
+
uVar1 = 0xffffffff;
|
| 16 |
+
}
|
| 17 |
+
else {
|
| 18 |
+
local_3c = param_3;
|
| 19 |
+
if (param_3 == 0) {
|
| 20 |
+
local_3c = 0xb;
|
| 21 |
+
}
|
| 22 |
+
local_1c = FUN_0010175f(param_2);
|
| 23 |
+
local_18 = FUN_0010175f(param_2 + 4);
|
| 24 |
+
local_14 = FUN_0010175f(param_2 + 8);
|
| 25 |
+
FUN_0010199e(&local_1c,&local_18,&local_14);
|
| 26 |
+
FUN_001018a7(&local_1c,&local_18,&local_14);
|
| 27 |
+
local_1c = FUN_00101728(local_1c);
|
| 28 |
+
local_18 = FUN_00101728(local_18);
|
| 29 |
+
local_14 = FUN_00101728(local_14);
|
| 30 |
+
param_1[3] = local_3c;
|
| 31 |
+
*param_1 = local_1c;
|
| 32 |
+
param_1[1] = local_18;
|
| 33 |
+
param_1[2] = local_14;
|
| 34 |
+
uVar1 = 0;
|
| 35 |
+
}
|
| 36 |
+
if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) {
|
| 37 |
+
/* WARNING: Subroutine does not return */
|
| 38 |
+
__stack_chk_fail();
|
| 39 |
+
}
|
| 40 |
+
return uVar1;
|
| 41 |
+
}
|
| 42 |
+
|
CREBench/3-Way/public-fragmented_build-O0/decompile/FUN_00101cea_decompiled
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
void FUN_00101cea(uint *param_1,long param_2,long param_3)
|
| 3 |
+
|
| 4 |
+
{
|
| 5 |
+
long in_FS_OFFSET;
|
| 6 |
+
uint local_24;
|
| 7 |
+
uint local_20;
|
| 8 |
+
uint local_1c;
|
| 9 |
+
uint local_18;
|
| 10 |
+
uint local_14;
|
| 11 |
+
long local_10;
|
| 12 |
+
|
| 13 |
+
local_10 = *(long *)(in_FS_OFFSET + 0x28);
|
| 14 |
+
local_24 = FUN_0010175f(param_2);
|
| 15 |
+
local_20 = FUN_0010175f(param_2 + 4);
|
| 16 |
+
local_1c = FUN_0010175f(param_2 + 8);
|
| 17 |
+
local_18 = 0xb0b;
|
| 18 |
+
for (local_14 = 0; local_14 < param_1[3]; local_14 = local_14 + 1) {
|
| 19 |
+
local_24 = local_24 ^ *param_1 ^ local_18 << 0x10;
|
| 20 |
+
local_20 = local_20 ^ param_1[1];
|
| 21 |
+
local_1c = local_1c ^ param_1[2] ^ local_18;
|
| 22 |
+
FUN_00101aa3(&local_24,&local_20,&local_1c);
|
| 23 |
+
local_18 = FUN_00101aec(local_18);
|
| 24 |
+
}
|
| 25 |
+
local_24 = local_24 ^ *param_1 ^ local_18 << 0x10;
|
| 26 |
+
local_20 = local_20 ^ param_1[1];
|
| 27 |
+
local_1c = local_1c ^ param_1[2] ^ local_18;
|
| 28 |
+
FUN_0010199e(&local_24,&local_20,&local_1c);
|
| 29 |
+
FUN_001017b2(param_3,local_24);
|
| 30 |
+
FUN_001017b2(param_3 + 4,local_20);
|
| 31 |
+
FUN_001017b2(param_3 + 8,local_1c);
|
| 32 |
+
if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) {
|
| 33 |
+
/* WARNING: Subroutine does not return */
|
| 34 |
+
__stack_chk_fail();
|
| 35 |
+
}
|
| 36 |
+
return;
|
| 37 |
+
}
|
| 38 |
+
|
CREBench/3-Way/public-fragmented_build-O0/decompile/FUN_00101e65_decompiled
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
void FUN_00101e65(uint *param_1,long param_2,long param_3)
|
| 3 |
+
|
| 4 |
+
{
|
| 5 |
+
long in_FS_OFFSET;
|
| 6 |
+
uint local_24;
|
| 7 |
+
uint local_20;
|
| 8 |
+
uint local_1c;
|
| 9 |
+
uint local_18;
|
| 10 |
+
uint local_14;
|
| 11 |
+
long local_10;
|
| 12 |
+
|
| 13 |
+
local_10 = *(long *)(in_FS_OFFSET + 0x28);
|
| 14 |
+
local_24 = FUN_00101803(param_2);
|
| 15 |
+
local_20 = FUN_00101803(param_2 + 4);
|
| 16 |
+
local_1c = FUN_00101803(param_2 + 8);
|
| 17 |
+
FUN_001018a7(&local_24,&local_20,&local_1c);
|
| 18 |
+
local_18 = 0xb1b1;
|
| 19 |
+
for (local_14 = 0; local_14 < param_1[3]; local_14 = local_14 + 1) {
|
| 20 |
+
local_24 = local_24 ^ *param_1 ^ local_18 << 0x10;
|
| 21 |
+
local_20 = local_20 ^ param_1[1];
|
| 22 |
+
local_1c = local_1c ^ param_1[2] ^ local_18;
|
| 23 |
+
FUN_00101aa3(&local_24,&local_20,&local_1c);
|
| 24 |
+
local_18 = FUN_00101aec(local_18);
|
| 25 |
+
}
|
| 26 |
+
local_24 = local_24 ^ *param_1 ^ local_18 << 0x10;
|
| 27 |
+
local_20 = local_20 ^ param_1[1];
|
| 28 |
+
local_1c = local_1c ^ param_1[2] ^ local_18;
|
| 29 |
+
FUN_0010199e(&local_24,&local_20,&local_1c);
|
| 30 |
+
FUN_001018a7(&local_24,&local_20,&local_1c);
|
| 31 |
+
FUN_00101854(param_3,local_24);
|
| 32 |
+
FUN_00101854(param_3 + 4,local_20);
|
| 33 |
+
FUN_00101854(param_3 + 8,local_1c);
|
| 34 |
+
if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) {
|
| 35 |
+
/* WARNING: Subroutine does not return */
|
| 36 |
+
__stack_chk_fail();
|
| 37 |
+
}
|
| 38 |
+
return;
|
| 39 |
+
}
|
| 40 |
+
|
CREBench/3-Way/public-fragmented_build-O0/decompile/FUN_0010200e_decompiled
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
void FUN_0010200e(undefined8 param_1,long param_2,long param_3,ulong param_4)
|
| 3 |
+
|
| 4 |
+
{
|
| 5 |
+
ulong local_10;
|
| 6 |
+
|
| 7 |
+
for (local_10 = 0; local_10 < param_4; local_10 = local_10 + 0xc) {
|
| 8 |
+
FUN_00101cea(param_1,param_2 + local_10,param_3 + local_10);
|
| 9 |
+
}
|
| 10 |
+
return;
|
| 11 |
+
}
|
| 12 |
+
|
CREBench/3-Way/public-fragmented_build-O0/decompile/FUN_0010206c_decompiled
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
void FUN_0010206c(undefined8 param_1,long param_2,long param_3,ulong param_4)
|
| 3 |
+
|
| 4 |
+
{
|
| 5 |
+
ulong local_10;
|
| 6 |
+
|
| 7 |
+
for (local_10 = 0; local_10 < param_4; local_10 = local_10 + 0xc) {
|
| 8 |
+
FUN_00101e65(param_1,param_2 + local_10,param_3 + local_10);
|
| 9 |
+
}
|
| 10 |
+
return;
|
| 11 |
+
}
|
| 12 |
+
|
CREBench/3-Way/public-fragmented_build-O0/decompile/FUN_001020ca_decompiled
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
void FUN_001020ca(undefined8 param_1,undefined8 *param_2,long param_3,long param_4,ulong param_5)
|
| 3 |
+
|
| 4 |
+
{
|
| 5 |
+
long in_FS_OFFSET;
|
| 6 |
+
ulong local_38;
|
| 7 |
+
ulong local_30;
|
| 8 |
+
undefined8 local_28;
|
| 9 |
+
undefined4 local_20;
|
| 10 |
+
byte local_1c [12];
|
| 11 |
+
long local_10;
|
| 12 |
+
|
| 13 |
+
local_10 = *(long *)(in_FS_OFFSET + 0x28);
|
| 14 |
+
local_28 = *param_2;
|
| 15 |
+
local_20 = *(undefined4 *)(param_2 + 1);
|
| 16 |
+
for (local_38 = 0; local_38 < param_5; local_38 = local_38 + 0xc) {
|
| 17 |
+
for (local_30 = 0; local_30 < 0xc; local_30 = local_30 + 1) {
|
| 18 |
+
local_1c[local_30] =
|
| 19 |
+
*(byte *)(param_3 + local_38 + local_30) ^ *(byte *)((long)&local_28 + local_30);
|
| 20 |
+
}
|
| 21 |
+
FUN_00101cea(param_1,local_1c,param_4 + local_38);
|
| 22 |
+
local_28 = *(undefined8 *)(local_38 + param_4);
|
| 23 |
+
local_20 = *(undefined4 *)((undefined8 *)(local_38 + param_4) + 1);
|
| 24 |
+
}
|
| 25 |
+
if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) {
|
| 26 |
+
/* WARNING: Subroutine does not return */
|
| 27 |
+
__stack_chk_fail();
|
| 28 |
+
}
|
| 29 |
+
return;
|
| 30 |
+
}
|
| 31 |
+
|
CREBench/3-Way/public-fragmented_build-O0/decompile/FUN_001021bf_decompiled
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
void FUN_001021bf(undefined8 param_1,undefined8 *param_2,long param_3,long param_4,ulong param_5)
|
| 3 |
+
|
| 4 |
+
{
|
| 5 |
+
long in_FS_OFFSET;
|
| 6 |
+
ulong local_38;
|
| 7 |
+
ulong local_30;
|
| 8 |
+
undefined8 local_28;
|
| 9 |
+
undefined4 local_20;
|
| 10 |
+
undefined8 local_1c;
|
| 11 |
+
undefined4 local_14;
|
| 12 |
+
long local_10;
|
| 13 |
+
|
| 14 |
+
local_10 = *(long *)(in_FS_OFFSET + 0x28);
|
| 15 |
+
local_28 = *param_2;
|
| 16 |
+
local_20 = *(undefined4 *)(param_2 + 1);
|
| 17 |
+
for (local_38 = 0; local_38 < param_5; local_38 = local_38 + 0xc) {
|
| 18 |
+
local_1c = *(undefined8 *)(local_38 + param_3);
|
| 19 |
+
local_14 = *(undefined4 *)((undefined8 *)(local_38 + param_3) + 1);
|
| 20 |
+
FUN_00101e65(param_1,param_3 + local_38,param_4 + local_38);
|
| 21 |
+
for (local_30 = 0; local_30 < 0xc; local_30 = local_30 + 1) {
|
| 22 |
+
*(byte *)(param_4 + local_38 + local_30) =
|
| 23 |
+
*(byte *)((long)&local_28 + local_30) ^ *(byte *)(param_4 + local_38 + local_30);
|
| 24 |
+
}
|
| 25 |
+
local_28 = local_1c;
|
| 26 |
+
local_20 = local_14;
|
| 27 |
+
}
|
| 28 |
+
if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) {
|
| 29 |
+
/* WARNING: Subroutine does not return */
|
| 30 |
+
__stack_chk_fail();
|
| 31 |
+
}
|
| 32 |
+
return;
|
| 33 |
+
}
|
| 34 |
+
|
CREBench/3-Way/public-fragmented_build-O0/decompile/_DT_FINI_decompiled
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
void _DT_FINI(void)
|
| 3 |
+
|
| 4 |
+
{
|
| 5 |
+
return;
|
| 6 |
+
}
|
| 7 |
+
|