Differences From Artifact [ab26d90d17]:
- File
cackey.c
— part of check-in
[f006b206b1]
at
2010-05-14 23:11:47
on branch trunk
— Fixed memory leaks
Updated to only rescan for identities if a slot reset has been detected (user: rkeene, size: 140540) [annotate] [blame] [check-ins using]
To Artifact [4487b6bfe2]:
- File cackey.c — part of check-in [fc063dd0df] at 2010-05-14 23:33:25 on branch trunk — Added untested support for Sign/Decrypt (user: rkeene, size: 142021) [annotate] [blame] [check-ins using]
︙ | |||
1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 | 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | * * RETURN VALUE * ... * * NOTES * ... * */ static ssize_t cackey_signdecrypt(struct cackey_slot *slot, unsigned char *buf, size_t buflen, unsigned char *outbuf, size_t outbuflen) { cackey_ret send_ret; CACKEY_DEBUG_PRINTF("Called."); if (buflen > 255) { CACKEY_DEBUG_PRINTF("Error. buflen is greater than 255 (buflen = %lu)", (unsigned long) buflen); return(-1); } if (outbuflen > 255) { CACKEY_DEBUG_PRINTF("Error. outbuflen is grater than 255 (outbuflen = %lu)", (unsigned long) outbuflen); return(-1); } if (slot == NULL) { CACKEY_DEBUG_PRINTF("Error. slot is NULL"); return(-1); } if (buf == NULL) { CACKEY_DEBUG_PRINTF("Error. buf is NULL"); return(-1); } if (outbuf == NULL) { CACKEY_DEBUG_PRINTF("Error. outbuf is NULL"); return(-1); } send_ret = cackey_send_apdu(slot, GSCIS_CLASS_GLOBAL_PLATFORM, GSCIS_INSTR_SIGNDECRYPT, 0x00, 0x00, buflen, buf, outbuflen, NULL, outbuf, &outbuflen); if (send_ret != CACKEY_PCSC_S_OK) { CACKEY_DEBUG_PRINTF("ADPU Sending Failed -- returning in error."); return(-1); } CACKEY_DEBUG_PRINTF("Returning in success."); return(outbuflen); } /* * SYNPOSIS * ... * * ARGUMENTS * ... * * RETURN VALUE * ... * * NOTES * ... * */ static cackey_ret cackey_login(struct cackey_slot *slot, unsigned char *pin, unsigned long pin_len, int *tries_remaining_p) { unsigned char cac_pin[8] = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}; uint16_t response_code; int tries_remaining; int send_ret; |
︙ | |||
4198 4199 4200 4201 4202 4203 4204 | 4259 4260 4261 4262 4263 4264 4265 4266 4267 4268 4269 4270 4271 4272 4273 4274 | - - - + + | CACKEY_DEBUG_PRINTF("Error. Decrypt not active."); return(CKR_OPERATION_NOT_INITIALIZED); } switch (cackey_sessions[hSession].decrypt_mechanism) { case CKM_RSA_PKCS: |
︙ | |||
4631 4632 4633 4634 4635 4636 4637 | 4691 4692 4693 4694 4695 4696 4697 4698 4699 4700 4701 4702 4703 4704 4705 4706 | - - - + + | CACKEY_DEBUG_PRINTF("Error. Sign not active."); return(CKR_OPERATION_NOT_INITIALIZED); } switch (cackey_sessions[hSession].sign_mechanism) { case CKM_RSA_PKCS: |
︙ |