OLD | NEW |
1 /* crypto/x509/x509name.c */ | 1 /* crypto/x509/x509name.c */ |
2 /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 * All rights reserved. | 3 * All rights reserved. |
4 * | 4 * |
5 * This package is an SSL implementation written | 5 * This package is an SSL implementation written |
6 * by Eric Young (eay@cryptsoft.com). | 6 * by Eric Young (eay@cryptsoft.com). |
7 * The implementation was written so as to conform with Netscapes SSL. | 7 * The implementation was written so as to conform with Netscapes SSL. |
8 * | 8 * |
9 * This library is free for commercial and non-commercial use as long as | 9 * This library is free for commercial and non-commercial use as long as |
10 * the following conditions are aheared to. The following conditions | 10 * the following conditions are aheared to. The following conditions |
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
349 int X509_NAME_ENTRY_set_data(X509_NAME_ENTRY *ne, int type, | 349 int X509_NAME_ENTRY_set_data(X509_NAME_ENTRY *ne, int type, |
350 const unsigned char *bytes, int len) | 350 const unsigned char *bytes, int len) |
351 { | 351 { |
352 int i; | 352 int i; |
353 | 353 |
354 if ((ne == NULL) || ((bytes == NULL) && (len != 0))) return(0); | 354 if ((ne == NULL) || ((bytes == NULL) && (len != 0))) return(0); |
355 if((type > 0) && (type & MBSTRING_FLAG)) | 355 if((type > 0) && (type & MBSTRING_FLAG)) |
356 return ASN1_STRING_set_by_NID(&ne->value, bytes, | 356 return ASN1_STRING_set_by_NID(&ne->value, bytes, |
357 len, type, | 357 len, type, |
358 OBJ_obj2nid(ne->object)) ? 1 : 0; | 358 OBJ_obj2nid(ne->object)) ? 1 : 0; |
359 » if (len < 0) len=strlen((char *)bytes); | 359 » if (len < 0) len=strlen((const char *)bytes); |
360 i=ASN1_STRING_set(ne->value,bytes,len); | 360 i=ASN1_STRING_set(ne->value,bytes,len); |
361 if (!i) return(0); | 361 if (!i) return(0); |
362 if (type != V_ASN1_UNDEF) | 362 if (type != V_ASN1_UNDEF) |
363 { | 363 { |
364 if (type == V_ASN1_APP_CHOOSE) | 364 if (type == V_ASN1_APP_CHOOSE) |
365 ne->value->type=ASN1_PRINTABLE_type(bytes,len); | 365 ne->value->type=ASN1_PRINTABLE_type(bytes,len); |
366 else | 366 else |
367 ne->value->type=type; | 367 ne->value->type=type; |
368 } | 368 } |
369 return(1); | 369 return(1); |
370 } | 370 } |
371 | 371 |
372 ASN1_OBJECT *X509_NAME_ENTRY_get_object(X509_NAME_ENTRY *ne) | 372 ASN1_OBJECT *X509_NAME_ENTRY_get_object(X509_NAME_ENTRY *ne) |
373 { | 373 { |
374 if (ne == NULL) return(NULL); | 374 if (ne == NULL) return(NULL); |
375 return(ne->object); | 375 return(ne->object); |
376 } | 376 } |
377 | 377 |
378 ASN1_STRING *X509_NAME_ENTRY_get_data(X509_NAME_ENTRY *ne) | 378 ASN1_STRING *X509_NAME_ENTRY_get_data(X509_NAME_ENTRY *ne) |
379 { | 379 { |
380 if (ne == NULL) return(NULL); | 380 if (ne == NULL) return(NULL); |
381 return(ne->value); | 381 return(ne->value); |
382 } | 382 } |
383 | 383 |
OLD | NEW |