- sm.c: added test for available memory
- npa.c: removed obsolete comments git-svn-id: https://vsmartcard.svn.sourceforge.net/svnroot/vsmartcard@421 96b47cad-a561-4643-ad3b-153ac7d7599c
This commit is contained in:
@@ -484,28 +484,12 @@ static int npa_gen_auth_1_encrypted_nonce(struct sm_ctx *oldnpactx,
|
||||
*enc_nonce_len = l;
|
||||
|
||||
err:
|
||||
if (c_data) {
|
||||
/* XXX
|
||||
if (c_data->mapping_data)
|
||||
ASN1_OCTET_STRING_free(c_data->mapping_data);
|
||||
if (c_data->eph_pub_key)
|
||||
ASN1_OCTET_STRING_free(c_data->eph_pub_key);
|
||||
if (c_data->auth_token)
|
||||
ASN1_OCTET_STRING_free(c_data->auth_token);*/
|
||||
if (c_data)
|
||||
NPA_GEN_AUTH_C_free(c_data);
|
||||
}
|
||||
if (d)
|
||||
free(d);
|
||||
if (r_data) {
|
||||
/* XXX
|
||||
if (r_data->mapping_data)
|
||||
ASN1_OCTET_STRING_free(r_data->mapping_data);
|
||||
if (r_data->eph_pub_key)
|
||||
ASN1_OCTET_STRING_free(r_data->eph_pub_key);
|
||||
if (r_data->auth_token)
|
||||
ASN1_OCTET_STRING_free(r_data->auth_token);*/
|
||||
if (r_data)
|
||||
NPA_GEN_AUTH_R_free(r_data);
|
||||
}
|
||||
/* XXX */
|
||||
/*if (apdu.resp)*/
|
||||
/*free(apdu.resp);*/
|
||||
|
||||
@@ -528,7 +528,7 @@ static int sm_decrypt(const struct sm_ctx *ctx, sc_card_t *card,
|
||||
goto err;
|
||||
}
|
||||
|
||||
if (apdu->resplen < r) {
|
||||
if (apdu->resplen < r || (r && !apdu->resp)) {
|
||||
sc_debug(card->ctx, SC_LOG_DEBUG_VERBOSE, "Response of SM APDU too long");
|
||||
r = SC_ERROR_OUT_OF_MEMORY;
|
||||
goto err;
|
||||
|
||||
Reference in New Issue
Block a user