浏览代码

Solution S2T2 cleaned

master
父节点
当前提交
d4c157fda3
共有 10 个文件被更改,包括 524 次插入1227 次删除
  1. +11
    -10
      Makefile
  2. +293
    -144
      prj/Matasano.sublime-workspace
  3. +0
    -1
      sol/set1.cpp
  4. +7
    -8
      sol/set1.h
  5. +81
    -43
      sol/set2.c
  6. +4
    -2
      sol/set2.h
  7. +11
    -5
      src/common.c
  8. +101
    -51
      src/enc_modes.c
  9. +16
    -1
      src/main.cpp
  10. +0
    -962
      suppressions.valgrind

+ 11
- 10
Makefile 查看文件

@@ -37,12 +37,12 @@ obj/%.o: tst/%.c

all: create_directories obj-c obj-cpp sol-c sol-cpp tst-c tst-cpp
g++ ${CFLAGS} -I${INC} -o main ${OBJ_SRC_C_FILES} \
${OBJ_SRC_CPP_FILES} \
${OBJ_SOL_C_FILES} \
${OBJ_SOL_CPP_FILES} \
${OBJ_TST_C_FILES} \
${OBJ_TST_CPP_FILES} \
${LIBS}
${OBJ_SRC_CPP_FILES} \
${OBJ_SOL_C_FILES} \
${OBJ_SOL_CPP_FILES} \
${OBJ_TST_C_FILES} \
${OBJ_TST_CPP_FILES} \
${LIBS}

create_directories:
mkdir -p obj
@@ -52,13 +52,14 @@ clean:
rm -rf main
rm -rf core*

obj-c: ${OBJ_SRC_C_FILES}
obj-c: ${OBJ_SRC_C_FILES}
obj-cpp: ${OBJ_SRC_CPP_FILES}
sol-c: ${OBJ_SOL_C_FILES}
sol-c: ${OBJ_SOL_C_FILES}
sol-cpp: ${OBJ_SOL_CPP_FILES}
tst-c: ${OBJ_TST_C_FILES}
tst-c: ${OBJ_TST_C_FILES}
tst-cpp: ${OBJ_TST_CPP_FILES}

.PHONY: valgrind
valgrind:
valgrind --suppressions=suppressions.valgrind --leak-check=full ./main
# valgrind --suppressions=suppressions.valgrind --leak-check=full ./main
valgrind --leak-check=full --show-leak-kinds=all ./main

+ 293
- 144
prj/Matasano.sublime-workspace 查看文件

@@ -3,17 +3,37 @@
{
"selected_items":
[
[
"test",
"test_text"
],
[
"inpu",
"input"
],
[
"TCASE",
"TCASE_E"
],
[
"out",
"output_len"
],
[
"Resu",
"Result_Error"
"Result_OK"
],
[
"output",
"inp",
"input_len"
],
[
"ou",
"output_len"
],
[
"inpu",
"input"
"output",
"output_len"
],
[
"input",
@@ -55,10 +75,6 @@
"Encryptio",
"EncryptionContent_t"
],
[
"out",
"output"
],
[
"EVP_En",
"EVP_EncryptFinal"
@@ -498,96 +514,112 @@
[
"TrafficEve",
"TrafficEventHandlerBase"
],
[
"_close",
"_closeOnReplyPending"
],
[
"CMGC",
"CMGCxnToken_t"
],
[
"getBack",
"getBackRoutingStore"
],
[
"getBac",
"getBackRoutingKey"
]
]
},
"buffers":
[
{
"file": "/home/flowher/repos/MatasanoCrypto/sol/set1.cpp",
"file": "/home/flowher/repos/MatasanoCrypto/sol/set1.h",
"settings":
{
"buffer_size": 12489,
"buffer_size": 623,
"line_ending": "Unix"
}
},
{
"file": "/home/flowher/repos/MatasanoCrypto/sol/set2.h",
"file": "/home/flowher/repos/MatasanoCrypto/tst/utils.h",
"settings":
{
"buffer_size": 342,
"buffer_size": 396,
"line_ending": "Unix"
}
},
{
"file": "/home/flowher/test.cpp",
"file": "/home/flowher/repos/MatasanoCrypto/src/main.cpp",
"settings":
{
"buffer_size": 282,
"buffer_size": 404,
"line_ending": "Unix"
}
},
{
"file": "/home/flowher/repos/MatasanoCrypto/src/hamming.c",
"file": "/home/flowher/repos/MatasanoCrypto/sol/set2.c",
"settings":
{
"buffer_size": 1690,
"buffer_size": 7492,
"line_ending": "Unix"
}
},
{
"file": "/home/flowher/repos/MatasanoCrypto/src/base64.cpp",
"file": "/home/flowher/repos/MatasanoCrypto/src/enc_modes.c",
"settings":
{
"buffer_size": 8033,
"buffer_size": 6109,
"line_ending": "Unix"
}
},
{
"file": "/home/flowher/repos/MatasanoCrypto/src/xor_char_finder.cpp",
"contents": "\n\n\n /// TO NIE DZIALA\n\n\n\n printf(\"DUPA\");\n CryptoAttribs_t attr;\n CryptoAttribs_t::Init(&attr);\n attr.input = (uint8_t*)malloc(16);\n memcpy(attr.input, out, 16);\n assert( ecb_decrypt(&attr, key) == Result_OK );\n printf(\"%s \\n %d\\n\", attr.output, attr.output_len);\n printf(\"DUPA\");\n\n\n\n\n\n",
"settings":
{
"buffer_size": 6026,
"buffer_size": 313,
"line_ending": "Unix"
}
},
{
"file": "/home/flowher/repos/MatasanoCrypto/sol/set2.c",
"file": "/home/flowher/repos/MatasanoCrypto/sol/set2.h",
"settings":
{
"buffer_size": 5962,
"buffer_size": 427,
"line_ending": "Unix"
}
},
{
"file": "/home/flowher/repos/MatasanoCrypto/src/enc_modes.c",
"file": "/home/flowher/repos/MatasanoCrypto/src/common.c",
"settings":
{
"buffer_size": 2911,
"line_ending": "Unix"
}
},
{
"file": "/home/flowher/repos/MatasanoCrypto/src/common.h",
"settings":
{
"buffer_size": 2306,
"line_ending": "Unix"
}
},
{
"file": "/home/flowher/test.cpp",
"settings":
{
"buffer_size": 4546,
"buffer_size": 282,
"line_ending": "Unix"
}
},
{
"file": "/home/flowher/repos/notes/french/words/words.md",
"file": "/home/flowher/repos/MatasanoCrypto/src/hamming.c",
"settings":
{
"buffer_size": 757,
"buffer_size": 1690,
"line_ending": "Unix"
}
},
{
"file": "/home/flowher/repos/MatasanoCrypto/src/xor_char_finder.cpp",
"settings":
{
"buffer_size": 6026,
"line_ending": "Unix"
}
},
{
"file": "/home/flowher/repos/MatasanoCrypto/sol/etc/set2_t2.txt",
"settings":
{
"buffer_size": 3904,
"line_ending": "Unix"
}
}
@@ -599,10 +631,22 @@
"build_varint": "",
"command_palette":
{
"height": 201.0,
"last_filter": "",
"height": 243.0,
"last_filter": "comme",
"selected_items":
[
[
"comme",
"Toggle Comment"
],
[
"comm",
"Toggle Comment"
],
[
"convert",
"Indentation: Convert to Spaces"
],
[
"install",
"Package Control: Install Package"
@@ -611,10 +655,6 @@
"check",
"Google Spell Check"
],
[
"comme",
"Snippet: comment-simple"
],
[
"newhfi",
"Snippet: newhfile"
@@ -719,10 +759,6 @@
"mark",
"Markdown Preview: Preview in Browser"
],
[
"comm",
"Toggle Comment"
],
[
"mardo",
"Markdown Preview: Preview in Browser"
@@ -1001,17 +1037,26 @@
[
"/home/flowher/repos/MatasanoCrypto",
"/home/flowher/repos/MatasanoCrypto/sol",
"/home/flowher/repos/MatasanoCrypto/src"
"/home/flowher/repos/MatasanoCrypto/sol/etc",
"/home/flowher/repos/MatasanoCrypto/src",
"/home/flowher/repos/MatasanoCrypto/tst"
],
"file_history":
[
"/home/flowher/repos/notes/french/words/words.md",
"/home/flowher/repos/MatasanoCrypto/Makefile",
"/home/flowher/repos/MatasanoCrypto/src/enc_modes.c",
"/home/flowher/repos/OpenCrypto/crypto/evp/evp_enc.c",
"/home/flowher/repos/OpenCrypto/crypto/err/err.c",
"/home/flowher/repos/MatasanoCrypto/src/base64.cpp",
"/home/flowher/repos/MatasanoCrypto/sol/set1.cpp",
"/home/flowher/repos/MatasanoCrypto/src/xor.c",
"/home/flowher/Work/zshrc",
"/home/flowher/repos/MatasanoCrypto/sol/set2.h",
"/home/flowher/repos/MatasanoCrypto/src/common.h",
"/home/flowher/repos/MatasanoCrypto/src/common.c",
"/home/flowher/repos/MatasanoCrypto/sol/set2.c",
"/home/flowher/ripi_pass",
"/home/flowher/repos/notes/french/words/words.md",
"/home/flowher/Work/zshrc",
"/home/flowher/repos/MatasanoCrypto/tst/utils.cpp",
"/home/flowher/Work/.source",
"/home/flowher/repos/MatasanoCrypto/src/enc_modes.h",
@@ -1020,15 +1065,12 @@
"/home/flowher/repos/MatasanoCrypto/src/xor_char_finder.h",
"/home/flowher/repos/MatasanoCrypto/src/base64.h",
"/home/flowher/repos/MatasanoCrypto/suppressions.valgrind",
"/home/flowher/repos/MatasanoCrypto/src/base64.cpp",
"/home/flowher/repos/MatasanoCrypto/tst/utils.h",
"/home/flowher/repos/MatasanoCrypto/src/ecb.c",
"/home/flowher/test.cpp",
"/home/flowher/test.c",
"/home/flowher/.config/sublime-text-3/Packages/User/Preferences.sublime-settings",
"/home/flowher/repos/MatasanoCrypto/prj/Matasano.sublime-project",
"/home/flowher/repos/MatasanoCrypto/sol/set2.h",
"/home/flowher/repos/MatasanoCrypto/sol/set1.cpp",
"/home/flowher/repos/MatasanoCrypto/src/main.cpp",
"/home/flowher/repos/notes/french/words/words",
"/home/flowher/repos/MatasanoCrypto/sol/main.cpp",
@@ -1128,11 +1170,7 @@
"/home/kkwiatkowski/storage/91_Repositories/srp_client_server_implementation_with_openssl/server.cpp",
"/home/kkwiatkowski/storage/91_Repositories/openssl101j/include/openssl/symhacks.h",
"/home/kkwiatkowski/storage/91_Repositories/openssl101j/crypto/symhacks.h",
"/home/kkwiatkowski/storage/91_Repositories/openssl101j/ssl/tls_srp.c",
"/home/kkwiatkowski/amadeus_workdir/repos/03_Components/acf_ssl/br_12-0-1/src/SSLEngineInit.cpp",
"/home/kkwiatkowski/storage/91_Repositories/openssl101j/ssl/ssltest.c",
"/home/kkwiatkowski/storage/91_Repositories/openssl101j/test/ssltest",
"/home/kkwiatkowski/storage/91_Repositories/openssl101j/apps/s_client.c"
"/home/kkwiatkowski/storage/91_Repositories/openssl101j/ssl/tls_srp.c"
],
"find":
{
@@ -1207,6 +1245,22 @@
"case_sensitive": false,
"find_history":
[
"exit",
"ecb_encrypt_decrypt",
"32",
"16",
"&ctx",
"ecb_encrypt",
"key->len",
"cbc_decrypt",
"attribs",
"OS_CHECK",
"set1_challenge_8_test",
"printf",
"ecb_encrypt",
"EVP_CIPHER_CTX_set_padding",
"ecb_decrypt",
"uint8_t",
"cbc_enc_dec_test",
"g++ ",
"memcpy",
@@ -1318,23 +1372,7 @@
"frequency_set",
"utils_tester",
"set2_",
"int24",
"hex_to_base64",
"getline",
"t.",
"i_string+pointer",
"t[",
"int_to_base64",
"i_size",
"printf(",
"xor_strings",
"#include \"utils/hex_to_base64.h\"\n",
"max_score",
"challenge3",
"gcc",
"fill_frequency",
"#define FREQUENT_LETTERS_AMOUNT 5\n",
"size_t"
"int24"
],
"highlight": true,
"in_selection": false,
@@ -1400,53 +1438,54 @@
"groups":
[
{
"selected": 8,
"selected": 4,
"sheets":
[
{
"buffer": 0,
"file": "/home/flowher/repos/MatasanoCrypto/sol/set1.cpp",
"file": "/home/flowher/repos/MatasanoCrypto/sol/set1.h",
"semi_transient": false,
"settings":
{
"buffer_size": 12489,
"buffer_size": 623,
"regions":
{
},
"selection":
[
[
11546,
11546
488,
488
]
],
"settings":
{
"syntax": "Packages/C++/C++.tmLanguage",
"translate_tabs_to_spaces": false
"syntax": "Packages/C Improved/C Improved.tmLanguage",
"tab_size": 4,
"translate_tabs_to_spaces": true
},
"translation.x": 0.0,
"translation.y": 3788.0,
"translation.y": 0.0,
"zoom_level": 1.0
},
"stack_index": 4,
"stack_index": 7,
"type": "text"
},
{
"buffer": 1,
"file": "/home/flowher/repos/MatasanoCrypto/sol/set2.h",
"file": "/home/flowher/repos/MatasanoCrypto/tst/utils.h",
"semi_transient": false,
"settings":
{
"buffer_size": 342,
"buffer_size": 396,
"regions":
{
},
"selection":
[
[
231,
231
396,
396
]
],
"settings":
@@ -1457,24 +1496,24 @@
"translation.y": 0.0,
"zoom_level": 1.0
},
"stack_index": 3,
"stack_index": 11,
"type": "text"
},
{
"buffer": 2,
"file": "/home/flowher/test.cpp",
"file": "/home/flowher/repos/MatasanoCrypto/src/main.cpp",
"semi_transient": false,
"settings":
{
"buffer_size": 282,
"buffer_size": 404,
"regions":
{
},
"selection":
[
[
133,
133
404,
404
]
],
"settings":
@@ -1485,121 +1524,119 @@
"translation.y": 0.0,
"zoom_level": 1.0
},
"stack_index": 5,
"stack_index": 3,
"type": "text"
},
{
"buffer": 3,
"file": "/home/flowher/repos/MatasanoCrypto/src/hamming.c",
"file": "/home/flowher/repos/MatasanoCrypto/sol/set2.c",
"semi_transient": false,
"settings":
{
"buffer_size": 1690,
"buffer_size": 7492,
"regions":
{
},
"selection":
[
[
69,
69
4459,
4459
]
],
"settings":
{
"syntax": "Packages/C Improved/C Improved.tmLanguage",
"translate_tabs_to_spaces": false
"tab_size": 4,
"translate_tabs_to_spaces": true
},
"translation.x": 0.0,
"translation.y": 0.0,
"translation.y": 1561.0,
"zoom_level": 1.0
},
"stack_index": 7,
"stack_index": 1,
"type": "text"
},
{
"buffer": 4,
"file": "/home/flowher/repos/MatasanoCrypto/src/base64.cpp",
"file": "/home/flowher/repos/MatasanoCrypto/src/enc_modes.c",
"semi_transient": false,
"settings":
{
"buffer_size": 8033,
"buffer_size": 6109,
"regions":
{
},
"selection":
[
[
100,
100
3005,
3005
]
],
"settings":
{
"syntax": "Packages/C++/C++.tmLanguage",
"translate_tabs_to_spaces": false
"syntax": "Packages/C Improved/C Improved.tmLanguage",
"tab_size": 4,
"translate_tabs_to_spaces": true
},
"translation.x": 0.0,
"translation.y": 0.0,
"translation.y": 626.0,
"zoom_level": 1.0
},
"stack_index": 6,
"stack_index": 0,
"type": "text"
},
{
"buffer": 5,
"file": "/home/flowher/repos/MatasanoCrypto/src/xor_char_finder.cpp",
"semi_transient": false,
"settings":
{
"buffer_size": 6026,
"buffer_size": 313,
"regions":
{
},
"selection":
[
[
4445,
4445
313,
313
]
],
"settings":
{
"syntax": "Packages/C++/C++.tmLanguage",
"translate_tabs_to_spaces": false
"syntax": "Packages/C Improved/C Improved.tmLanguage"
},
"translation.x": 0.0,
"translation.y": 1014.0,
"translation.y": 0.0,
"zoom_level": 1.0
},
"stack_index": 8,
"stack_index": 5,
"type": "text"
},
{
"buffer": 6,
"file": "/home/flowher/repos/MatasanoCrypto/sol/set2.c",
"file": "/home/flowher/repos/MatasanoCrypto/sol/set2.h",
"semi_transient": false,
"settings":
{
"buffer_size": 5962,
"buffer_size": 427,
"regions":
{
},
"selection":
[
[
2918,
2918
427,
427
]
],
"settings":
{
"syntax": "Packages/C Improved/C Improved.tmLanguage",
"tab_size": 4,
"translate_tabs_to_spaces": true
"syntax": "Packages/C Improved/C Improved.tmLanguage"
},
"translation.x": 0.0,
"translation.y": 1264.0,
"translation.y": 0.0,
"zoom_level": 1.0
},
"stack_index": 2,
@@ -1607,49 +1644,161 @@
},
{
"buffer": 7,
"file": "/home/flowher/repos/MatasanoCrypto/src/enc_modes.c",
"file": "/home/flowher/repos/MatasanoCrypto/src/common.c",
"semi_transient": false,
"settings":
{
"buffer_size": 4546,
"buffer_size": 2911,
"regions":
{
},
"selection":
[
[
4483,
4483
124,
124
]
],
"settings":
{
"syntax": "Packages/C Improved/C Improved.tmLanguage",
"tab_size": 4,
"translate_tabs_to_spaces": true
"syntax": "Packages/C Improved/C Improved.tmLanguage"
},
"translation.x": 0.0,
"translation.y": 1893.0,
"translation.y": 2040.0,
"zoom_level": 1.0
},
"stack_index": 1,
"stack_index": 9,
"type": "text"
},
{
"buffer": 8,
"file": "/home/flowher/repos/notes/french/words/words.md",
"file": "/home/flowher/repos/MatasanoCrypto/src/common.h",
"semi_transient": false,
"settings":
{
"buffer_size": 2306,
"regions":
{
},
"selection":
[
[
384,
384
]
],
"settings":
{
"syntax": "Packages/C Improved/C Improved.tmLanguage"
},
"translation.x": 0.0,
"translation.y": 0.0,
"zoom_level": 1.0
},
"stack_index": 4,
"type": "text"
},
{
"buffer": 9,
"file": "/home/flowher/test.cpp",
"semi_transient": false,
"settings":
{
"buffer_size": 282,
"regions":
{
},
"selection":
[
[
133,
133
]
],
"settings":
{
"syntax": "Packages/C++/C++.tmLanguage"
},
"translation.x": 0.0,
"translation.y": 0.0,
"zoom_level": 1.0
},
"stack_index": 12,
"type": "text"
},
{
"buffer": 10,
"file": "/home/flowher/repos/MatasanoCrypto/src/hamming.c",
"semi_transient": false,
"settings":
{
"buffer_size": 757,
"buffer_size": 1690,
"regions":
{
},
"selection":
[
[
245,
245
69,
69
]
],
"settings":
{
"syntax": "Packages/C Improved/C Improved.tmLanguage",
"translate_tabs_to_spaces": false
},
"translation.x": 0.0,
"translation.y": 0.0,
"zoom_level": 1.0
},
"stack_index": 8,
"type": "text"
},
{
"buffer": 11,
"file": "/home/flowher/repos/MatasanoCrypto/src/xor_char_finder.cpp",
"semi_transient": false,
"settings":
{
"buffer_size": 6026,
"regions":
{
},
"selection":
[
[
3075,
3075
]
],
"settings":
{
"syntax": "Packages/C++/C++.tmLanguage",
"translate_tabs_to_spaces": false
},
"translation.x": 0.0,
"translation.y": 1014.0,
"zoom_level": 1.0
},
"stack_index": 6,
"type": "text"
},
{
"buffer": 12,
"file": "/home/flowher/repos/MatasanoCrypto/sol/etc/set2_t2.txt",
"semi_transient": false,
"settings":
{
"buffer_size": 3904,
"regions":
{
},
"selection":
[
[
6,
6
]
],
"settings":
@@ -1660,7 +1809,7 @@
"translation.y": 0.0,
"zoom_level": 1.0
},
"stack_index": 0,
"stack_index": 10,
"type": "text"
}
]


+ 0
- 1
sol/set1.cpp 查看文件

@@ -246,7 +246,6 @@ TCASE(set1_challenge_7_test)
memcmp( attribs.output,
expected_first_line,
strlen(expected_first_line))==0, attribs.output);

Key_t::Free(&key);
CryptoAttribs_t::Free(&attribs);
}


+ 7
- 8
sol/set1.h 查看文件

@@ -11,18 +11,17 @@ void set1_challenge_7_test();
void set1_challenge_8_test();
namespace SET1 {

void run()
{
void run()
{
crack_repeted_xor_test();
xor_char_finder_test();
set1_challenge3_test();
set1_challange4_test();
set1_challenge_5_test();
set1_challenge3_test();
set1_challange4_test();
set1_challenge_5_test();
set1_challenge_6_test();
set1_challenge_7_test();
set1_challenge_8_test();
set1_challenge_6_test();
}
}

}



+ 81
- 43
sol/set2.c 查看文件

@@ -6,6 +6,7 @@
#include <string.h>
#include <openssl/evp.h>
#include <openssl/rand.h>
#include <assert.h>

struct SyncOperations
{
@@ -43,23 +44,55 @@ struct OpenSSL
i_attribs->output = (uint8_t*) malloc(i_attribs->input_len);
}

int ret, ret_fin;
ret=ret_fin=0;
int ret=0;
EVP_CIPHER_CTX ctx;
EVP_CIPHER_CTX_init(&ctx);
sop.init(&ctx, EVP_aes_128_cbc(), i_key->key, i_attribs->iv);
EVP_CIPHER_CTX_set_padding(&ctx, 0);
EVP_CIPHER_CTX_set_key_length(&ctx, i_key->len);

// for...
sop.update(&ctx, i_attribs->output, &ret, i_attribs->input,
i_attribs->input_len);
sop.final (&ctx, (i_attribs->output)+ret, &ret_fin);
i_attribs->output_len = ret+ret_fin;
i_attribs->output_len = ret;
sop.final (&ctx, (i_attribs->output)+ret, &ret);
i_attribs->output_len += ret;
return 1;
}
};

TCASE(ecb_encrypt_decrypt_single_block)
{
static const uint8_t expected_result[17] = "0123456789123456";
CryptoAttribs_t encode, decode;
Key_t key1;
CryptoAttribs_t::Init(&encode);
CryptoAttribs_t::Init(&decode);
Key_t::Init(&key1);

encode.input = (uint8_t*)malloc(16);
encode.input_len=16;
decode.input = (uint8_t*)malloc(16);
decode.input_len=16;
key1.key = (uint8_t*)malloc(16);
key1.len = 16;

memcpy(key1.key, "YELLOW SUBMARINE", 16);
memcpy(encode.input, expected_result, 16);
ecb_encrypt(&encode, &key1);
CHECK(encode.output_len==16);

memcpy(decode.input, encode.output, 16);
ecb_decrypt(&decode, &key1);
CHECK(decode.output_len == 16);

CHECK(memcmp(decode.output, expected_result, 16) == 0);

CryptoAttribs_t::Free(&encode);
CryptoAttribs_t::Free(&decode);
Key_t::Free(&key1);
}
TCASE_E

TCASE(pkcs7_test)
{
// int pkcs7_pad(const char* i_buff, const size_t i_len, char* o_buff );
@@ -80,78 +113,83 @@ TCASE(pkcs7_test)
}
TCASE_E


TCASE(cbc_enc_dec_test)
{
static const uint8_t test_text[49] = "The quick brown fox jumps over the lazy mad dog.";
CryptoAttribs_t attribs;
CryptoAttribs_t enc_attribs;
CryptoAttribs_t dec_attribs;
Key_t key;

CryptoAttribs_t::Init(&enc_attribs);
CryptoAttribs_t::Init(&dec_attribs);
Key_t::Init(&key);

// Setup key
key.len = 16;
key.key = (uint8_t*) malloc(key.len);
memcpy(key.key, "YELLOW SUBMARINE", key.len);

CryptoAttribs_t::Init(&attribs);
attribs.input_len = 48;
attribs.input = (uint8_t*) malloc(attribs.input_len);
memcpy( attribs.input, test_text, attribs.input_len);

attribs.iv_len = key.len;
attribs.iv = (uint8_t*) malloc(attribs.iv_len);
memset(attribs.iv, '0', attribs.iv_len);

cbc_encrypt(&attribs, &key);

free(attribs.input);
attribs.input = (uint8_t*) malloc(attribs.output_len);
attribs.input_len = attribs.output_len;
memcpy(attribs.input, attribs.output, attribs.output_len);

free(attribs.output);
attribs.output = NULL;
attribs.output_len = 0;

cbc_decrypt(&attribs, &key);

CHECK(memcmp(attribs.output, test_text, attribs.output_len) == 0, attribs.output);

memcpy(key.key, "0123456789123456", key.len);

// Encrypt
enc_attribs.input_len = sizeof(test_text)-1;
enc_attribs.input = (uint8_t*) malloc(enc_attribs.input_len);
enc_attribs.operation = kEncrypt;
memcpy( enc_attribs.input, test_text, enc_attribs.input_len);
enc_attribs.iv_len = key.len;
enc_attribs.iv = (uint8_t*)malloc(enc_attribs.iv_len);
memset(enc_attribs.iv, 0, enc_attribs.iv_len);
cbc_encrypt(&enc_attribs, &key);

// Setup decryption object.
dec_attribs.iv = (uint8_t*)malloc( enc_attribs.iv_len );
dec_attribs.iv_len = enc_attribs.iv_len;
dec_attribs.operation = kDecrypt;
memset(dec_attribs.iv, 0, dec_attribs.iv_len);
dec_attribs.input = (uint8_t*)malloc(enc_attribs.output_len);
dec_attribs.input_len = enc_attribs.output_len;
memcpy(dec_attribs.input, enc_attribs.output, enc_attribs.output_len);

// Decrypt
cbc_decrypt(&dec_attribs, &key);
CHECK( dec_attribs.output_len+1 == sizeof(test_text), (uint8_t*) "wrong size of ouptut");
CHECK(memcmp(dec_attribs.output, test_text, dec_attribs.output_len) == 0, dec_attribs.output);

end:
CryptoAttribs_t::Free(&enc_attribs);
CryptoAttribs_t::Free(&dec_attribs);
Key_t::Free(&key);
CryptoAttribs_t::Init(&attribs);
}
TCASE_E


TCASE(cbc_decrypt_test)
{
static const uint8_t expected_result[34] = "I'm back and I'm ringin' the bell";
CryptoAttribs_t attribs;
Key_t key;
Result_t res = Result_Error;

Key_t::Init(&key);
key.len = 16;
key.key = (uint8_t*) malloc(key.len * sizeof(uint8_t));
key.key = (uint8_t*) malloc(key.len);
memcpy(key.key,"YELLOW SUBMARINE",key.len);

CryptoAttribs_t::Init(&attribs);
attribs.iv = (uint8_t*) malloc(key.len * sizeof(uint8_t));
attribs.iv = (uint8_t*) malloc(key.len);
attribs.iv_len = key.len;
memset(attribs.iv, '0', attribs.iv_len);
memset(attribs.iv, 0, attribs.iv_len);

res = load_base64_to_hex(
"sol/etc/set2_t2.txt",
&(attribs.input),
&(attribs.input_len));

CHECK(res == Result_OK, (const uint8_t*) "Problem when loading input file");
cbc_decrypt(&attribs, &key);
printf("%.20s\n", attribs.output);

CHECK( memcmp(expected_result, attribs.output, 33) == 0, (const uint8_t*)
"Wrong plaintext decrypted");
// cleanup
CryptoAttribs_t::Free(&attribs);
Key_t::Free(&key);
}
TCASE_E

/*
TCASE(encode_decode_openssl)
{


+ 4
- 2
sol/set2.h 查看文件

@@ -4,16 +4,18 @@
void pkcs7_test();
void cbc_decrypt_test();
void cbc_enc_dec_test();
void ecb_encrypt_decrypt_single_block();
//void encode_decode_openssl();

struct SET2
{
static void run()
{
ecb_encrypt_decrypt_single_block();
pkcs7_test();
cbc_enc_dec_test();
cbc_decrypt_test();
//encode_decode_openssl();
cbc_enc_dec_test();
// encode_decode_openssl();
}
};



+ 11
- 5
src/common.c 查看文件

@@ -37,7 +37,7 @@ unsigned long read_file_to_buffer( const char* const filepath,
if( (fh=fopen(filepath, "rb")) == 0 )
{
fprintf(stderr, "File %s doesn't exist. Exiting...\n", filepath);
exit(1);
goto end;
}

if(NULL==(*obuff))
@@ -62,6 +62,9 @@ unsigned long read_file_to_buffer( const char* const filepath,
line=NULL;
len=0;
}

end:
fclose(fh);
return total_len;
}

@@ -116,17 +119,17 @@ void CryptoAttribs_t::Init(CryptoAttribs_t* ctx)

void CryptoAttribs_t::Free(CryptoAttribs_t* ctx)
{
if(ctx->iv)
if(ctx->iv!=NULL)
{
::free(ctx->iv);
ctx->iv=NULL;
}
if(ctx->output)
if(ctx->output!=NULL)
{
::free(ctx->output);
ctx->output=NULL;
}
if(ctx->input)
if(ctx->input!=NULL)
{
::free(ctx->input);
ctx->input=NULL;
@@ -145,7 +148,10 @@ void Key_t::Init(Key_t* ctx)

void Key_t::Free(Key_t* ctx)
{
if(ctx->key)
if(ctx->key!=NULL)
{
::free(ctx->key);
ctx->key = NULL;
}
ctx->len = 0;
}

+ 101
- 51
src/enc_modes.c 查看文件

@@ -2,75 +2,121 @@
#include <string.h>
#include <inttypes.h>
#include <openssl/evp.h>
#include <assert.h>
#include "common.h"
#include "xor.h"
#include "base64.h" // to del
#include <openssl/err.h>

#define OP_CHECK(exp) \
do { \
if(!exp) { \
printf("Error with expression %s %d\n", #exp, exp); \
goto end; \
} \
} \
while(false)

Result_t ecb_decrypt(
CryptoAttribs_t* attribs,
const Key_t* const key)
CryptoAttribs_t* attribs,
const Key_t* const key)
{
// if output is NULL then allocate same size as input rounded to block size
if(attribs->output == NULL)
{
attribs->output = (uint8_t*) malloc(
ROUNDUP_16_BYTES(attribs->input_len) * sizeof(uint8_t));
ROUNDUP_16_BYTES(attribs->input_len) );
attribs->output_len = attribs->input_len;
}
uint8_t* out = attribs->output;

int ret = 0;
EVP_CIPHER_CTX* ctx = EVP_CIPHER_CTX_new();
EVP_CIPHER_CTX_init(ctx);

OP_CHECK( EVP_DecryptInit_ex(ctx, EVP_aes_128_ecb(), NULL, key->key, NULL) );
EVP_DecryptInit_ex(ctx, NULL, NULL, NULL, NULL);
OP_CHECK( EVP_CIPHER_CTX_iv_length(ctx) == 0);
EVP_CIPHER_CTX_set_padding(ctx, 0);
//OP_CHECK( EVP_CIPHER_CTX_set_key_length(ctx, key->len) );
OP_CHECK( EVP_DecryptUpdate(ctx, &out[ret], &ret, attribs->input, attribs->input_len) );
attribs->output_len = ret;
OP_CHECK( EVP_DecryptFinal_ex(ctx, &out[ret], &ret) );
attribs->output_len += ret;
EVP_CIPHER_CTX_free(ctx);
// EVP_cleanup();

int ret, ret_fin;
ret=ret_fin=0;
EVP_CIPHER_CTX ctx;
EVP_CIPHER_CTX_init(&ctx);

EVP_CipherInit_ex(&ctx, EVP_aes_128_ecb(), NULL, key->key, NULL, 0);
EVP_CIPHER_CTX_set_key_length(&ctx, key->len);

EVP_DecryptUpdate(&ctx, attribs->output, &ret, attribs->input, attribs->input_len);
EVP_DecryptFinal (&ctx, (attribs->output)+ret, (int*)&attribs->output_len);
return Result_OK;

end:
return Result_Error;
}

Result_t ecb_encrypt(
CryptoAttribs_t* attribs,
const Key_t* const key)
CryptoAttribs_t* attribs,
const Key_t* const key)

{
assert(attribs->input_len == key->len);
assert(key->len == 16);
// if output is NULL then allocate same size as input rounded to block size
if(attribs->output == NULL)
{
attribs->output = (uint8_t*) malloc(
ROUNDUP_16_BYTES(attribs->input_len) * sizeof(uint8_t));
ROUNDUP_16_BYTES(attribs->input_len) );
}

int ret, ret_fin;
ret=ret_fin=0;
EVP_CIPHER_CTX ctx;
EVP_CIPHER_CTX_init(&ctx);

EVP_EncryptInit (&ctx, EVP_aes_128_ecb(), key->key, NULL);
EVP_CIPHER_CTX_set_key_length(&ctx, key->len);

EVP_EncryptUpdate(&ctx, attribs->output, &ret, attribs->input, attribs->input_len);
EVP_EncryptFinal (&ctx, (attribs->output)+ret, (int*)&attribs->output_len);
uint8_t* out = attribs->output;
int ret = 0;

EVP_CIPHER_CTX* ctx = EVP_CIPHER_CTX_new();
EVP_CIPHER_CTX_init(ctx);
OP_CHECK( EVP_EncryptInit_ex(ctx, EVP_aes_128_ecb(), NULL, key->key, NULL) );
EVP_EncryptInit_ex(ctx, NULL, NULL, NULL, NULL);

OP_CHECK( EVP_CIPHER_CTX_iv_length(ctx) == 0);
EVP_CIPHER_CTX_set_padding(ctx, 0);
//OP_CHECK( EVP_CIPHER_CTX_set_key_length(ctx, key->len) );
OP_CHECK( EVP_EncryptUpdate(ctx, &out[ret], &ret, attribs->input, attribs->input_len) );
attribs->output_len = ret;
OP_CHECK( EVP_EncryptFinal_ex(ctx, &out[ret], &ret) );
attribs->output_len += ret;
EVP_CIPHER_CTX_free(ctx);
// EVP_cleanup();
return Result_OK;
end:
return Result_Error;
}


Result_t cbc_decrypt(
CryptoAttribs_t* attribs,
const Key_t* const key)
CryptoAttribs_t* attribs,
const Key_t* const key)
{
if((attribs->input_len % key->len) != 0 )
return Result_Error;

if( attribs->iv_len != key->len )
return Result_Error;

if( key->len == 0 )
return Result_Error;

const size_t bc = attribs->input_len / key->len;

// Allocate memory for output, if NULL
if( attribs->output == NULL)
{
// same as input + 16 bytes iv
const size_t len = (ROUNDUP_16_BYTES(attribs->input_len)+16);
attribs->output = (uint8_t*) malloc(len * sizeof(uint8_t));
attribs->output_len = len;
attribs->output = (uint8_t*) malloc(len);
//attribs->output_len = len;
assert( attribs->output != NULL );
assert( len != 0 );
}

uint8_t* iv = attribs->iv;
// Allocate struct that will be used for block decryption
CryptoAttribs_t ecb_attribs;
CryptoAttribs_t::Init(&ecb_attribs);
ecb_attribs.output = (uint8_t*) malloc(key->len);
@@ -86,24 +132,23 @@ Result_t cbc_decrypt(
return Result_Error;

// 2. Xor IV
unsigned char* out = attribs->output+(key->len)*i;
xor_repeatedly(
iv, attribs->iv_len,
ecb_attribs.output, ecb_attribs.output_len,
(attribs->output)+(key->len*i));
out);

printf("%.16s\n", attribs->output);
// 3. Change iv with block
iv = ecb_attribs.input;
attribs->output_len += key->len;
}
free(ecb_attribs.output);

return Result_OK;
}

Result_t cbc_encrypt(
CryptoAttribs_t* attribs,
const Key_t* const key)
CryptoAttribs_t* attribs,
const Key_t* const key)
{
if((attribs->input_len % key->len) != 0 )
return Result_Error;
@@ -111,47 +156,52 @@ Result_t cbc_encrypt(
if( attribs->iv_len != key->len )
return Result_Error;

if( key->len == 0 )
return Result_Error;

const size_t bc = attribs->input_len / key->len;
const size_t bs = key->len;

if( attribs->output == NULL)
{
// same as input + 16 bytes iv
attribs->output = (uint8_t*) malloc(
(ROUNDUP_16_BYTES(attribs->input_len)+16) * sizeof(uint8_t));
(ROUNDUP_16_BYTES(attribs->input_len)+16) );
assert( attribs->output != NULL );
}

uint8_t* iv = attribs->iv;
// Initialize attribs for ECB block encryption
CryptoAttribs_t ecb_attribs;
CryptoAttribs_t::Init(&ecb_attribs);
ecb_attribs.input = (uint8_t*) malloc(key->len);
ecb_attribs.input_len = key->len;
ecb_attribs.output = (uint8_t*) malloc(key->len);
ecb_attribs.output_len = key->len;
ecb_attribs.input = (uint8_t*)malloc(bs);
ecb_attribs.input_len = bs;
ecb_attribs.output = (uint8_t*)malloc(bs);
ecb_attribs.output_len = bs;
for(int i=0; i<bc; ++i)
{
uint8_t* i_buff_ptr = (attribs->input)+(key->len*i);
uint8_t* buffptr = (attribs->input)+(bs*i);

// 1. Xor IV
xor_repeatedly(
iv, attribs->iv_len,
i_buff_ptr, attribs->iv_len,
iv, bs,
buffptr, bs,
ecb_attribs.input);
ecb_attribs.input_len = key->len;
ecb_attribs.input_len = bs;

// 2. Encrypt
if( ecb_encrypt(&ecb_attribs, key) != Result_OK )
return Result_Error;

// Encrypted block is my new IV
iv = ecb_attribs.output;

// 3. Change iv with block
iv = i_buff_ptr;
memcpy((attribs->output)+(key->len*i),
memcpy((attribs->output)+(bs*i),
ecb_attribs.output,
ecb_attribs.output_len);
attribs->output_len += ecb_attribs.output_len;
}
free(ecb_attribs.input);
free(ecb_attribs.output);

CryptoAttribs_t::Free(&ecb_attribs);
return Result_OK;
}
}

+ 16
- 1
src/main.cpp 查看文件

@@ -2,11 +2,26 @@
#include "sol/set2.h"
#include "tst/utils.h"

#include <openssl/conf.h>
#include <openssl/evp.h>
#include <openssl/err.h>
#include <string.h>

int main()
{
UTILS::run();

ERR_load_crypto_strings();
OpenSSL_add_all_algorithms();


// UTILS::run();
SET1::run();
SET2::run();


/* Clean up */
EVP_cleanup();
ERR_free_strings();

return 0;
}

+ 0
- 962
suppressions.valgrind 查看文件

@@ -1,962 +0,0 @@
{
<insert_a_suppression_name_here>
Memcheck:Addr8
fun:_Z21set1_challenge_7_testv
fun:_ZN4SET13runEv
fun:main
}
{
<insert_a_suppression_name_here>
Memcheck:Addr8
fun:printf
fun:_Z21set1_challenge_7_testv
fun:_ZN4SET13runEv
fun:main
}
{
<insert_a_suppression_name_here>
Memcheck:Addr8
fun:_Z21set1_challenge_7_testv
fun:_ZN4SET13runEv
fun:main
}
{
<insert_a_suppression_name_here>
Memcheck:Addr8
fun:_Z21set1_challenge_7_testv
fun:_ZN4SET13runEv
fun:main
}
{
<insert_a_suppression_name_here>
Memcheck:Addr1
fun:_Z21set1_challenge_7_testv
fun:_ZN4SET13runEv
fun:main
}
{
<insert_a_suppression_name_here>
Memcheck:Addr8
fun:_Z21set1_challenge_7_testv
fun:_ZN4SET13runEv
fun:main
}
{
<insert_a_suppression_name_here>
Memcheck:Addr8
fun:_Z21set1_challenge_7_testv
fun:_ZN4SET13runEv
fun:main
}
{
<insert_a_suppression_name_here>
Memcheck:Addr8
fun:_Z21set1_challenge_7_testv
fun:_ZN4SET13runEv
fun:main
}
{
<insert_a_suppression_name_here>
Memcheck:Addr8
fun:_Z21set1_challenge_7_testv
fun:_ZN4SET13runEv
fun:main
}
{
<insert_a_suppression_name_here>
Memcheck:Addr2
fun:_Z21set1_challenge_7_testv
fun:_ZN4SET13runEv
fun:main
}
{
<insert_a_suppression_name_here>
Memcheck:Addr8
fun:_Z21set1_challenge_7_testv
fun:_ZN4SET13runEv
fun:main
}
{
<insert_a_suppression_name_here>
Memcheck:Addr8
fun:_Z19read_file_to_bufferPKcPPhb
fun:_Z21set1_challenge_7_testv
fun:_ZN4SET13runEv
fun:main
}
{
<insert_a_suppression_name_here>
Memcheck:Addr8
fun:_Z19read_file_to_bufferPKcPPhb
fun:_Z21set1_challenge_7_testv
fun:_ZN4SET13runEv
fun:main
}
{
<insert_a_suppression_name_here>
Memcheck:Addr8
fun:_Z19read_file_to_bufferPKcPPhb
fun:_Z21set1_challenge_7_testv
fun:_ZN4SET13runEv
fun:main
}
{
<insert_a_suppression_name_here>
Memcheck:Addr8
fun:_Z21set1_challenge_7_testv
fun:_ZN4SET13runEv
fun:main
}
{
<insert_a_suppression_name_here>
Memcheck:Addr8
fun:_Z21set1_challenge_7_testv
fun:_ZN4SET13runEv
fun:main
}
{
<insert_a_suppression_name_here>
Memcheck:Addr8
fun:_Z21set1_challenge_7_testv
fun:_ZN4SET13runEv
fun:main
}
{
<insert_a_suppression_name_here>
Memcheck:Addr1
fun:_Z13base64_to_hexPKhiPh
fun:_Z21set1_challenge_7_testv
fun:_ZN4SET13runEv
fun:main
}
{
<insert_a_suppression_name_here>
Memcheck:Addr1
fun:_Z13base64_to_hexPKhiPh
fun:_Z21set1_challenge_7_testv
fun:_ZN4SET13runEv
fun:main
}
{
<insert_a_suppression_name_here>
Memcheck:Addr1
fun:_Z13base64_to_hexPKhiPh
fun:_Z21set1_challenge_7_testv
fun:_ZN4SET13runEv
fun:main
}
{
<insert_a_suppression_name_here>
Memcheck:Addr4
fun:_Z21set1_challenge_7_testv
fun:_ZN4SET13runEv
fun:main
}
{
<insert_a_suppression_name_here>
Memcheck:Addr4
fun:_Z21set1_challenge_7_testv
fun:_ZN4SET13runEv
fun:main
}
{
<insert_a_suppression_name_here>
Memcheck:Addr16
obj:/lib/x86_64-linux-gnu/libcrypto.so.1.0.0
obj:/lib/x86_64-linux-gnu/libcrypto.so.1.0.0
obj:/lib/x86_64-linux-gnu/libcrypto.so.1.0.0
obj:/lib/x86_64-linux-gnu/libc-2.21.so
obj:/lib/x86_64-linux-gnu/libcrypto.so.1.0.0
fun:EVP_CipherInit_ex
fun:_Z11ecb_decryptPKhjS0_jPh
fun:_Z21set1_challenge_7_testv
fun:_ZN4SET13runEv
fun:main
}
{
<insert_a_suppression_name_here>
Memcheck:Addr16
obj:/lib/x86_64-linux-gnu/libcrypto.so.1.0.0
obj:/lib/x86_64-linux-gnu/libcrypto.so.1.0.0
}
{
<insert_a_suppression_name_here>
Memcheck:Addr16
obj:/lib/x86_64-linux-gnu/libcrypto.so.1.0.0
obj:/lib/x86_64-linux-gnu/libcrypto.so.1.0.0
}
{
<insert_a_suppression_name_here>
Memcheck:Addr16
obj:/lib/x86_64-linux-gnu/libcrypto.so.1.0.0
obj:/lib/x86_64-linux-gnu/libcrypto.so.1.0.0
}
{
<insert_a_suppression_name_here>
Memcheck:Addr16
obj:/lib/x86_64-linux-gnu/libcrypto.so.1.0.0
obj:/lib/x86_64-linux-gnu/libcrypto.so.1.0.0
}
{
<insert_a_suppression_name_here>
Memcheck:Addr16
obj:/lib/x86_64-linux-gnu/libcrypto.so.1.0.0
obj:/lib/x86_64-linux-gnu/libcrypto.so.1.0.0
}
{
<insert_a_suppression_name_here>
Memcheck:Addr16
obj:/lib/x86_64-linux-gnu/libcrypto.so.1.0.0
obj:/lib/x86_64-linux-gnu/libcrypto.so.1.0.0
}
{
<insert_a_suppression_name_here>
Memcheck:Addr16
obj:/lib/x86_64-linux-gnu/libcrypto.so.1.0.0
obj:/lib/x86_64-linux-gnu/libcrypto.so.1.0.0
}
{
<insert_a_suppression_name_here>
Memcheck:Addr16
obj:/lib/x86_64-linux-gnu/libcrypto.so.1.0.0
obj:/lib/x86_64-linux-gnu/libcrypto.so.1.0.0
}
{
<insert_a_suppression_name_here>
Memcheck:Addr8
obj:/lib/x86_64-linux-gnu/libcrypto.so.1.0.0
obj:/lib/x86_64-linux-gnu/libcrypto.so.1.0.0
}
{
<insert_a_suppression_name_here>
Memcheck:Addr16
obj:/lib/x86_64-linux-gnu/libcrypto.so.1.0.0
obj:/lib/x86_64-linux-gnu/libcrypto.so.1.0.0
}
{
<insert_a_suppression_name_here>
Memcheck:Addr8
obj:/lib/x86_64-linux-gnu/libcrypto.so.1.0.0
obj:/lib/x86_64-linux-gnu/libcrypto.so.1.0.0
}
{
<insert_a_suppression_name_here>
Memcheck:Addr16
obj:/lib/x86_64-linux-gnu/libcrypto.so.1.0.0
obj:/lib/x86_64-linux-gnu/libcrypto.so.1.0.0
}
{
<insert_a_suppression_name_here>
Memcheck:Addr8
obj:/lib/x86_64-linux-gnu/libcrypto.so.1.0.0
obj:/lib/x86_64-linux-gnu/libcrypto.so.1.0.0
}
{
<insert_a_suppression_name_here>
Memcheck:Addr16
obj:/lib/x86_64-linux-gnu/libcrypto.so.1.0.0
obj:/lib/x86_64-linux-gnu/libcrypto.so.1.0.0
}
{
<insert_a_suppression_name_here>
Memcheck:Addr8
obj:/lib/x86_64-linux-gnu/libcrypto.so.1.0.0
obj:/lib/x86_64-linux-gnu/libcrypto.so.1.0.0
}
{
<insert_a_suppression_name_here>
Memcheck:Addr16
obj:/lib/x86_64-linux-gnu/libcrypto.so.1.0.0
obj:/lib/x86_64-linux-gnu/libcrypto.so.1.0.0
}
{
<insert_a_suppression_name_here>
Memcheck:Addr8
obj:/lib/x86_64-linux-gnu/libcrypto.so.1.0.0
obj:/lib/x86_64-linux-gnu/libcrypto.so.1.0.0
}
{
<insert_a_suppression_name_here>
Memcheck:Addr16
obj:/lib/x86_64-linux-gnu/libcrypto.so.1.0.0
obj:/lib/x86_64-linux-gnu/libcrypto.so.1.0.0
}
{
<insert_a_suppression_name_here>
Memcheck:Addr8
obj:/lib/x86_64-linux-gnu/libcrypto.so.1.0.0
obj:/lib/x86_64-linux-gnu/libcrypto.so.1.0.0
}
{
<insert_a_suppression_name_here>
Memcheck:Addr16
obj:/lib/x86_64-linux-gnu/libcrypto.so.1.0.0
obj:/lib/x86_64-linux-gnu/libcrypto.so.1.0.0
}
{
<insert_a_suppression_name_here>
Memcheck:Addr8
obj:/lib/x86_64-linux-gnu/libcrypto.so.1.0.0
obj:/lib/x86_64-linux-gnu/libcrypto.so.1.0.0
}
{
<insert_a_suppression_name_here>
Memcheck:Addr16
obj:/lib/x86_64-linux-gnu/libcrypto.so.1.0.0
obj:/lib/x86_64-linux-gnu/libcrypto.so.1.0.0
}
{
<insert_a_suppression_name_here>
Memcheck:Addr8
obj:/lib/x86_64-linux-gnu/libcrypto.so.1.0.0
obj:/lib/x86_64-linux-gnu/libcrypto.so.1.0.0
}
{
<insert_a_suppression_name_here>
Memcheck:Addr16
obj:/lib/x86_64-linux-gnu/libcrypto.so.1.0.0
obj:/lib/x86_64-linux-gnu/libcrypto.so.1.0.0
}
{
<insert_a_suppression_name_here>
Memcheck:Addr8
obj:/lib/x86_64-linux-gnu/libcrypto.so.1.0.0
obj:/lib/x86_64-linux-gnu/libcrypto.so.1.0.0
}
{
<insert_a_suppression_name_here>
Memcheck:Addr8
obj:/lib/x86_64-linux-gnu/libcrypto.so.1.0.0
obj:/lib/x86_64-linux-gnu/libcrypto.so.1.0.0
}
{
<insert_a_suppression_name_here>
Memcheck:Addr8
obj:/lib/x86_64-linux-gnu/libcrypto.so.1.0.0
obj:/lib/x86_64-linux-gnu/libcrypto.so.1.0.0
}
{
<insert_a_suppression_name_here>
Memcheck:Addr8
obj:/lib/x86_64-linux-gnu/libcrypto.so.1.0.0
obj:/lib/x86_64-linux-gnu/libcrypto.so.1.0.0
}
{
<insert_a_suppression_name_here>
Memcheck:Addr8
obj:/lib/x86_64-linux-gnu/libcrypto.so.1.0.0
obj:/lib/x86_64-linux-gnu/libcrypto.so.1.0.0
}
{
<insert_a_suppression_name_here>
Memcheck:Addr8
obj:/lib/x86_64-linux-gnu/libcrypto.so.1.0.0
obj:/lib/x86_64-linux-gnu/libcrypto.so.1.0.0
}
{
<insert_a_suppression_name_here>
Memcheck:Addr8
obj:/lib/x86_64-linux-gnu/libcrypto.so.1.0.0
obj:/lib/x86_64-linux-gnu/libcrypto.so.1.0.0
}
{
<insert_a_suppression_name_here>
Memcheck:Addr8
obj:/lib/x86_64-linux-gnu/libcrypto.so.1.0.0
obj:/lib/x86_64-linux-gnu/libcrypto.so.1.0.0
}
{
<insert_a_suppression_name_here>
Memcheck:Addr16
obj:/lib/x86_64-linux-gnu/libcrypto.so.1.0.0
obj:/lib/x86_64-linux-gnu/libcrypto.so.1.0.0
}
{
<insert_a_suppression_name_here>
Memcheck:Addr16
obj:/lib/x86_64-linux-gnu/libcrypto.so.1.0.0
obj:/lib/x86_64-linux-gnu/libcrypto.so.1.0.0
}
{
<insert_a_suppression_name_here>
Memcheck:Addr16
obj:/lib/x86_64-linux-gnu/libcrypto.so.1.0.0
obj:/lib/x86_64-linux-gnu/libcrypto.so.1.0.0
}
{
<insert_a_suppression_name_here>
Memcheck:Addr16
obj:/lib/x86_64-linux-gnu/libcrypto.so.1.0.0
obj:/lib/x86_64-linux-gnu/libcrypto.so.1.0.0
}
{
<insert_a_suppression_name_here>
Memcheck:Addr8
obj:/lib/x86_64-linux-gnu/libcrypto.so.1.0.0
obj:/lib/x86_64-linux-gnu/libcrypto.so.1.0.0
}
{
<insert_a_suppression_name_here>
Memcheck:Addr8
obj:/lib/x86_64-linux-gnu/libcrypto.so.1.0.0
obj:/lib/x86_64-linux-gnu/libcrypto.so.1.0.0
}
{
<insert_a_suppression_name_here>
Memcheck:Addr8
obj:/lib/x86_64-linux-gnu/libcrypto.so.1.0.0
obj:/lib/x86_64-linux-gnu/libcrypto.so.1.0.0
}
{
<insert_a_suppression_name_here>
Memcheck:Addr8
obj:/lib/x86_64-linux-gnu/libcrypto.so.1.0.0
obj:/lib/x86_64-linux-gnu/libcrypto.so.1.0.0
}
{
<insert_a_suppression_name_here>
Memcheck:Addr8
fun:memcpy@@GLIBC_2.14
fun:EVP_DecryptUpdate
fun:_Z11ecb_decryptPKhjS0_jPh
fun:_Z21set1_challenge_7_testv
fun:_ZN4SET13runEv
fun:main
}
{
<insert_a_suppression_name_here>
Memcheck:Addr1
fun:EVP_DecryptFinal_ex
fun:_Z11ecb_decryptPKhjS0_jPh
fun:_Z21set1_challenge_7_testv
fun:_ZN4SET13runEv
fun:main
}
{
<insert_a_suppression_name_here>
Memcheck:Addr4
fun:_Z21set1_challenge_7_testv
fun:_ZN4SET13runEv
fun:main
}
{
<insert_a_suppression_name_here>
Memcheck:Addr1
fun:strlen
fun:_Z21set1_challenge_7_testv
fun:_ZN4SET13runEv
fun:main
}
{
<insert_a_suppression_name_here>
Memcheck:Addr1
fun:strlen
fun:_Z21set1_challenge_7_testv
fun:_ZN4SET13runEv
fun:main
}
{
<insert_a_suppression_name_here>
Memcheck:Addr1
fun:__memcmp_sse4_1
fun:_Z21set1_challenge_7_testv
fun:_ZN4SET13runEv
fun:main
}
{
<insert_a_suppression_name_here>
Memcheck:Addr1
fun:__memcmp_sse4_1
fun:_Z21set1_challenge_7_testv
fun:_ZN4SET13runEv
fun:main
}
{
<insert_a_suppression_name_here>
Memcheck:Addr1
fun:__memcmp_sse4_1
fun:_Z21set1_challenge_7_testv
fun:_ZN4SET13runEv
fun:main
}
{
<insert_a_suppression_name_here>
Memcheck:Addr1
fun:__memcmp_sse4_1
fun:_Z21set1_challenge_7_testv
fun:_ZN4SET13runEv
fun:main
}
{
<insert_a_suppression_name_here>
Memcheck:Addr8
fun:_Z21set1_challenge_7_testv
fun:_ZN4SET13runEv
fun:main
}
{
<insert_a_suppression_name_here>
Memcheck:Addr8
fun:_Z21set1_challenge_6_testv
fun:_ZN4SET13runEv
fun:main
}
{
<insert_a_suppression_name_here>
Memcheck:Addr8
fun:printf
fun:_Z21set1_challenge_6_testv
fun:_ZN4SET13runEv
fun:main
}
{
<insert_a_suppression_name_here>
Memcheck:Addr4
fun:_Z21set1_challenge_6_testv
fun:_ZN4SET13runEv
fun:main
}
{
<insert_a_suppression_name_here>
Memcheck:Addr8
fun:_Z21set1_challenge_6_testv
fun:_ZN4SET13runEv
fun:main
}
{
<insert_a_suppression_name_here>
Memcheck:Addr8
fun:_Z19read_file_to_bufferPKcPPhb
fun:_Z21set1_challenge_6_testv
fun:_ZN4SET13runEv
fun:main
}
{
<insert_a_suppression_name_here>
Memcheck:Addr8
fun:_Z19read_file_to_bufferPKcPPhb
fun:_Z21set1_challenge_6_testv
fun:_ZN4SET13runEv
fun:main
}
{
<insert_a_suppression_name_here>
Memcheck:Addr8
fun:memcpy@@GLIBC_2.14
fun:_Z19read_file_to_bufferPKcPPhb
fun:_Z21set1_challenge_6_testv
fun:_ZN4SET13runEv
fun:main
}
{
<insert_a_suppression_name_here>
Memcheck:Addr2
fun:memcpy@@GLIBC_2.14
fun:_Z19read_file_to_bufferPKcPPhb
fun:_Z21set1_challenge_6_testv
fun:_ZN4SET13runEv
fun:main
}
{
<insert_a_suppression_name_here>
Memcheck:Addr8
fun:_Z21set1_challenge_6_testv
fun:_ZN4SET13runEv
fun:main
}
{
<insert_a_suppression_name_here>
Memcheck:Addr8
fun:_Z21set1_challenge_6_testv
fun:_ZN4SET13runEv
fun:main
}
{
<insert_a_suppression_name_here>
Memcheck:Addr1
fun:_Z21set1_challenge_6_testv
fun:_ZN4SET13runEv
fun:main
}
{
<insert_a_suppression_name_here>
Memcheck:Addr8
fun:_Z21set1_challenge_6_testv
fun:_ZN4SET13runEv
fun:main
}
{
<insert_a_suppression_name_here>
Memcheck:Addr1
fun:_Z13base64_to_hexPKhiPh
fun:_Z21set1_challenge_6_testv
fun:_ZN4SET13runEv
fun:main
}
{
<insert_a_suppression_name_here>
Memcheck:Addr1
fun:_Z13base64_to_hexPKhiPh
fun:_Z21set1_challenge_6_testv
fun:_ZN4SET13runEv
fun:main
}
{
<insert_a_suppression_name_here>
Memcheck:Addr1
fun:_Z13base64_to_hexPKhiPh
fun:_Z21set1_challenge_6_testv
fun:_ZN4SET13runEv
fun:main
}
{
<insert_a_suppression_name_here>
Memcheck:Addr1
fun:_Z13base64_to_hexPKhiPh
fun:_Z21set1_challenge_6_testv
fun:_ZN4SET13runEv
fun:main
}
{
<insert_a_suppression_name_here>
Memcheck:Addr1
fun:_Z13base64_to_hexPKhiPh
fun:_Z21set1_challenge_6_testv
fun:_ZN4SET13runEv
fun:main
}
{
<insert_a_suppression_name_here>
Memcheck:Addr1
fun:_Z13base64_to_hexPKhiPh
fun:_Z21set1_challenge_6_testv
fun:_ZN4SET13runEv
fun:main
}
{
<insert_a_suppression_name_here>
Memcheck:Addr1
fun:_Z13base64_to_hexPKhiPh
fun:_Z21set1_challenge_6_testv
fun:_ZN4SET13runEv
fun:main
}
{
<insert_a_suppression_name_here>
Memcheck:Addr8
fun:_Z21set1_challenge_6_testv
fun:_ZN4SET13runEv
fun:main
}
{
<insert_a_suppression_name_here>
Memcheck:Addr8
fun:_Z21set1_challenge_6_testv
fun:_ZN4SET13runEv
fun:main
}
{
<insert_a_suppression_name_here>
Memcheck:Addr1
fun:_Z21convert_hex_to_stringPKhjPc
fun:_Z21set1_challenge_6_testv
fun:_ZN4SET13runEv
fun:main
}
{
<insert_a_suppression_name_here>
Memcheck:Addr1
fun:_IO_default_xsputn
fun:vfprintf
fun:vsprintf
fun:sprintf
fun:_Z21convert_hex_to_stringPKhjPc
fun:_Z21set1_challenge_6_testv
fun:_ZN4SET13runEv
fun:main
}
{
<insert_a_suppression_name_here>
Memcheck:Addr1
fun:vsprintf
fun:sprintf
fun:_Z21convert_hex_to_stringPKhjPc
fun:_Z21set1_challenge_6_testv
fun:_ZN4SET13runEv
fun:main
}
{
<insert_a_suppression_name_here>
Memcheck:Addr1
fun:_IO_default_xsputn
fun:_IO_padn
fun:vfprintf
fun:vsprintf
fun:sprintf
fun:_Z21convert_hex_to_stringPKhjPc
fun:_Z21set1_challenge_6_testv
fun:_ZN4SET13runEv
fun:main
}
{
<insert_a_suppression_name_here>
Memcheck:Addr8
fun:memset
fun:_Z21set1_challenge_6_testv
fun:_ZN4SET13runEv
fun:main
}
{
<insert_a_suppression_name_here>
Memcheck:Addr1
fun:strlen
fun:_Z21set1_challenge_6_testv
fun:_ZN4SET13runEv
fun:main
}
{
<insert_a_suppression_name_here>
Memcheck:Addr1
fun:strlen
fun:_Z21set1_challenge_6_testv
fun:_ZN4SET13runEv
fun:main
}
{
<insert_a_suppression_name_here>
Memcheck:Addr1
fun:strlen
fun:_Z17crack_repeted_xorPKcPhjj
fun:_Z17find_best_keysizePKcjii
fun:_Z21set1_challenge_6_testv
fun:_ZN4SET13runEv
fun:main
}
{
<insert_a_suppression_name_here>
Memcheck:Addr1
fun:strlen
fun:_Z17crack_repeted_xorPKcPhjj
fun:_Z17find_best_keysizePKcjii
fun:_Z21set1_challenge_6_testv
fun:_ZN4SET13runEv
fun:main
}
{
<insert_a_suppression_name_here>
Memcheck:Addr1
fun:strlen
fun:_Z17crack_repeted_xorPKcPhjj
fun:_Z17find_best_keysizePKcjii
fun:_Z21set1_challenge_6_testv
fun:_ZN4SET13runEv
fun:main
}
{
<insert_a_suppression_name_here>
Memcheck:Addr1
fun:strlen
fun:_Z17crack_repeted_xorPKcPhjj
fun:_Z17find_best_keysizePKcjii
fun:_Z21set1_challenge_6_testv
fun:_ZN4SET13runEv
fun:main
}
{
<insert_a_suppression_name_here>
Memcheck:Addr1
fun:_Z21convert_string_to_hexPKcjPh
fun:_Z17crack_repeted_xorPKcPhjj
fun:_Z17find_best_keysizePKcjii
fun:_Z21set1_challenge_6_testv
fun:_ZN4SET13runEv
fun:main
}
{
<insert_a_suppression_name_here>
Memcheck:Addr1
fun:_Z21convert_string_to_hexPKcjPh
fun:_Z17crack_repeted_xorPKcPhjj
fun:_Z17find_best_keysizePKcjii
fun:_Z21set1_challenge_6_testv
fun:_ZN4SET13runEv
fun:main
}
{
<insert_a_suppression_name_here>
Memcheck:Addr4
fun:_Z21set1_challenge_6_testv
fun:_ZN4SET13runEv
fun:main
}
{
<insert_a_suppression_name_here>
Memcheck:Addr4
fun:_Z21set1_challenge_6_testv
fun:_ZN4SET13runEv
fun:main
}
{
<insert_a_suppression_name_here>
Memcheck:Addr4
fun:_Z21set1_challenge_6_testv
fun:_ZN4SET13runEv
fun:main
}
{
<insert_a_suppression_name_here>
Memcheck:Addr1
fun:_Z14xor_repeatedlyPKhjS0_jPh
fun:_Z17crack_repeted_xorPKcPhjj
fun:_Z21set1_challenge_6_testv
fun:_ZN4SET13runEv
fun:main
}
{
<insert_a_suppression_name_here>
Memcheck:Addr4
fun:_Z21set1_challenge_6_testv
fun:_ZN4SET13runEv
fun:main
}
{
<insert_a_suppression_name_here>
Memcheck:Addr8
obj:/lib/x86_64-linux-gnu/libcrypto.so.1.0.0
obj:/lib/x86_64-linux-gnu/libcrypto.so.1.0.0
fun:EVP_EncryptFinal_ex
fun:_Z11ecb_encryptPKhjS0_jPh
fun:_Z11encrypt_cbcPhmS_mS_mPS_Pm
fun:_Z16cbc_enc_dec_testv
fun:_ZN4SET23runEv
fun:main
}
{
<insert_a_suppression_name_here>
Memcheck:Addr1
fun:strlen
fun:_Z17crack_repeted_xorPKcPhjj
fun:_Z21set1_challenge_6_testv
fun:_ZN4SET13runEv
fun:main
}
{
<insert_a_suppression_name_here>
Memcheck:Addr1
fun:strlen
fun:_Z17crack_repeted_xorPKcPhjj
fun:_Z21set1_challenge_6_testv
fun:_ZN4SET13runEv
fun:main
}
{
<insert_a_suppression_name_here>
Memcheck:Addr1
fun:_Z21convert_string_to_hexPKcjPh
fun:_Z17crack_repeted_xorPKcPhjj
fun:_Z21set1_challenge_6_testv
fun:_ZN4SET13runEv
fun:main
}
{
<insert_a_suppression_name_here>
Memcheck:Addr1
fun:_Z21convert_string_to_hexPKcjPh
fun:_Z17crack_repeted_xorPKcPhjj
fun:_Z21set1_challenge_6_testv
fun:_ZN4SET13runEv
fun:main
}
{
<insert_a_suppression_name_here>
Memcheck:Leak
match-leak-kinds: definite
fun:malloc
fun:CRYPTO_malloc
fun:EVP_CipherInit_ex
fun:_Z11ecb_decryptPKhjS0_jPh
fun:_Z21set1_challenge_7_testv
fun:_ZN4SET13runEv
fun:main
}
{
<insert_a_suppression_name_here>
Memcheck:Leak
match-leak-kinds: definite
fun:malloc
fun:CRYPTO_malloc
fun:EVP_CipherInit_ex
fun:_Z11ecb_decryptPKhjS0_jPh
fun:_Z11decrypt_cbcPhmS_mS_mPS_Pm
fun:_Z16cbc_enc_dec_testv
fun:_ZN4SET23runEv
fun:main
}
{
<insert_a_suppression_name_here>
Memcheck:Leak
match-leak-kinds: definite
fun:malloc
fun:CRYPTO_malloc
fun:EVP_CipherInit_ex
fun:_Z11ecb_encryptPKhjS0_jPh
fun:_Z11encrypt_cbcPhmS_mS_mPS_Pm
fun:_Z16cbc_enc_dec_testv
fun:_ZN4SET23runEv
fun:main
}
{
<insert_a_suppression_name_here>
Memcheck:Leak
match-leak-kinds: definite
fun:malloc
fun:_Z11encrypt_cbcPhmS_mS_mPS_Pm
fun:_Z16cbc_enc_dec_testv
fun:_ZN4SET23runEv
fun:main
}
{
<insert_a_suppression_name_here>
Memcheck:Leak
match-leak-kinds: definite
fun:malloc
fun:getdelim
fun:_Z19read_file_to_bufferPKcPPhb
fun:_Z21set1_challenge_7_testv
fun:_ZN4SET13runEv
fun:main
}
{
<insert_a_suppression_name_here>
Memcheck:Leak
match-leak-kinds: definite
fun:malloc
fun:_Z11decrypt_cbcPhmS_mS_mPS_Pm
fun:_Z16cbc_decrypt_testv
fun:_ZN4SET23runEv
fun:main
}
{
<insert_a_suppression_name_here>
Memcheck:Leak
match-leak-kinds: definite
fun:malloc
fun:getdelim
fun:_Z19read_file_to_bufferPKcPPhb
fun:_Z21set1_challenge_6_testv
fun:_ZN4SET13runEv
fun:main
}
{
<insert_a_suppression_name_here>
Memcheck:Leak
match-leak-kinds: possible
fun:malloc
fun:CRYPTO_malloc
fun:EVP_CipherInit_ex
fun:_Z11ecb_decryptPKhjS0_jPh
fun:_Z11decrypt_cbcPhmS_mS_mPS_Pm
fun:_Z16cbc_enc_dec_testv
fun:_ZN4SET23runEv
fun:main
}

正在加载...
取消
保存