| 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 #include "secoid.h" | 5 #include "secoid.h" |
| 6 #include "secder.h" /* XXX remove this when remove the DERTemplate */ | 6 #include "secder.h" /* XXX remove this when remove the DERTemplate */ |
| 7 #include "secasn1.h" | 7 #include "secasn1.h" |
| 8 #include "secitem.h" | 8 #include "secitem.h" |
| 9 #include "secerr.h" | 9 #include "secerr.h" |
| 10 | 10 |
| 11 SECOidTag | 11 SECOidTag |
| 12 SECOID_GetAlgorithmTag(SECAlgorithmID *id) | 12 SECOID_GetAlgorithmTag(const SECAlgorithmID *id) |
| 13 { | 13 { |
| 14 if (id == NULL || id->algorithm.data == NULL) | 14 if (id == NULL || id->algorithm.data == NULL) |
| 15 return SEC_OID_UNKNOWN; | 15 return SEC_OID_UNKNOWN; |
| 16 | 16 |
| 17 return SECOID_FindOIDTag (&(id->algorithm)); | 17 return SECOID_FindOIDTag (&(id->algorithm)); |
| 18 } | 18 } |
| 19 | 19 |
| 20 SECStatus | 20 SECStatus |
| 21 SECOID_SetAlgorithmID(PLArenaPool *arena, SECAlgorithmID *id, SECOidTag which, | 21 SECOID_SetAlgorithmID(PLArenaPool *arena, SECAlgorithmID *id, SECOidTag which, |
| 22 SECItem *params) | 22 SECItem *params) |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 } | 90 } |
| 91 id->parameters.data[0] = SEC_ASN1_NULL; | 91 id->parameters.data[0] = SEC_ASN1_NULL; |
| 92 id->parameters.data[1] = 0; | 92 id->parameters.data[1] = 0; |
| 93 } | 93 } |
| 94 } | 94 } |
| 95 | 95 |
| 96 return SECSuccess; | 96 return SECSuccess; |
| 97 } | 97 } |
| 98 | 98 |
| 99 SECStatus | 99 SECStatus |
| 100 SECOID_CopyAlgorithmID(PLArenaPool *arena, SECAlgorithmID *to, SECAlgorithmID *f
rom) | 100 SECOID_CopyAlgorithmID(PLArenaPool *arena, SECAlgorithmID *to, |
| 101 const SECAlgorithmID *from) |
| 101 { | 102 { |
| 102 SECStatus rv; | 103 SECStatus rv; |
| 103 | 104 |
| 104 rv = SECITEM_CopyItem(arena, &to->algorithm, &from->algorithm); | 105 rv = SECITEM_CopyItem(arena, &to->algorithm, &from->algorithm); |
| 105 if (rv) return rv; | 106 if (rv) return rv; |
| 106 rv = SECITEM_CopyItem(arena, &to->parameters, &from->parameters); | 107 rv = SECITEM_CopyItem(arena, &to->parameters, &from->parameters); |
| 107 return rv; | 108 return rv; |
| 108 } | 109 } |
| 109 | 110 |
| 110 void SECOID_DestroyAlgorithmID(SECAlgorithmID *algid, PRBool freeit) | 111 void SECOID_DestroyAlgorithmID(SECAlgorithmID *algid, PRBool freeit) |
| 111 { | 112 { |
| 112 SECITEM_FreeItem(&algid->parameters, PR_FALSE); | 113 SECITEM_FreeItem(&algid->parameters, PR_FALSE); |
| 113 SECITEM_FreeItem(&algid->algorithm, PR_FALSE); | 114 SECITEM_FreeItem(&algid->algorithm, PR_FALSE); |
| 114 if(freeit == PR_TRUE) | 115 if(freeit == PR_TRUE) |
| 115 PORT_Free(algid); | 116 PORT_Free(algid); |
| 116 } | 117 } |
| 117 | 118 |
| 118 SECComparison | 119 SECComparison |
| 119 SECOID_CompareAlgorithmID(SECAlgorithmID *a, SECAlgorithmID *b) | 120 SECOID_CompareAlgorithmID(SECAlgorithmID *a, SECAlgorithmID *b) |
| 120 { | 121 { |
| 121 SECComparison rv; | 122 SECComparison rv; |
| 122 | 123 |
| 123 rv = SECITEM_CompareItem(&a->algorithm, &b->algorithm); | 124 rv = SECITEM_CompareItem(&a->algorithm, &b->algorithm); |
| 124 if (rv) return rv; | 125 if (rv) return rv; |
| 125 rv = SECITEM_CompareItem(&a->parameters, &b->parameters); | 126 rv = SECITEM_CompareItem(&a->parameters, &b->parameters); |
| 126 return rv; | 127 return rv; |
| 127 } | 128 } |
| OLD | NEW |