Add function to extract algorithm number from context.

This commit is contained in:
Giovanni Bajo
2012-04-25 18:03:24 +02:00
committed by Simon Kelley
parent 3471f18130
commit 6759b99e28
2 changed files with 9 additions and 0 deletions

View File

@@ -45,5 +45,6 @@ struct VerifyAlgCtx
int verifyalg_supported(int algo); int verifyalg_supported(int algo);
VerifyAlgCtx* verifyalg_alloc(int algo); VerifyAlgCtx* verifyalg_alloc(int algo);
void verifyalg_free(VerifyAlgCtx *a); void verifyalg_free(VerifyAlgCtx *a);
int verifyalg_algonum(VerifyAlgCtx *a);
#endif /* DNSSEC_CRYPTO_H */ #endif /* DNSSEC_CRYPTO_H */

View File

@@ -201,3 +201,11 @@ void verifyalg_free(VerifyAlgCtx *a)
pool_used &= ~(1 << pool_idx); pool_used &= ~(1 << pool_idx);
} }
int verifyalg_algonum(VerifyAlgCtx *a)
{
int num = a->vtbl - valgs;
if (num < 0 || num >= countof(valgs))
return -1;
return num;
}