HMAC function rename for consistency

Make sure that HMAC function names conform to previously established get_*,
set_* naming convention.
This commit is contained in:
Michael Rash
2013-03-29 20:42:44 -04:00
parent d6b4a2a1c3
commit 08c9cc0938
11 changed files with 64 additions and 27 deletions

View File

@@ -591,15 +591,15 @@ class Fko:
"""
_fko.verify_hmac(self.ctx, hmac_key)
def calculate_hmac(self, hmac_key):
def set_spa_hmac(self, hmac_key):
"""Calculate the HMAC for the given data
"""
_fko.calculate_hmac(self.ctx, hmac_key)
_fko.set_spa_hmac(self.ctx, hmac_key)
def get_hmac_data(self):
def get_spa_hmac(self):
"""Return the HMAC for the data in the current context
"""
_fko.get_hmac_data(self.ctx)
_fko.get_spa_hmac(self.ctx)
# GPG-related functions.

View File

@@ -76,8 +76,8 @@ static PyObject * key_gen(PyObject *self, PyObject *args);
static PyObject * base64_encode(PyObject *self, PyObject *args);
static PyObject * base64_decode(PyObject *self, PyObject *args);
static PyObject * verify_hmac(PyObject *self, PyObject *args);
static PyObject * calculate_hmac(PyObject *self, PyObject *args);
static PyObject * get_hmac_data(PyObject *self, PyObject *args);
static PyObject * set_spa_hmac(PyObject *self, PyObject *args);
static PyObject * get_spa_hmac(PyObject *self, PyObject *args);
/* FKO GPG-related Functions.
*/
@@ -206,9 +206,9 @@ static PyMethodDef FKOMethods[] = {
"Base64 decode function"},
{"verify_hmac", verify_hmac, METH_VARARGS,
"Generate HMAC for the data and verify it against the HMAC included with the data"},
{"calculate_hmac", calculate_hmac, METH_VARARGS,
{"set_spa_hmac", set_spa_hmac, METH_VARARGS,
"Calculate the HMAC for the given data"},
{"get_hmac_data", get_hmac_data, METH_VARARGS,
{"get_spa_hmac", get_spa_hmac, METH_VARARGS,
"Return the HMAC for the data in the current context"},
{"get_gpg_recipient", get_gpg_recipient, METH_VARARGS,
@@ -1330,7 +1330,7 @@ verify_hmac(PyObject *self, PyObject *args)
}
static PyObject *
calculate_hmac(PyObject *self, PyObject *args)
set_spa_hmac(PyObject *self, PyObject *args)
{
fko_ctx_t ctx;
char *hmac_key;
@@ -1340,7 +1340,7 @@ calculate_hmac(PyObject *self, PyObject *args)
if(!PyArg_ParseTuple(args, "ks#", &ctx, &hmac_key, &hmac_key_len))
return NULL;
res = fko_calculate_hmac(ctx, hmac_key, hmac_key_len);
res = fko_set_spa_hmac(ctx, hmac_key, hmac_key_len);
if(res != FKO_SUCCESS)
{
@@ -1352,7 +1352,7 @@ calculate_hmac(PyObject *self, PyObject *args)
}
static PyObject *
get_hmac_data(PyObject *self, PyObject *args)
get_spa_hmac(PyObject *self, PyObject *args)
{
fko_ctx_t ctx;
char *enc_data;
@@ -1361,7 +1361,7 @@ get_hmac_data(PyObject *self, PyObject *args)
if(!PyArg_ParseTuple(args, "k", &ctx))
return NULL;
res = fko_get_hmac_data(ctx, &enc_data);
res = fko_get_spa_hmac(ctx, &enc_data);
if(res != FKO_SUCCESS)
{