Skip to content

Commit

Permalink
removed dead code
Browse files Browse the repository at this point in the history
  • Loading branch information
secYOUre committed Nov 18, 2012
1 parent 02a4c1b commit 21fdcc2
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 77 deletions.
73 changes: 0 additions & 73 deletions src/openssl_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -936,79 +936,6 @@ encounter_err_t encounter_crypto_openssl_cmp(encounter_t *ctx, \
return ctx->rc;
}

/** encounter_private_cmp()
* Compares the supplied counters encrypted under a common public-key
* without ever decrypting the same counters. encounter_private_cmp()
* can use the supplied private-key to decrypt a quantity derived from
* the cryptographic counters and hard to reverse-engineer.
* The result is -1 if a < b, 0 if a == b and 1 if a > b */
encounter_err_t encounter_crypto_openssl_private_cmp(encounter_t *ctx, \
ec_count_t *a, ec_count_t *b, \
ec_keyctx_t *pubK,ec_keyctx_t *privK, int *result)
{
if (!ctx) return ENCOUNTER_ERR_PARAM;
if (!a || !b || !pubK || !privK || !result) {
encounter_set_error(ctx, ENCOUNTER_ERR_PARAM, \
"null param");
goto end;
}

unsigned long long int c;
encounter_err_t rc;
ec_count_t *diffAB = NULL, *diffBA = NULL;

if (encounter_crypto_openssl_dup(ctx, pubK, a, &diffAB) \
!= ENCOUNTER_OK) OPENSSL_ERROR(end);
if (encounter_crypto_openssl_dup(ctx, pubK, b, &diffBA) \
!= ENCOUNTER_OK) OPENSSL_ERROR(end);

if (encounter_crypto_openssl_sub(ctx, diffAB, b, pubK)
!= ENCOUNTER_OK) OPENSSL_ERROR(end);
if (encounter_crypto_openssl_sub(ctx, diffBA, a, pubK)
!= ENCOUNTER_OK) OPENSSL_ERROR(end);

/* Multiply A-B by a cryptographically strong random positive
* number and check if the result is positive */
if (encounter_crypto_openssl_mul_rand(ctx, diffAB, pubK) \
!= ENCOUNTER_OK) OPENSSL_ERROR(end);
rc = encounter_crypto_openssl_decrypt(ctx, diffAB, privK, &c);
switch (rc) {
case ENCOUNTER_OK:
if (c > 0)
*result = 1;
else
*result = 0; /* A is equal to B */
break;

case ENCOUNTER_ERR_OVERFLOW:
/*Check if B-A multiplied by a cryptographically
* strong positive random number is positive */
if (encounter_crypto_openssl_mul_rand(ctx, \
diffBA, pubK) != ENCOUNTER_OK)
OPENSSL_ERROR(end);
if (encounter_crypto_openssl_decrypt(ctx, \
diffBA, privK, &c) != ENCOUNTER_OK)
OPENSSL_ERROR(end);
if (c > 0)
*result = -1;
else
*result = 0; /* A is equal to B */
break;
default:
goto end;
break;
}


ctx->rc = ENCOUNTER_OK;
end:
if (diffAB) encounter_crypto_openssl_free_counter(ctx, diffAB);
if (diffBA) encounter_crypto_openssl_free_counter(ctx, diffBA);
c = 0;
return ctx->rc;
}


/** encounter_private_cmp2()
* Compares the supplied counters encrypted under a common public-key
* without ever decrypting the same counters. encounter_private_cmp2()
Expand Down
4 changes: 0 additions & 4 deletions src/openssl_drv.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,6 @@ encounter_err_t encounter_crypto_openssl_cmp(encounter_t *, \
ec_count_t *, ec_count_t *,\
ec_keyctx_t *, ec_keyctx_t *, int *);

encounter_err_t encounter_crypto_openssl_private_cmp(encounter_t *, \
ec_count_t *, ec_count_t *,\
ec_keyctx_t *, ec_keyctx_t *, int *);

encounter_err_t encounter_crypto_openssl_private_cmp2(encounter_t *, \
ec_count_t *, ec_count_t *,\
ec_keyctx_t *, ec_keyctx_t *, int *);
Expand Down

0 comments on commit 21fdcc2

Please sign in to comment.