Skip to content

Commit

Permalink
test:
Browse files Browse the repository at this point in the history
  • Loading branch information
JeremyTubongbanua committed Aug 13, 2023
1 parent 418bf7b commit a36683a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,8 @@ jobs:
ctest -V --output-on-failure
- name: CTest (Windows)
timeout-minutes: 4
timeout-minutes: 1
if: ${{ matrix.os == 'windows-latest' }}
working-directory: packages/${{ matrix.package}}/build/tests
run: |
ctest -V --output-on-failure -C Debug --timeout 60
ctest -V --output-on-failure -C Debug --timeout 10
16 changes: 9 additions & 7 deletions packages/atchops/src/aes_ctr.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ int atchops_aes_ctr_encrypt(
unsigned long keyolen;

ret = atchops_base64_decode(key, keylen, &keyolen, keybase64, keybase64len);
// printf("atchops_base64_decode: %d\n", ret);
printf("atchops_base64_decode: %d\n", ret);
// printf("aes_key:\n");
// for(int i = 0; i < keyolen; i++)
// {
Expand Down Expand Up @@ -65,7 +65,7 @@ int atchops_aes_ctr_encrypt(
mbedtls_aes_init(&aes);

ret = mbedtls_aes_setkey_enc(&aes, key, keybits);
// printf("mbedtls_aes_setkey_enc: %d\n", ret);
printf("mbedtls_aes_setkey_enc: %d\n", ret);

unsigned long ciphertextlen = BUFFER_SIZE;
unsigned char *ciphertext = malloc(sizeof(unsigned char) * ciphertextlen);
Expand All @@ -76,7 +76,7 @@ int atchops_aes_ctr_encrypt(
memset(stream_block, 0, 16);

ret = mbedtls_aes_crypt_ctr(&aes, plaintextpaddedlen, &nc_off, iv, stream_block, plaintextpadded, ciphertext);
// printf("mbedtls_aes_crypt_ctr: %d\n", ret);
printf("mbedtls_aes_crypt_ctr: %d\n", ret);

free(stream_block);
free(key);
Expand All @@ -94,7 +94,7 @@ int atchops_aes_ctr_encrypt(
// 4. base64 encode ciphertext

ret = atchops_base64_encode(ciphertextbase64, ciphertextbase64len, ciphertextbase64olen, ciphertext, ciphertextolen);
// printf("atchops_base64_encode: %d\n", ret);
printf("atchops_base64_encode: %d\n", ret);

free(ciphertext);
mbedtls_aes_free(&aes);
Expand Down Expand Up @@ -145,7 +145,7 @@ int atchops_aes_ctr_decrypt(
// }
// printf("\n\n");
ret = atchops_base64_decode(ciphertext, ciphertextlen, &ciphertextolen, ciphertextbase64, ciphertextbase64len);
// printf("atchops_base64_decode: %d\n", ret);
printf("atchops_base64_decode: %d\n", ret);
// printf("ciphertext decoded: %lu\n", ciphertextolen);
// for(int i = 0; i < ciphertextolen; i++)
// {
Expand All @@ -158,7 +158,7 @@ int atchops_aes_ctr_decrypt(
mbedtls_aes_init(&aes);

ret = mbedtls_aes_setkey_enc(&aes, key, keybits);
// printf("mbedtls_aes_setkey_enc: %d\n", ret);
printf("mbedtls_aes_setkey_enc: %d\n", ret);

unsigned long nc_off = 0;
unsigned char *stream_block = malloc(sizeof(unsigned char) * 16);
Expand All @@ -170,7 +170,7 @@ int atchops_aes_ctr_decrypt(
unsigned long plaintextpaddedolen = 0;

ret = mbedtls_aes_crypt_ctr(&aes, ciphertextolen, &nc_off, iv, stream_block, ciphertext, plaintextpadded);
// printf("mbedtls_aes_crypt_ctr: %d\n", ret);
printf("mbedtls_aes_crypt_ctr: %d\n", ret);

// printf("plaintextpadded: %.*s\n", plaintextpaddedlen, plaintextpadded);
// for(int i = 0; i < plaintextpaddedlen; i++)
Expand Down Expand Up @@ -207,6 +207,8 @@ int atchops_aes_ctr_decrypt(
*plaintextolen = plaintextpaddedolen - pad_val;
memcpy(plaintext, plaintextpadded, *plaintextolen);

printf("removed padding in decrypt...\n");

// free everything
free(ciphertext);
mbedtls_aes_free(&aes);
Expand Down

0 comments on commit a36683a

Please sign in to comment.