| OLD | NEW |
| 1 /* This Source Code Form is subject to the terms of the Mozilla Public | 1 /* This Source Code Form is subject to the terms of the Mozilla Public |
| 2 * License, v. 2.0. If a copy of the MPL was not distributed with this | 2 * License, v. 2.0. If a copy of the MPL was not distributed with this |
| 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
| 4 | 4 |
| 5 /* | 5 /* |
| 6 * Support routines for PKCS7 implementation, none of which are exported. | 6 * Support routines for PKCS7 implementation, none of which are exported. |
| 7 * This file should only contain things that are needed by both the | 7 * This file should only contain things that are needed by both the |
| 8 * encoding/creation side *and* the decoding/decryption side. Anything | 8 * encoding/creation side *and* the decoding/decryption side. Anything |
| 9 * else should be static routines in the appropriate file. | 9 * else should be static routines in the appropriate file. |
| 10 */ | 10 */ |
| (...skipping 693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 704 output += ofraglen; | 704 output += ofraglen; |
| 705 } | 705 } |
| 706 | 706 |
| 707 pcount = input_len - ifraglen; | 707 pcount = input_len - ifraglen; |
| 708 PORT_Assert (pcount < bsize); | 708 PORT_Assert (pcount < bsize); |
| 709 if (pcount) | 709 if (pcount) |
| 710 PORT_Memcpy (pbuf, input + ifraglen, pcount); | 710 PORT_Memcpy (pbuf, input + ifraglen, pcount); |
| 711 } | 711 } |
| 712 | 712 |
| 713 if (final) { | 713 if (final) { |
| 714 » padlen = padsize - (pcount % padsize); | 714 » padlen = padsize ? padsize - (pcount % padsize) : 0; |
| 715 PORT_Memset (pbuf + pcount, padlen, padlen); | 715 PORT_Memset (pbuf + pcount, padlen, padlen); |
| 716 rv = (* obj->doit) (obj->cx, output, &ofraglen, max_output_len, | 716 rv = (* obj->doit) (obj->cx, output, &ofraglen, max_output_len, |
| 717 pbuf, pcount+padlen); | 717 pbuf, pcount+padlen); |
| 718 if (rv != SECSuccess) | 718 if (rv != SECSuccess) |
| 719 return rv; | 719 return rv; |
| 720 | 720 |
| 721 /* | 721 /* |
| 722 * For now anyway, all of our ciphers have the same number of | 722 * For now anyway, all of our ciphers have the same number of |
| 723 * bytes of output as they do input. If this ever becomes untrue, | 723 * bytes of output as they do input. If this ever becomes untrue, |
| 724 * then sec_PKCS7EncryptLength needs to be made smarter! | 724 * then sec_PKCS7EncryptLength needs to be made smarter! |
| (...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1311 theTemplate = SEC_PointerToPKCS7EncryptedDataTemplate; | 1311 theTemplate = SEC_PointerToPKCS7EncryptedDataTemplate; |
| 1312 break; | 1312 break; |
| 1313 } | 1313 } |
| 1314 return theTemplate; | 1314 return theTemplate; |
| 1315 } | 1315 } |
| 1316 | 1316 |
| 1317 /* | 1317 /* |
| 1318 * End of templates. Do not add stuff after this; put new code | 1318 * End of templates. Do not add stuff after this; put new code |
| 1319 * up above the start of the template definitions. | 1319 * up above the start of the template definitions. |
| 1320 */ | 1320 */ |
| OLD | NEW |