change bzero to memset
authorJohn Kohl <jtkohl@mit.edu>
Thu, 8 Nov 1990 16:18:57 +0000 (16:18 +0000)
committerJohn Kohl <jtkohl@mit.edu>
Thu, 8 Nov 1990 16:18:57 +0000 (16:18 +0000)
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@1438 dc483132-0cff-0310-8789-dd5450dbe970

17 files changed:
src/lib/krb5/krb/decrypt_tk.c
src/lib/krb5/krb/encode_kdc.c
src/lib/krb5/krb/encrypt_tk.c
src/lib/krb5/krb/gc_frm_kdc.c
src/lib/krb5/krb/gc_via_tgt.c
src/lib/krb5/krb/get_creds.c
src/lib/krb5/krb/get_in_tkt.c
src/lib/krb5/krb/kdc_rep_dc.c
src/lib/krb5/krb/mk_rep.c
src/lib/krb5/krb/mk_req.c
src/lib/krb5/krb/mk_req_ext.c
src/lib/krb5/krb/mk_safe.c
src/lib/krb5/krb/rd_rep.c
src/lib/krb5/krb/rd_req_dec.c
src/lib/krb5/krb/rd_safe.c
src/lib/krb5/krb/send_tgs.c
src/lib/krb5/os/read_pwd.c

index 3c5619bf4cac7d0e714462619b7b4a6cf0f0ec1c..a6903c6595e9e7ed240b1be58a941d9eccc3e062 100644 (file)
@@ -66,7 +66,8 @@ register krb5_ticket *ticket;
        free(scratch.data);
        return retval;
     }
-#define clean_scratch() {bzero(scratch.data, scratch.length); free(scratch.data);}
+#define clean_scratch() {memset(scratch.data, 0, scratch.length); \
+free(scratch.data);}
     if (retval = krb5_finish_key(&eblock)) {
 
        clean_scratch();
index 4c7f9f81e3a0b45c2c0a25c5540956150ee14944..e6abbf87b0312fbbd284365d435155fc45e91c48 100644 (file)
@@ -66,7 +66,8 @@ OLDDECLARG(krb5_data **, enc_rep)
        return retval;
     }
 
-#define cleanup_scratch() { (void) bzero(scratch->data, scratch->length); krb5_free_data(scratch); }
+#define cleanup_scratch() { (void) memset(scratch->data, 0, scratch->length); \
+krb5_free_data(scratch); }
 
     /* put together an eblock for this encryption */
 
@@ -80,7 +81,7 @@ OLDDECLARG(krb5_data **, enc_rep)
        xfree(scratch);
        return ENOMEM;
     }
-    bzero(scratch->data + scratch->length,
+    memset(scratch->data + scratch->length, 0,
          dec_rep->enc_part.ciphertext.length - scratch->length);
     if (!(dec_rep->enc_part.ciphertext.data =
          malloc(dec_rep->enc_part.ciphertext.length))) {
@@ -89,7 +90,7 @@ OLDDECLARG(krb5_data **, enc_rep)
     }
 
 #define cleanup_encpart() { \
-(void) bzero(dec_rep->enc_part.ciphertext.data, \
+(void) memset(dec_rep->enc_part.ciphertext.data, 0, \
             dec_rep->enc_part.ciphertext.length); \
 free(dec_rep->enc_part.ciphertext.data); \
 dec_rep->enc_part.ciphertext.length = 0; \
index 0bf77211381586657b4bff6a31ed1db7648466a1..74f18e324dedd9fbb82a8963235302c7d377803f 100644 (file)
@@ -54,7 +54,8 @@ register krb5_ticket *dec_ticket;
        return retval;
     }
 
-#define cleanup_scratch() { (void) bzero(scratch->data, scratch->length); krb5_free_data(scratch); }
+#define cleanup_scratch() { (void) memset(scratch->data, 0, scratch->length); \
+krb5_free_data(scratch); }
 
     /* put together an eblock for this encryption */
 
@@ -69,7 +70,7 @@ register krb5_ticket *dec_ticket;
        xfree(scratch);
        return ENOMEM;
     }
-    bzero(scratch->data + scratch->length,
+    memset(scratch->data + scratch->length, 0,
          dec_ticket->enc_part.ciphertext.length - scratch->length);
     if (!(dec_ticket->enc_part.ciphertext.data =
          malloc(dec_ticket->enc_part.ciphertext.length))) {
@@ -78,7 +79,7 @@ register krb5_ticket *dec_ticket;
     }
 
 #define cleanup_encpart() {\
-(void) bzero(dec_ticket->enc_part.ciphertext.data, \
+(void) memset(dec_ticket->enc_part.ciphertext.data, 0,\
             dec_ticket->enc_part.ciphertext.length); \
 free(dec_ticket->enc_part.ciphertext.data); \
 dec_ticket->enc_part.ciphertext.length = 0; \
index 151432b279e8c51ba66aba74ecabdd0f21ccffda..6f85223464e1ebe3a554113de135ddd9d2ef4d2b 100644 (file)
@@ -84,7 +84,7 @@ krb5_get_cred_from_kdc (ccache, cred, tgts)
      * XXX we're sharing some substructure here, which is
      * probably not safe...
      */
-    bzero((char *)&tgtq, sizeof(tgtq));
+    memset((char *)&tgtq, 0, sizeof(tgtq));
     tgtq.client = cred->client;
 
     if (retval = krb5_tgtname(krb5_princ_realm(cred->client),
@@ -154,7 +154,7 @@ krb5_get_cred_from_kdc (ccache, cred, tgts)
                goto out;
            }
            /* now get the TGTs */
-           bzero((char *)&tgtq, sizeof(tgtq));
+           memset((char *)&tgtq, 0, sizeof(tgtq));
            tgtq.times = tgt.times;
            tgtq.client = tgt.client;
            tgtq.server = *next_server;
index fd02f982130d19bd4441c928db38518d3dffdfc3..b05c6fd4949645fbd5464c76cbfd50177a9af401 100644 (file)
@@ -112,7 +112,7 @@ OLDDECLARG(krb5_creds *, cred)
        return retval;
 #undef cleanup
 #define cleanup() {\
-       bzero((char *)dec_rep->enc_part2->session->contents,\
+       memset((char *)dec_rep->enc_part2->session->contents, 0,\
              dec_rep->enc_part2->session->length);\
                  krb5_free_kdc_rep(dec_rep); }
 
@@ -128,12 +128,12 @@ OLDDECLARG(krb5_creds *, cred)
        cleanup();
        return retval;
     }
-    bzero((char *)dec_rep->enc_part2->session->contents,
+    memset((char *)dec_rep->enc_part2->session->contents, 0,
          dec_rep->enc_part2->session->length);
 
 #undef cleanup
 #define cleanup() {\
-       bzero((char *)cred->keyblock.contents, cred->keyblock.length);\
+       memset((char *)cred->keyblock.contents, 0, cred->keyblock.length);\
                  krb5_free_kdc_rep(dec_rep); }
 
     cred->times = dec_rep->enc_part2->times;
index 4bc264660065d764f109638dc611429663bce751..74cb00ab6ae6d3615c08d2c8ce390b5f3a95fa9c 100644 (file)
@@ -45,7 +45,7 @@ krb5_creds *creds;
     krb5_creds mcreds;
     krb5_flags fields;
 
-    bzero((char *)&mcreds, sizeof(mcreds));
+    memset((char *)&mcreds, 0, sizeof(mcreds));
     mcreds.server = creds->server;
     mcreds.client = creds->client;
     mcreds.times.endtime = creds->times.endtime;
index ad5a40f5bba11a06776fb612f8dbe659ac4415de..fb2772fc507c2a69c1ec2246a76e79eeceb42526 100644 (file)
@@ -154,7 +154,7 @@ OLDDECLARG(krb5_ccache, ccache)
     }
     
     retval = (*decrypt_proc)(decrypt_key, decryptarg, as_reply);
-    bzero((char *)decrypt_key->contents, decrypt_key->length);
+    memset((char *)decrypt_key->contents, 0, decrypt_key->length);
     krb5_free_keyblock(decrypt_key);
     if (retval) {
        krb5_free_kdc_rep(as_reply);
@@ -182,7 +182,7 @@ OLDDECLARG(krb5_ccache, ccache)
            (request.till != 0) &&
            (as_reply->enc_part2->times.renew_till > request.till))
        ) {
-       bzero((char *)as_reply->enc_part2->session->contents,
+       memset((char *)as_reply->enc_part2->session->contents, 0,
              as_reply->enc_part2->session->length);
        krb5_free_kdc_rep(as_reply);
        return KRB5_KDCREP_MODIFIED;
@@ -193,12 +193,12 @@ OLDDECLARG(krb5_ccache, ccache)
     /* fill in the credentials */
     if (retval = krb5_copy_keyblock(as_reply->enc_part2->session,
                                    &creds->keyblock)) {
-       bzero((char *)as_reply->enc_part2->session->contents,
+       memset((char *)as_reply->enc_part2->session->contents, 0,
              as_reply->enc_part2->session->length);
        krb5_free_kdc_rep(as_reply);
        return retval;
     }
-#define cleanup_key() {bzero((char *)creds->keyblock.contents, \
+#define cleanup_key() {memset((char *)creds->keyblock.contents, 0,\
                             creds->keyblock.length); \
                       free((char *)creds->keyblock.contents); \
                       creds->keyblock.contents = 0; \
index 8fb19d7241e7a5f878f682730d9e6d1b21cde953..0ae1cd1c7fb99bb5616bd5e87c9e4b5cfcfa4d51 100644 (file)
@@ -68,7 +68,8 @@ OLDDECLARG(krb5_kdc_rep *, dec_rep)
        free(scratch.data);
        return retval;
     }
-#define clean_scratch() {bzero(scratch.data, scratch.length); free(scratch.data);}
+#define clean_scratch() {memset(scratch.data, 0, scratch.length); \
+free(scratch.data);}
     if (retval = krb5_finish_key(&eblock)) {
        clean_scratch();
        return retval;
index 7df97389a1c2852fa16c577dbb47384d816938c7..926da2d05282b2dbc5a9993db787e3bef9cd6729 100644 (file)
@@ -62,7 +62,8 @@ krb5_data *outbuf;
     if (retval = encode_krb5_ap_rep_enc_part(repl, &scratch))
        return retval;
 
-#define cleanup_scratch() { (void) bzero(scratch->data, scratch->length); krb5_free_data(scratch); }
+#define cleanup_scratch() { (void) memset(scratch->data, 0, scratch->length); \
+krb5_free_data(scratch); }
 
     /* put together an eblock for this encryption */
 
@@ -79,7 +80,7 @@ krb5_data *outbuf;
        xfree(scratch);
        return ENOMEM;
     }
-    bzero(scratch->data + scratch->length,
+    memset(scratch->data + scratch->length, 0,
          reply.enc_part.ciphertext.length - scratch->length);
     if (!(reply.enc_part.ciphertext.data =
          malloc(reply.enc_part.ciphertext.length))) {
@@ -88,7 +89,7 @@ krb5_data *outbuf;
     }
 
 #define cleanup_encpart() {\
-(void) bzero(reply.enc_part.ciphertext.data, \
+(void) memset(reply.enc_part.ciphertext.data, 0,\
             reply.enc_part.ciphertext.length); \
 free(reply.enc_part.ciphertext.data); \
 reply.enc_part.ciphertext.length = 0; reply.enc_part.ciphertext.data = 0;}
index d475b462cc954c5f741e23777c0ddd2118fa93f0..c539d64724cddf71a435faa0a6785944a448fb48 100644 (file)
@@ -54,11 +54,11 @@ krb5_data *outbuf;
 
     /* obtain ticket & session key */
 
-    bzero((char *)&creds, sizeof(creds));
+    memset((char *)&creds, 0, sizeof(creds));
     creds.server = (krb5_principal) server;
     if (retval = krb5_cc_get_principal(ccache, &creds.client))
        return(retval);
-    /* creds.times.endtime = 0; -- bzero takes care of this
+    /* creds.times.endtime = 0; -- memset 0 takes care of this
                                   zero means "as long as possible" */
     /* creds.keyblock.keytype = 0; -- as well as this.
                                              zero means no session keytype
index 63c191ee8ac7f126788a869a651196b4d55f8f3e..22972b247b597b1c9daca1ceb0eebe35afbb75b3 100644 (file)
@@ -127,7 +127,8 @@ krb5_data *outbuf;
        return(retval);
     }
 
-#define cleanup_scratch() { (void) bzero(scratch->data, scratch->length); krb5_free_data(scratch); }
+#define cleanup_scratch() { (void) memset(scratch->data, 0, scratch->length); \
+krb5_free_data(scratch); }
 
     /* put together an eblock for this encryption */
 
@@ -144,7 +145,7 @@ krb5_data *outbuf;
        retval = ENOMEM;
        goto clean_ticket;
     }
-    bzero(scratch->data + scratch->length,
+    memset(scratch->data + scratch->length, 0,
          request.authenticator.ciphertext.length - scratch->length);
     if (!(request.authenticator.ciphertext.data =
          malloc(request.authenticator.ciphertext.length))) {
@@ -153,7 +154,7 @@ krb5_data *outbuf;
     }
 
 #define cleanup_encpart() {\
-(void) bzero(request.authenticator.ciphertext.data, \
+(void) memset(request.authenticator.ciphertext.data, 0,\
             request.authenticator.ciphertext.length); \
 free(request.authenticator.ciphertext.data); \
 request.authenticator.ciphertext.length = 0; \
index c4a6699a78ce4cce4f75b876d39de50c57e94c4a..975d0cb8f74fd27e1e655387e689e4295da9b0a5 100644 (file)
@@ -87,7 +87,9 @@ OLDDECLARG(krb5_data *, outbuf)
     if (retval = encode_krb5_safe(&safemsg, &scratch))
        return retval;
 
-#define clean_scratch() {(void) bzero((char *)scratch->data, scratch->length); krb5_free_data(scratch);}
+#define clean_scratch() {(void) memset((char *)scratch->data, 0,\
+                                      scratch->length); \
+                         krb5_free_data(scratch);}
                         
     if (!(safe_checksum.contents = (krb5_octet *)
          malloc(krb5_cksumarray[sumtype]->checksum_length))) {
index fffe26ff8478a05a3a3edd16efc4b23949f49c58..419b3439e1b3abb3642ca20abc70f24d5d18c6d2 100644 (file)
@@ -83,7 +83,8 @@ krb5_ap_rep_enc_part *repl;
        (void) krb5_finish_key(&eblock);
        goto errout;
     }
-#define clean_scratch() {bzero(scratch.data, scratch.length); free(scratch.data);}
+#define clean_scratch() {memset(scratch.data, 0, scratch.length); \
+free(scratch.data);}
     /* finished with the top-level encoding of the ap_rep */
     krb5_free_ap_rep(reply);
     if (retval = krb5_finish_key(&eblock)) {
index b7b096d09a094ab94dd12d57354d4616e4edfc95..9592daf0fb057c31a451b82dbf0e544f4ace4a85 100644 (file)
@@ -212,7 +212,8 @@ krb5_authenticator **authpp;
        free(scratch.data);
        return retval;
     }
-#define clean_scratch() {bzero(scratch.data, scratch.length); free(scratch.data);}
+#define clean_scratch() {memset(scratch.data, 0, scratch.length); \
+free(scratch.data);}
     if (retval = krb5_finish_key(&eblock)) {
 
        clean_scratch();
index af6addeef7b8b54cba0ea586e1991662d9512f37..cd194e5cc8519dbeca4bd39c74e2c203858abfec 100644 (file)
@@ -140,7 +140,7 @@ krb5_data *outbuf;
                           (krb5_pointer) key->contents,
                           key->length,
                           &our_cksum);
-    (void) bzero((char *)scratch->data, scratch->length);
+    (void) memset((char *)scratch->data, 0, scratch->length);
     krb5_free_data(scratch);
     
     if (retval) {
index 4e86e26a3ad1e1b949c9424a4c6ca50168894378..9e8d159836418e862423faf24fe0406300f14c6c 100644 (file)
@@ -68,7 +68,7 @@ OLDDECLARG(krb5_response *,rep)
     krb5_ticket *sec_ticket = 0;
     krb5_ticket *sec_ticket_arr[2];
 
-    bzero((char *)&tgsreq, sizeof(tgsreq));
+    memset((char *)&tgsreq, 0, sizeof(tgsreq));
 
     tgsreq.kdc_options = kdcoptions;
     tgsreq.server = (krb5_principal) sname;
index 8d3118de3ae85568d0be415c344abf3577168abb..d86d6ee1b303b7f50557d9ce5ce6e744401f5002 100644 (file)
@@ -95,10 +95,10 @@ int *size_return;
     if (setjmp(pwd_jump)) {
        /* interrupted */
        if (readin_string) {
-           (void) bzero(readin_string, *size_return);
+           (void) memset(readin_string, 0, *size_return);
            free(readin_string);
        }
-       (void) bzero(return_pwd, *size_return);
+       (void) memset(return_pwd, 0, *size_return);
        cleanup(KRB5_LIBOS_PWDINTR);
     }
     /* save intrfunc */
@@ -107,12 +107,12 @@ int *size_return;
     /* put out the prompt */
     (void) fputs(prompt,stdout);
     (void) fflush(stdout);
-    (void) bzero(return_pwd, *size_return);
+    (void) memset(return_pwd, 0, *size_return);
 
     if (fgets(return_pwd, *size_return, stdin) == NULL) {
        /* error */
        (void) putchar('\n');
-       (void) bzero(return_pwd, *size_return);
+       (void) memset(return_pwd, 0, *size_return);
        cleanup(KRB5_LIBOS_CANTREADPWD);
     }
     (void) putchar('\n');
@@ -132,15 +132,15 @@ int *size_return;
        (void) fflush(stdout);
        readin_string = malloc(*size_return);
        if (!readin_string) {
-           (void) bzero(return_pwd, *size_return);
+           (void) memset(return_pwd, 0, *size_return);
            cleanup(ENOMEM);
        }
-       (void) bzero(readin_string, *size_return);
+       (void) memset(readin_string, 0, *size_return);
        if (fgets(readin_string, *size_return, stdin) == NULL) {
            /* error */
            (void) putchar('\n');
-           (void) bzero(readin_string, *size_return);
-           (void) bzero(return_pwd, *size_return);
+           (void) memset(readin_string, 0, *size_return);
+           (void) memset(return_pwd, 0, *size_return);
            free(readin_string);
            cleanup(KRB5_LIBOS_CANTREADPWD);
        }
@@ -155,12 +155,12 @@ int *size_return;
            
        /* compare */
        if (strncmp(return_pwd, readin_string, *size_return)) {
-           (void) bzero(readin_string, *size_return);
-           (void) bzero(return_pwd, *size_return);
+           (void) memset(readin_string, 0, *size_return);
+           (void) memset(return_pwd, 0, *size_return);
            free(readin_string);
            cleanup(KRB5_LIBOS_BADPWDMATCH);
        }
-       (void) bzero(readin_string, *size_return);
+       (void) memset(readin_string, 0, *size_return);
        free(readin_string);
     }