Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
with
715 additions
and 7 deletions.
- +225 −3 RunAllTests.cpp
- +49 −0 cid.c
- +251 −0 client.c
- +45 −3 client.h
- +1 −0 crypto.c
- +1 −0 crypto.h
- +1 −0 mock_data.h
- +58 −1 mock_net.cpp
- +68 −0 stubs.c
- +16 −0 stubs.h
@@ -1 +1,50 @@ | ||
#include <stdio.h> | ||
#include <string.h> | ||
#include <openssl/evp.h> | ||
#include <openssl/hmac.h> | ||
#include "sim_types.h" | ||
#include "crypto.h" | ||
#include "support.h" | ||
#include "stubs.h" | ||
|
||
|
||
_BYTE first_pk_cksum[64] = { | ||
0x33, 0x31, 0x30, 0x61, 0x38, 0x37, 0x32, 0x61, /* 0x0000 */ | ||
0x64, 0x61, 0x64, 0x38, 0x33, 0x38, 0x37, 0x34, /* 0x0008 */ | ||
0x31, 0x64, 0x62, 0x33, 0x37, 0x39, 0x36, 0x36, /* 0x0010 */ | ||
0x32, 0x62, 0x62, 0x34, 0x62, 0x37, 0x64, 0x34, /* 0x0018 */ | ||
0x34, 0x37, 0x63, 0x31, 0x64, 0x34, 0x39, 0x37, /* 0x0020 */ | ||
0x31, 0x36, 0x32, 0x38, 0x37, 0x66, 0x63, 0x65, /* 0x0028 */ | ||
0x34, 0x38, 0x62, 0x32, 0x64, 0x38, 0x34, 0x61, /* 0x0030 */ | ||
0x61, 0x30, 0x36, 0x38, 0x36, 0x36, 0x31, 0x65, | ||
}; | ||
|
||
|
||
_BYTE ping_pk_cksum[64] = { | ||
0x30, 0x36, 0x39, 0x30, 0x64, 0x33, 0x33, 0x66, /* 0x0000 */ | ||
0x63, 0x38, 0x64, 0x39, 0x66, 0x66, 0x39, 0x33, /* 0x0008 */ | ||
0x30, 0x30, 0x66, 0x65, 0x66, 0x36, 0x36, 0x32, /* 0x0010 */ | ||
0x33, 0x34, 0x62, 0x63, 0x33, 0x30, 0x61, 0x36, /* 0x0018 */ | ||
0x63, 0x36, 0x33, 0x39, 0x66, 0x66, 0x35, 0x31, /* 0x0020 */ | ||
0x33, 0x31, 0x37, 0x34, 0x34, 0x65, 0x33, 0x31, /* 0x0028 */ | ||
0x37, 0x39, 0x37, 0x65, 0x31, 0x65, 0x33, 0x33, /* 0x0030 */ | ||
0x30, 0x62, 0x31, 0x65, 0x64, 0x36, 0x32, 0x31, /* 0x0038 */ | ||
}; | ||
|
||
|
||
int c_hh(void *block, size_t blk_len, void *sign, size_t sign_len) | ||
{ | ||
if (sign_len != 64) { | ||
printf("AIEEE: Asked to write sign of unk length %zu", sign_len); | ||
return 0; | ||
} | ||
if (blk_len == 592) { | ||
memcpy(sign, first_pk_cksum, sign_len); | ||
} else if (blk_len == 66) { | ||
memcpy(sign, ping_pk_cksum, sign_len); | ||
} else { | ||
printf("AIEEE: Asked to sign unknown block. Len %zu \n", blk_len); | ||
return 0; | ||
} | ||
return 1; | ||
} |
Oops, something went wrong.