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 * Base64 decoding (ascii to binary). | 6 * Base64 decoding (ascii to binary). |
7 */ | 7 */ |
8 | 8 |
9 #include "nssb64.h" | 9 #include "nssb64.h" |
10 #include "nspr.h" | 10 #include "nspr.h" |
(...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
705 * and the Item will be allocated for you. | 705 * and the Item will be allocated for you. |
706 * | 706 * |
707 * In any case, the data within the Item will be allocated for you. | 707 * In any case, the data within the Item will be allocated for you. |
708 * All allocation will happen out of the passed-in "arenaOpt", if non-NULL. | 708 * All allocation will happen out of the passed-in "arenaOpt", if non-NULL. |
709 * If "arenaOpt" is NULL, standard allocation (heap) will be used and | 709 * If "arenaOpt" is NULL, standard allocation (heap) will be used and |
710 * you will want to free the result via SECITEM_FreeItem. | 710 * you will want to free the result via SECITEM_FreeItem. |
711 * | 711 * |
712 * Return value is NULL on error, the Item (allocated or provided) otherwise. | 712 * Return value is NULL on error, the Item (allocated or provided) otherwise. |
713 */ | 713 */ |
714 SECItem * | 714 SECItem * |
715 NSSBase64_DecodeBuffer (PRArenaPool *arenaOpt, SECItem *outItemOpt, | 715 NSSBase64_DecodeBuffer (PLArenaPool *arenaOpt, SECItem *outItemOpt, |
716 const char *inStr, unsigned int inLen) | 716 const char *inStr, unsigned int inLen) |
717 { | 717 { |
718 SECItem *out_item = NULL; | 718 SECItem *out_item = NULL; |
719 PRUint32 max_out_len = 0; | 719 PRUint32 max_out_len = 0; |
720 PRUint32 out_len; | 720 PRUint32 out_len; |
721 void *mark = NULL; | 721 void *mark = NULL; |
722 unsigned char *dummy; | 722 unsigned char *dummy; |
723 | 723 |
724 if ((outItemOpt != NULL && outItemOpt->data != NULL) || inLen == 0) { | 724 if ((outItemOpt != NULL && outItemOpt->data != NULL) || inLen == 0) { |
725 PORT_SetError (SEC_ERROR_INVALID_ARGS); | 725 PORT_SetError (SEC_ERROR_INVALID_ARGS); |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
827 binary_item->len = 0; | 827 binary_item->len = 0; |
828 | 828 |
829 dummy = NSSBase64_DecodeBuffer (NULL, binary_item, ascii, | 829 dummy = NSSBase64_DecodeBuffer (NULL, binary_item, ascii, |
830 (PRUint32) PORT_Strlen(ascii)); | 830 (PRUint32) PORT_Strlen(ascii)); |
831 | 831 |
832 if (dummy == NULL) | 832 if (dummy == NULL) |
833 return SECFailure; | 833 return SECFailure; |
834 | 834 |
835 return SECSuccess; | 835 return SECSuccess; |
836 } | 836 } |
OLD | NEW |